HiggsEq.h

00001 #ifndef gridripper_phys_gr_fixmp_higgsmp_HiggsEq_h
00002 #define gridripper_phys_gr_fixmp_higgsmp_HiggsEq_h
00003 
00004 
00005 #include <gridripper/Parameters.h>
00006 #include <gridripper/amr1d/PDE.h>
00007 #include <gridripper/lang/IllegalArgumentException.h>
00008 #include <gridripper/metric/Metric.h>
00009 
00010 
00011 namespace gridripper { namespace phys { namespace gr { namespace fixmp {
00012 namespace higgsmp {
00013 
00014 
00015 using namespace gridripper;
00016 using namespace gridripper::metric;
00017 using namespace gridripper::amr1d;
00018 using namespace std;
00019 
00020 
00032 class HiggsEq: public PDE
00033 {
00034 public:
00035     static const GReal_t EPSILON=1e-8;
00036 
00037     /* Field component indices. */
00038     enum { ind_f=0, ind_ftau=1, ind_frho=2 };
00039 
00041     const int maxOrder;
00047     const int arraySize;
00048 
00050     const int I_f;      // <- ind_f*arraySize
00051     const int I_ftau;   // <- ind_ftau*arraySize
00052     const int I_frho;   // <- ind_frho*arraySize
00054     static const int NUM_INDEP_COMPS=2;
00056     static const int NUM_CONSTRAINTS=1;
00058     static const int NUM_COMPS=NUM_INDEP_COMPS+NUM_CONSTRAINTS;
00059 
00061     static const string COMP_NAMES[NUM_COMPS];
00062     static const string CONSTRAINT_NAMES[NUM_CONSTRAINTS];
00063     static const string COORD_LABELS[2];
00064 
00065 private:
00066 
00068     tvalarray<GReal_t> df;
00069 
00071     Metric *metric;
00072     mutable MetricValues g;
00073 
00075     GReal_t lambda;    // <- self coupling constant
00076     GReal_t phi0;      // <- equilibrium field value
00077     // (mass=2*sqrt(lambda)*phi0)
00079     bool selfInteraction;
00080     // The field is f=(phi-phi0)*r in the simulation if selfinteration 
00081     // is on, otherwise f=phi*r.
00082 
00087     GReal_t extensionRatio;
00092     GReal_t EmeasurementRatio;
00093 
00095     tvector<GReal_t> param;
00096 
00097     class Energy: public DensityQuantity {
00098     private:
00099         const HiggsEq& pde;
00100     public:
00101         Energy(const HiggsEq* p): DensityQuantity(p), pde(*p) { }
00102         GReal_t density(GReal_t T, GReal_t R, const tvalarray<GReal_t>& F)
00103                         const {
00104             return pde.energyDensity(T, R, F);
00105         }
00106         GReal_t flow(GReal_t T, GReal_t R, const tvalarray<GReal_t>& F) const {
00107             return pde.energyFlow(T, R, F);
00108         }
00109         DensityQuantity* cloneDensityQuantity() const {
00110             return new Energy(&pde);
00111         }
00112     } theEnergy;
00113 
00114 public:
00115     HiggsEq(const Parameters* p, const int maxorder, const int arraysize) throw(IllegalArgumentException&);
00116     ~HiggsEq();
00117 
00118     GReal_t getMinX() const;
00119     GReal_t getMaxX() const;
00120     GReal_t getPhysicalMinX() const;
00121     GReal_t getPhysicalMaxX() const;
00122     bool isXPeriodic() const;
00123 
00125     int eval(GReal_t* dF, GReal_t tau, GReal_t rho,
00126              const GReal_t* F, const GReal_t* F_rho,
00127              const Grid& G, int i, Grad& d, GReal_t dtau);
00128 
00136     void evalConstrainedComponents(Grid& G, int i, FieldWrapper& v);
00137 
00138     FieldWrapper* createField(int level) const;
00139 
00140     GReal_t energyDensity(GReal_t T, GReal_t R, const tvalarray<GReal_t>& F)
00141                           const;
00142 
00143     GReal_t energyFlow(GReal_t T, GReal_t R, const tvalarray<GReal_t>& F)
00144                        const;
00145 
00150     bool canBeExtended(int where) const;
00151 
00153     void mirrorLeft(GReal_t rho, FieldWrapper& f) const;
00154 
00156     void mirrorRight(GReal_t rho, FieldWrapper& f) const;
00157 
00165     bool hasExtendedRefinedFieldData(const Grid& G, int i) const;
00166 
00168     PhysicalQuantityArray getPhysicalQuantities() const;
00169 
00171     class Eextract : public MarkerQuantity
00172     {
00173         private:
00174             GReal_t position;
00175         public:
00176             Eextract(const PDE* eq, GReal_t Position)
00177              : MarkerQuantity(eq), position(Position)
00178             {  }
00179             ~Eextract() {  }
00180             std::string getQuantityName() const { return "Eextract"; }
00181             GReal_t eval(GReal_t tau);
00182             MarkerQuantity* cloneMarkerQuantity() const
00183             { return new Eextract(&getPDE(), position); }
00184     };
00185 
00187     class Lightray : public MarkerQuantity
00188     {
00189         private:
00190             Metric* metric;
00191             GReal_t tau0;
00192             GReal_t rho0;
00193             GReal_t kappa;
00194             int direction;
00195         public:
00196             Lightray(const PDE* eq, Metric* g, GReal_t Tau0, GReal_t Rho0, GReal_t Kappa, int Direction)
00197              : MarkerQuantity(eq), metric(g), tau0(Tau0), rho0(Rho0), kappa(Kappa), direction(Direction)
00198             {  }
00199             ~Lightray() {  }
00200             std::string getQuantityName() const { return "Lightray"; }
00201             GReal_t eval(GReal_t tau);
00202             MarkerQuantity* cloneMarkerQuantity() const
00203             { return new Lightray(&getPDE(), metric, tau0, rho0, kappa, direction); }
00204     };
00205 
00207     class Horizon : public MarkerQuantity
00208     {
00209         private:
00210             Metric* metric;
00211             GReal_t tau0;
00212             GReal_t rho0;
00213             GReal_t kappa;
00214             GReal_t Mass;
00215             int direction;
00216         public:
00217             Horizon(const PDE* eq, Metric* g, GReal_t Tau0, GReal_t Rho0, GReal_t Kappa, GReal_t mass, int Direction)
00218              : MarkerQuantity(eq), metric(g), tau0(Tau0), rho0(Rho0), kappa(Kappa), Mass(mass), direction(Direction)
00219             {  }
00220             ~Horizon() {  }
00221             std::string getQuantityName() const { return "Horizon"; }
00222             GReal_t eval(GReal_t tau);
00223             MarkerQuantity* cloneMarkerQuantity() const
00224             { return new Horizon(&getPDE(), metric, tau0, rho0, kappa, Mass, direction); }
00225     };
00226 
00228     MarkerQuantityArray getMarkerQuantities() const;
00229 
00230 };
00231 
00232 
00233 } } } } } // namespace gridripper::phys::gr::fixmp::higgsmp
00234 
00235 
00236 #endif /* gridripper_phys_gr_fixmp_higgsmp_HiggsEq_h */

Generated on Wed Jun 17 18:46:47 2009 for GridRipper by  doxygen 1.5.6