RK4.h
00001 #ifndef gridripper_amr1d_gridint_RK4_h
00002 #define gridripper_amr1d_gridint_RK4_h
00003
00004 #include <gridripper/amr1d/Integrator.h>
00005 #include <gridripper/amr1d/Dissipation.h>
00006
00007 namespace gridripper { namespace amr1d {
00008
00009 class Grid;
00010 class Grad;
00011
00012 namespace gridint {
00013
00014 using namespace std;
00015
00022 class RK4: public Integrator
00023 {
00024 private:
00025 Grid* tmpg1;
00026 Grid* tmpg2;
00027 Grid* tmpg3;
00028 Grid* resultGrid;
00029 Grid* richardsonResultGrid1;
00030 Grid* richardsonResultGrid2;
00031 O6Dissipation dissipationOp;
00032
00033 public:
00034 RK4(PDE& pde, const tvalarray<string>* opts, Sigma* sigma);
00035
00036 protected:
00042 RK4(const RK4& gi, Grid& g);
00043
00044 private:
00045 RK4(Grid* g, PDE& pde, Grad* d, Grad* d2, int deftype, Sigma* sigma);
00046
00047 public:
00048 ~RK4();
00049
00054 int getNumVelocity() const {
00055 return 12;
00056 }
00057
00058 void integrate(int ir);
00059
00060 void richardson(const AMError& amerr, int ir);
00061
00067 Integrator* createIntegrator(Grid& g, const Sigma* s) const;
00068
00073 Integrator* cloneIntegrator(Grid& g) const;
00074
00080 void getResult(int i, tvalarray<GReal_t>& w) const;
00081
00082 private:
00083 void integrate(const Grid& g0, Grid& g1, Grid& g2, Grid& g3, Grid& g4,
00084 Grad& grad, Dissipation* dissip,
00085 GReal_t dt, int ir);
00086
00087 void step(GReal_t t, GReal_t dt, const Grid& g0, const Grid& gin,
00088 Grid& gout, Grad& grad, Dissipation* dissip, int ir);
00089
00090 void step4(GReal_t t, GReal_t dt,
00091 const Grid& g0, const Grid& g1, const Grid& g2, const Grid& g3,
00092 Grid& g4, Grad& grad, Dissipation* dissip, int ir);
00093 };
00094
00095 } } }
00096
00097 #endif