CompactKScODE.h

00001 #ifndef gridripper_phys_gr_dynss_ekg_kodama_CompactKScODE_h
00002 #define gridripper_phys_gr_dynss_ekg_kodama_CompactKScODE_h
00003 
00004 #include <gridripper/odesolver/ODE.h>
00005 #include <gridripper/amr1d/FieldComponents.h>
00006 #include <gridripper/lang/IllegalArgumentException.h>
00007 
00008 namespace gridripper {
00009 class Parameters;
00010 }
00011 
00012 namespace gridripper { namespace phys { namespace gr { namespace dynss {
00013 namespace ekg { namespace kodama {
00014 
00015 using namespace gridripper;
00016 using namespace gridripper::odesolver;
00017 using namespace std;
00018 
00027 class CompactKScODE: public ODE
00028 {
00029 private:
00030     // Field indices:
00031     enum {
00032 //      I_Phi = 0,
00033 //      I_Pi  = 1,
00034         I_B = 0,
00035         I_psi = 1,
00036         NUM_COMPS = 2};
00037 
00038     static const string COMPNAMES[NUM_COMPS];
00039 
00040     GReal_t rhomax;
00041 
00042     GReal_t a;
00043     GReal_t b;
00044     GReal_t c;
00045     GReal_t d;
00046     GReal_t mass;
00047     GReal_t psi0;
00048 
00049 public:
00050     class Field: public FieldComponents<GReal_t>
00051     {
00052     public:
00053         Field(): FieldComponents<GReal_t>(NUM_COMPS) { }
00054         Field(const Field& f): FieldComponents<GReal_t>(f) { }
00055         FieldWrapper* cloneFieldWrapper() const {
00056             return new Field(*this);
00057         }
00058     };
00059 
00060     CompactKScODE(const Parameters* p) throw(IllegalArgumentException&);
00061 
00062     FieldArray getInitialValuesForShooting() const;
00063 
00064     tvalarray<GReal_t> getInitialX() const {
00065         return tvalarray<GReal_t>(0.0, 1);
00066     }
00067 
00068     GReal_t getMinX() const {
00069         return 0;
00070     }
00071 
00072     GReal_t getMaxX() const {
00073         return rhomax;
00074     }
00075 
00076     void initPDE(GReal_t rho, const GReal_t* fode, GReal_t* fpde);
00077 
00078     void eval(const GReal_t* F, int offset, GReal_t rho, GReal_t* dF);
00079 
00080 private:
00081     GReal_t calc_phi(GReal_t rho) const;
00082 };
00083 
00084 } } } } } } // namespace gridripper::phys::gr::dynss::ekg::kodama;
00085 
00086 #endif /* gridripper_phys_gr_dynss_ekg_kodama_CompactKScODE_h */