SchKGHyp.h

00001 #ifndef gridripper_phys_gr_fixmp_schkghyp_SchKGHyp_h
00002 #define gridripper_phys_gr_fixmp_schkghyp_SchKGHyp_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 schkghyp {
00015 
00016 
00017 using namespace gridripper;
00018 using namespace gridripper::multipole;
00019 using namespace std;
00020 
00021 
00023 
00025 
00026 
00035 class SchKGHyp: public PDE
00036 {
00037 public:
00038     static const GReal_t EPSILON=1e-8;
00039 
00040     /* Field component indices. */
00041     enum { ind_f=0, ind_fT=1, ind_fR=2 };
00042 
00043     const int maxOrder;   
00044    
00045     const int arraySize;  // arraySize=1  
00046 
00048     const int I_f;      // <- ind_f*arraySize
00049     const int I_fT;     // <- ind_fT*arraySize
00050     const int I_fR;     // <- ind_fR*arraySize
00052     static const int NUM_INDEP_COMPS=2;
00054     static const int NUM_CONSTRAINTS=1;
00056     static const int NUM_COMPS=NUM_INDEP_COMPS+NUM_CONSTRAINTS;
00057 
00059     static const string COMP_NAMES[NUM_COMPS];
00060     static const string CONSTRAINT_NAMES[NUM_CONSTRAINTS];
00061     static const string COORD_LABELS[2];
00062 
00063 private:
00064 
00065     tvalarray<GReal_t> gradf;  // evalConstrainedComponents-hez
00066   
00067     int Yl; //  modus l indexe
00068   
00070     GReal_t M;          // <- mass
00071 //    GReal_t e;                // <- charge
00072    // GReal_t K;          // koordinatarendszer K parametere 
00073     
00075 //    GReal_t q;
00076 
00078     GReal_t minR;
00079     GReal_t maxR;
00080     
00081     GReal_t dhoriz;
00082     
00084     GReal_t minRIntq;
00085     GReal_t maxRIntq;
00086 
00088     // coefficients appearing in the diff. eq.
00089     GReal_t c0;
00090     GReal_t cP;
00091     GReal_t cR;
00092     GReal_t cT;
00093     GReal_t cRP;
00094     GReal_t cTP;
00095     GReal_t cTR;
00096     GReal_t cRR;
00097     
00098     GReal_t R2,R3,R4,R5,R6,R7,R8,R9,R10,R11;
00099     // GReal_t K2,K3,K4;  
00100     GReal_t M2,M3,M4; 
00101     GReal_t AA;  
00102     GReal_t c00,c01,c02,c03,c04,c05,c06,c07,c08,c09;
00103     GReal_t cR0,cR1,cR2,cR3,cR4,cR5,cR6,cR7,cR8,cR9,cR10,cR11;
00104     GReal_t cT0,cT1,cT2,cT3,cT4,cT5,cT6,cT7,cT8,cT9,cT10;
00105    // GReal_t cTR0,cTR1,cTR2,cTR3,cTR4,cTR5,cTR6;
00106     GReal_t AA0,AA1,AA2,AA3,AA4,AA5,AA6,AA7; 
00107     
00108     GReal_t Rprev;
00109     bool teszt;
00110     int teszt2;
00111     time_t time1,time2;
00112     
00113     const GReal_t *f,*fT,*fR,*pf,*pfT,*pfR;
00114     GReal_t *df,*dfT,*dfR;
00115     //GReal_t *p_phi_f, *p_phi_fR, *p_phi_fT;
00116     GReal_t *Lapl_f;
00117     GReal_t *szamlalo;
00118     
00119 
00120     /* Start time. */
00121     GReal_t T0;
00123 //    GReal_t R0;
00124 
00126     static GReal_t horizon;
00128     static bool isMinkowski;
00133     static int transformedR;
00134 
00136     int exclude;
00137     
00138     
00139     int j;  // ciklusokhoz 
00140 
00141 public:
00142 
00143     SchKGHyp(const Parameters* p, const int maxorder, const int arraysize) throw(IllegalArgumentException&);
00144 
00145     ~SchKGHyp();
00146 
00147     GReal_t getMinX() const;
00148     GReal_t getMaxX() const;
00149     GReal_t getPhysicalMinX() const;
00150     GReal_t getPhysicalMaxX() const;
00151     bool isXPeriodic() const;
00152 
00154     int eval(GReal_t* dF, GReal_t T, GReal_t R,
00155              const GReal_t* F, const GReal_t* F_R,
00156              const Grid& G, int i, Grad& d, GReal_t dT);
00157 
00165     void evalConstrainedComponents(Grid& G, int i, FieldWrapper& fw);
00166 
00167     FieldWrapper* createField(int level) const;
00168 
00169     GReal_t energyDensity(GReal_t T, GReal_t R,
00170                           const tvalarray<GReal_t>& F) const;
00171 
00172     GReal_t energyFlow(GReal_t T, GReal_t R,
00173                        const tvalarray<GReal_t>& F) const;
00174 
00175     GReal_t angmomDensity(GReal_t T, GReal_t R,
00176                           const tvalarray<GReal_t>& F) const;
00177 
00178     GReal_t angmomFlow(GReal_t T, GReal_t R,
00179                        const tvalarray<GReal_t>& F) const;
00180 
00185     bool canBeExtended(int where) const;
00186 
00188     void mirrorLeft(GReal_t rh, FieldWrapper& f) const;
00189 
00191     void mirrorRight(GReal_t rh, FieldWrapper& f) const;
00192 
00200     bool hasExtendedRefinedFieldData(const Grid& G, int i) const;
00201 
00203     class Energy: public DensityQuantity {
00204     private:
00205         const SchKGHyp& pde;
00206     public:
00207         Energy(const SchKGHyp* p): DensityQuantity(p), pde(*p) { }
00208         GReal_t density(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00209                         const {
00210             return pde.energyDensity(t, rh, F);
00211         }
00212         GReal_t flow(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F) const {
00213             return pde.energyFlow(t, rh, F);
00214         }
00215         DensityQuantity* cloneDensityQuantity() const {
00216             return new Energy(&pde);
00217         }
00218     };
00219     Energy theEnergy;
00220 
00222     class Angmom: public DensityQuantity {
00223     private:
00224         const SchKGHyp& pde;
00225     public:
00226         Angmom(const SchKGHyp* p): DensityQuantity(p), pde(*p) { }
00227         GReal_t density(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00228                         const {
00229             return pde.angmomDensity(t, rh, F);
00230         }
00231         GReal_t flow(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00232                      const {
00233             return pde.angmomFlow(t, rh, F);
00234         }
00235         DensityQuantity* cloneDensityQuantity() const {
00236             return new Angmom(&pde);
00237         }
00238     };
00239     Angmom theAngmom;
00240 
00242     PhysicalQuantityArray getPhysicalQuantities() const;
00243 
00245     class IntqBorder : public MarkerQuantity
00246     {
00247         private:
00248             const GReal_t position;
00249         public:
00250             IntqBorder(const PDE* eq, GReal_t positionarg)
00251              : MarkerQuantity(eq), position(positionarg)
00252             {  }
00253             ~IntqBorder() {  }
00254             std::string getQuantityName() const { return "IntqBorder"; }
00255             GReal_t eval(GReal_t t);
00256             MarkerQuantity* cloneMarkerQuantity() const
00257             { return new IntqBorder(&getPDE(), position); }
00258     };
00259 
00260  
00261 private:
00262     static tvector<string> componentNames(int maxOrder);
00263     static tvector<string> constraintNames(int maxOrder);
00264 
00265 };
00266 
00267 
00268 } } } } }    // namespace gridripper::phys::gr::fixmp::schkghyp
00269 
00270 
00271 #endif /* gridripper_phys_gr_fixmp_schkghyp_SchKGHyp_h */