KerrHiggsHyp.h

00001 #ifndef gridripper_phys_gr_fixmp_kerrhiggshyp_KerrHiggsHyp_h
00002 #define gridripper_phys_gr_fixmp_kerrhiggshyp_KerrHiggsHyp_h
00003 
00004 
00005 #include <gridripper/Parameters.h>
00006 #include <gridripper/amr1d/PDE.h>
00007 #include <gridripper/lang/IllegalArgumentException.h>
00008 #include <gridripper/multipole/ScalarFieldMP.h>
00009 
00010 #include <time.h> 
00011 
00012 
00013 namespace gridripper { namespace phys { namespace gr { namespace fixmp {
00014 namespace kerrhiggshyp {
00015 
00016 
00017 using namespace gridripper;
00018 using namespace gridripper::multipole;
00019 using namespace std;
00020 
00021 
00023 
00024 
00033 class KerrHiggsHyp: public PDE
00034 {
00035 public:
00036     static const GReal_t EPSILON=1e-8;
00037 
00038     /* Field component indices. */
00039     enum { ind_f=0, ind_fT=1, ind_fR=2 };
00040 
00042     const int maxOrder;
00048     const int arraySize;
00049 
00051     const int I_f;      // <- ind_f*arraySize
00052     const int I_fT;     // <- ind_fT*arraySize
00053     const int I_fR;     // <- ind_fR*arraySize
00055     static const int NUM_INDEP_COMPS=2;
00057     static const int NUM_CONSTRAINTS=1;
00059     static const int NUM_COMPS=NUM_INDEP_COMPS+NUM_CONSTRAINTS;
00060 
00062     static const string COMP_NAMES[NUM_COMPS];
00063     static const string CONSTRAINT_NAMES[NUM_CONSTRAINTS];
00064     static const string COORD_LABELS[2];
00065 
00066 private:
00067 
00069     tvalarray<GReal_t> df;
00070 
00072     GReal_t M;          // <- mass
00073     GReal_t A;          // <- angular momentum
00074 //    GReal_t e;                // <- charge
00075    // GReal_t K;          // koordinatarendszer K parametere XXX
00076     
00077 
00079 //    GReal_t lambda;    // <- self coupling constant
00080 //    GReal_t phi0;      // <- equilibrium field value
00081     // (mass=2*sqrt(lambda)*phi0)
00083 //    bool selfInteraction;
00089 //    bool allmassive;
00090     // The field is f=(phi-phi0)*r in the simulation if selfinteration 
00091     // is on, otherwise f=phi*r.
00093 //    GReal_t q;
00094 
00096     GReal_t minR;
00097     GReal_t maxR;
00099     GReal_t minRIntq;
00100     GReal_t maxRIntq;
00101 
00103     // coefficients appearing in the diff. eq.
00104     GReal_t c0;
00105     GReal_t cP;
00106     GReal_t cR;
00107     GReal_t cT;
00108     GReal_t cRP;
00109     GReal_t cTP;
00110     GReal_t cTR;
00111     GReal_t cRR;
00112     
00113     GReal_t R2,R3,R4,R5,R6,R7,R8,R9,R10,R11;
00114     // GReal_t K2,K3,K4;  // XXX
00115     GReal_t M2,M3,M4; // XXX
00116     GReal_t A2,A3,A4;  // XXX
00117     GReal_t AA,BB,aa,bb;  // XXX
00118     GReal_t c00,c01,c02,c03,c04,c05,c06,c07,c08,c09;
00119     GReal_t cR0,cR1,cR2,cR3,cR4,cR5,cR6,cR7,cR8,cR9,cR10,cR11;
00120     GReal_t cT0,cT1,cT2,cT3,cT4,cT5,cT6,cT7,cT8,cT9,cT10;
00121    // GReal_t cTR0,cTR1,cTR2,cTR3,cTR4,cTR5,cTR6;
00122     GReal_t AA0,AA1,AA2,AA3,AA4,AA5,AA6,AA7; // XXX
00123     
00124     GReal_t Rprev;
00125     bool teszt;
00126     int teszt2;
00127     time_t time1,time2;
00128     
00129     mutable ScalarFieldMP<GComplex_t> DEN;
00130     mutable GComplex_t H2S2DENDEN;
00131     mutable GComplex_t scale;
00132     mutable ScalarFieldMP<GComplex_t> scaledDEN;
00133     
00134     mutable ScalarFieldMP<GComplex_t> aux;
00135     
00136     GReal_t neumannTolerance;
00137 
00138     /* Start time. */
00139     GReal_t T0;
00141 //    GReal_t R0;
00142 
00144     static GReal_t horizon;
00146     static bool isMinkowski;
00151     static int transformedR;
00152 
00154     int exclude;
00155 
00156 public:
00157 
00158     KerrHiggsHyp(const Parameters* p, const int maxorder, const int arraysize) throw(IllegalArgumentException&);
00159 
00160     ~KerrHiggsHyp();
00161 
00162     GReal_t getMinX() const;
00163     GReal_t getMaxX() const;
00164     GReal_t getPhysicalMinX() const;
00165     GReal_t getPhysicalMaxX() const;
00166     bool isXPeriodic() const;
00167 
00169     int eval(GReal_t* dF, GReal_t T, GReal_t R,
00170              const GReal_t* F, const GReal_t* F_R,
00171              const Grid& G, int i, Grad& d, GReal_t dT);
00172 
00180     void evalConstrainedComponents(Grid& G, int i, FieldWrapper& v);
00181 
00182     FieldWrapper* createField(int level) const;
00183 
00184     GReal_t energyDensity(GReal_t T, GReal_t R,
00185                           const tvalarray<GReal_t>& F) const;
00186 
00187     GReal_t energyFlow(GReal_t T, GReal_t R,
00188                        const tvalarray<GReal_t>& F) const;
00189 
00190     GReal_t angmomDensity(GReal_t T, GReal_t R,
00191                           const tvalarray<GReal_t>& F) const;
00192 
00193     GReal_t angmomFlow(GReal_t T, GReal_t R,
00194                        const tvalarray<GReal_t>& F) const;
00195 
00200     bool canBeExtended(int where) const;
00201 
00203     void mirrorLeft(GReal_t rh, FieldWrapper& f) const;
00204 
00206     void mirrorRight(GReal_t rh, FieldWrapper& f) const;
00207 
00215     bool hasExtendedRefinedFieldData(const Grid& G, int i) const;
00216 
00218     class Energy: public DensityQuantity {
00219     private:
00220         const KerrHiggsHyp& pde;
00221     public:
00222         Energy(const KerrHiggsHyp* p): DensityQuantity(p), pde(*p) { }
00223         GReal_t density(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00224                         const {
00225             return pde.energyDensity(t, rh, F);
00226         }
00227         GReal_t flow(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F) const {
00228             return pde.energyFlow(t, rh, F);
00229         }
00230         DensityQuantity* cloneDensityQuantity() const {
00231             return new Energy(&pde);
00232         }
00233     };
00234     Energy theEnergy;
00235 
00237     class Angmom: public DensityQuantity {
00238     private:
00239         const KerrHiggsHyp& pde;
00240     public:
00241         Angmom(const KerrHiggsHyp* p): DensityQuantity(p), pde(*p) { }
00242         GReal_t density(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00243                         const {
00244             return pde.angmomDensity(t, rh, F);
00245         }
00246         GReal_t flow(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00247                      const {
00248             return pde.angmomFlow(t, rh, F);
00249         }
00250         DensityQuantity* cloneDensityQuantity() const {
00251             return new Angmom(&pde);
00252         }
00253     };
00254     Angmom theAngmom;
00255 
00257     PhysicalQuantityArray getPhysicalQuantities() const;
00258 
00260     class IntqBorder : public MarkerQuantity
00261     {
00262         private:
00263             const GReal_t position;
00264         public:
00265             IntqBorder(const PDE* eq, GReal_t positionarg)
00266              : MarkerQuantity(eq), position(positionarg)
00267             {  }
00268             ~IntqBorder() {  }
00269             std::string getQuantityName() const { return "IntqBorder"; }
00270             GReal_t eval(GReal_t t);
00271             MarkerQuantity* cloneMarkerQuantity() const
00272             { return new IntqBorder(&getPDE(), position); }
00273     };
00274 
00275  
00276 private:
00277     static tvector<string> componentNames(int maxOrder);
00278     static tvector<string> constraintNames(int maxOrder);
00279 
00280 };
00281 
00282 
00283 } } } } }    // namespace gridripper::phys::gr::fixmp::kerrhiggshyp
00284 
00285 
00286 #endif /* gridripper_phys_gr_fixmp_kerrhiggshyp_KerrHiggsHyp_h */