00001 #ifndef gridripper_phys_gr_fixmp_kerrkgaxhyp_KerrKGaxHyp_h
00002 #define gridripper_phys_gr_fixmp_kerrkgaxhyp_KerrKGaxHyp_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 kerrkgaxhyp {
00015
00016
00017 using namespace gridripper;
00018 using namespace gridripper::multipole;
00019 using namespace std;
00020
00021
00023
00025
00026
00035 class KerrKGaxHyp: public PDE
00036 {
00037 public:
00038 static const GReal_t EPSILON=1e-8;
00039
00040
00041 enum { ind_f=0, ind_fT=1, ind_fR=2 };
00042
00044 const int maxOrder;
00051 const int arraySize;
00052
00053
00055 const int I_f;
00056 const int I_fT;
00057 const int I_fR;
00059 static const int NUM_INDEP_COMPS=2;
00061 static const int NUM_CONSTRAINTS=1;
00063 static const int NUM_COMPS=NUM_INDEP_COMPS+NUM_CONSTRAINTS;
00064
00066 static const string COMP_NAMES[NUM_COMPS];
00067 static const string CONSTRAINT_NAMES[NUM_CONSTRAINTS];
00068 static const string COORD_LABELS[2];
00069
00070 private:
00071
00072 tvalarray<GReal_t> gradf;
00073
00074
00075
00076
00077 int Ym,Yl,absYm,parity;
00078
00079
00081 GReal_t M;
00082 GReal_t A;
00083
00084
00085
00086
00087
00089 GReal_t minR;
00090 GReal_t maxR;
00092 GReal_t minRIntq;
00093 GReal_t maxRIntq;
00094
00097 int maxi2,maxLevel2,gridsize,gri;
00098
00099
00100 GReal_t c0;
00101 GReal_t cP;
00102 GReal_t cR;
00103 GReal_t cT;
00104 GReal_t cRP;
00105 GReal_t cTP;
00106 GReal_t cTR;
00107 GReal_t cRR;
00108
00109 GReal_t R,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11;
00110
00111 GReal_t M2,M3,M4;
00112 GReal_t A2,A3,A4;
00113 GReal_t AA,BB,aa,bb;
00114 GReal_t c00,c01,c02,c03,c04,c05,c06,c07,c08,c09;
00115 GReal_t cR0,cR1,cR2,cR3,cR4,cR5,cR6,cR7,cR8,cR9,cR10,cR11;
00116 GReal_t cT0,cT1,cT2,cT3,cT4,cT5,cT6,cT7,cT8,cT9,cT10;
00117
00118 GReal_t AA0,AA1,AA2,AA3,AA4,AA5,AA6,AA7;
00119
00120 GReal_t Rprev;
00121 bool teszt;
00122 int teszt2;
00123 time_t time1,time2;
00124
00125 const GReal_t *f,*fT,*fR,*pf,*pfT,*pfR;
00126 GReal_t *df,*dfT,*dfR;
00127 GReal_t *p_phi_f, *p_phi_fR, *p_phi_fT, *Lapl_f;
00128 GReal_t *szamlalo;
00129
00130 GReal_t *aux,*aux2;
00131
00132 GReal_t *scale_pre,*aa_pre,*bb_pre,*nBN_pre;
00133
00134
00135
00136 ScalarFieldMP<GComplex_t> DEN;
00137 GReal_t H2S2DENDEN;
00138
00139
00140
00141
00142
00143 GReal_t neumannTolerance;
00144
00145
00146 GReal_t T0;
00147
00148
00149
00150
00152 static GReal_t horizon;
00154 static bool isMinkowski;
00155
00156
00157
00159 int exclude;
00160
00161 int j,j2;
00162
00163 typedef GReal_t vekt3[3];
00164 vekt3 *GC;
00165
00166
00167
00168 void mulY20(GReal_t *v, int numofcomps, GReal_t *result);
00169
00170 void NeumannDiv20(GReal_t *f, GReal_t a0, GReal_t a2, GReal_t *result, int numcomp, GReal_t norm, const GReal_t tolerance);
00171
00172
00173 public:
00174
00175 KerrKGaxHyp(const Parameters* p, const int maxorder, const int arraysize) throw(IllegalArgumentException&);
00176
00177 ~KerrKGaxHyp();
00178
00179 GReal_t getMinX() const;
00180 GReal_t getMaxX() const;
00181 GReal_t getPhysicalMinX() const;
00182 GReal_t getPhysicalMaxX() const;
00183 bool isXPeriodic() const;
00184
00186 int eval(GReal_t* dF, GReal_t T, GReal_t R,
00187 const GReal_t* F, const GReal_t* F_R,
00188 const Grid& G, int i, Grad& d, GReal_t dT);
00189
00197 void evalConstrainedComponents(Grid& G, int i, FieldWrapper& v);
00198
00199 FieldWrapper* createField(int level) const;
00200
00201 GReal_t energyDensity(GReal_t T, GReal_t R,
00202 const tvalarray<GReal_t>& F) const;
00203
00204 GReal_t energyFlow(GReal_t T, GReal_t R,
00205 const tvalarray<GReal_t>& F) const;
00206
00207 GReal_t angmomDensity(GReal_t T, GReal_t R,
00208 const tvalarray<GReal_t>& F) const;
00209
00210 GReal_t angmomFlow(GReal_t T, GReal_t R,
00211 const tvalarray<GReal_t>& F) const;
00212
00217 bool canBeExtended(int where) const;
00218
00220 void mirrorLeft(GReal_t rh, FieldWrapper& f) const;
00221
00223 void mirrorRight(GReal_t rh, FieldWrapper& f) const;
00224
00232 bool hasExtendedRefinedFieldData(const Grid& G, int i) const;
00233
00235 class Energy: public DensityQuantity {
00236 private:
00237 const KerrKGaxHyp& pde;
00238 public:
00239 Energy(const KerrKGaxHyp* p): DensityQuantity(p), pde(*p) { }
00240 GReal_t density(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00241 const {
00242 return pde.energyDensity(t, rh, F);
00243 }
00244 GReal_t flow(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F) const {
00245 return pde.energyFlow(t, rh, F);
00246 }
00247 DensityQuantity* cloneDensityQuantity() const {
00248 return new Energy(&pde);
00249 }
00250 };
00251 Energy theEnergy;
00252
00254 class Angmom: public DensityQuantity {
00255 private:
00256 const KerrKGaxHyp& pde;
00257 public:
00258 Angmom(const KerrKGaxHyp* p): DensityQuantity(p), pde(*p) { }
00259 GReal_t density(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00260 const {
00261 return pde.angmomDensity(t, rh, F);
00262 }
00263 GReal_t flow(GReal_t t, GReal_t rh, const tvalarray<GReal_t>& F)
00264 const {
00265 return pde.angmomFlow(t, rh, F);
00266 }
00267 DensityQuantity* cloneDensityQuantity() const {
00268 return new Angmom(&pde);
00269 }
00270 };
00271 Angmom theAngmom;
00272
00274 PhysicalQuantityArray getPhysicalQuantities() const;
00275
00277 class IntqBorder : public MarkerQuantity
00278 {
00279 private:
00280 const GReal_t position;
00281 public:
00282 IntqBorder(const PDE* eq, GReal_t positionarg)
00283 : MarkerQuantity(eq), position(positionarg)
00284 { }
00285 ~IntqBorder() { }
00286 std::string getQuantityName() const { return "IntqBorder"; }
00287 GReal_t eval(GReal_t t);
00288 MarkerQuantity* cloneMarkerQuantity() const
00289 { return new IntqBorder(&getPDE(), position); }
00290 };
00291
00292
00293 private:
00294 static tvector<string> componentNames(int maxOrder);
00295 static tvector<string> constraintNames(int maxOrder);
00296
00297 };
00298
00299
00300 } } } } }
00301
00302
00303 #endif