RK2.h
00001 #ifndef gridripper_amr1d_gridint_RK2_h
00002 #define gridripper_amr1d_gridint_RK2_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 class Sigma;
00012
00013 namespace gridint {
00014
00015 using namespace std;
00016
00024 class RK2: public Integrator
00025 {
00026 private:
00027 Grid* tmpg;
00028 Grid* resultGrid;
00029 Grid* richardsonResultGrid1;
00030 Grid* richardsonResultGrid2;
00031 O4Dissipation dissipationOp;
00032
00033 public:
00034 RK2(PDE& pde, const tvalarray<string>* opts, Sigma* sigma);
00035
00036 protected:
00042 RK2(const RK2& gi, Grid& g);
00043
00044 private:
00045 RK2(Grid* g, PDE& pde, Grad* d, Grad* d2, int deftype, Sigma* sigma);
00046
00047 public:
00048 ~RK2();
00049
00054 int getNumVelocity() const {
00055 return 4;
00056 }
00057
00058 void integrate(int ir);
00059
00063 void richardson(const AMError& amerr, int ir);
00064
00070 Integrator* createIntegrator(Grid& g, const Sigma* s) const;
00071
00076 Integrator* cloneIntegrator(Grid& g) const;
00077
00083 void getResult(int i, tvalarray<GReal_t>& w) const;
00084
00085 private:
00086 void integrate(const Grid& g0, Grid& g1, Grid& g2,
00087 Grad& grad, Dissipation* dissip, GReal_t dt, int ir);
00088
00089 void step(GReal_t t, GReal_t dt, const Grid& g0, const Grid& gin,
00090 Grid& gout, Grad& grad, Dissipation* dissip, int ir);
00091 };
00092
00093 } } }
00094
00095 #endif