00001 #ifndef gridripper_phys_minkowski_kg_rt_KGEq_h
00002 #define gridripper_phys_minkowski_kg_rt_KGEq_h
00003
00004 #include <gridripper/amr1d/PDE.h>
00005 #include <gridripper/Parameters.h>
00006 #include <gridripper/lang/IllegalArgumentException.h>
00007
00008 namespace gridripper { namespace phys { namespace minkowski { namespace kg {
00009 namespace rt {
00010
00011 using namespace gridripper::util;
00012 using namespace gridripper::amr1d;
00013 using namespace std;
00014
00022 class KGEq: public PDE
00023 {
00024 public:
00025 enum {I_f = 0,
00026 I_ft = 1,
00027 I_fr = 2,
00028 NUM_INDEP_COMPS = 2,
00029 NUM_COMPS = NUM_INDEP_COMPS + 1};
00030
00031
00032 static const int F_f;
00033 static const int F_ft;
00034 static const int F_fr;
00035
00036 static const string COMPNAMES[NUM_COMPS];
00037
00038 static const string CONSTRAINT_NAMES[1];
00039
00040 private:
00041 static const double EPSILON;
00042
00043 GReal_t mass;
00044
00045 GReal_t massSq;
00046
00048 GReal_t rmax;
00049
00050 GReal_t r0;
00051
00052 tvalarray<GReal_t> df;
00053
00054 class Energy: public DensityQuantity {
00055 private:
00056 const KGEq& pde;
00057 public:
00058 Energy(const KGEq* p): DensityQuantity(p), pde(*p) { }
00059 GReal_t density(GReal_t T, GReal_t R, const tvalarray<GReal_t>& F)
00060 const;
00061 GReal_t flow(GReal_t T, GReal_t R, const tvalarray<GReal_t>& F) const;
00062 DensityQuantity* cloneDensityQuantity() const {
00063 return new Energy(&pde);
00064 }
00065 } theEnergy;
00066
00067 public:
00068 KGEq(const Parameters* p) throw(IllegalArgumentException&);
00069
00070 GReal_t getMinX() const {
00071 return 0;
00072 }
00073
00074 GReal_t getMaxX() const {
00075 return rmax;
00076 }
00077
00078 GReal_t getPhysicalMaxX() const {
00079 return rmax;
00080 }
00081
00082 int eval(GReal_t* dF, GReal_t t, GReal_t r,
00083 const GReal_t* F, const GReal_t* Fr,
00084 const Grid& g, int i, Grad& d, GReal_t dt);
00085
00086 void evalConstrainedComponents(Grid& g, int i, FieldWrapper& v);
00087
00088 FieldWrapper* createField(int level) const;
00089
00094 bool canBeExtended(int where) const {
00095 return where == LEFT;
00096
00097 }
00098
00099 void mirrorLeft(GReal_t R, FieldWrapper& f) const {
00100 GReal_t* v = f.data();
00101 v[I_f] = -v[I_f];
00102 v[I_ft] = -v[I_ft];
00103 }
00104
00105
00106
00107
00108
00109
00110
00111
00119 bool hasExtendedRefinedFieldData(const Grid& g, int i) const;
00120
00128 void getGridField(GReal_t t, GReal_t r, tvalarray<GReal_t>& f) const {
00129 f[I_f] *= r;
00130 f[I_ft] *= r;
00131 f[I_fr] = f[I_f] + r*f[I_fr];
00132 }
00133
00134 PhysicalQuantityArray getPhysicalQuantities() const;
00135 };
00136
00137 } } } } }
00138
00139 #endif