00001
00002
00003 #ifndef AMROC_PROBLEM_H
00004 #define AMROC_PROBLEM_H
00005
00006 #define DIM 3
00007 #define NEQUATIONS 10 // Euler equations for gases in 3D (5 fields),
00008
00009
00010
00011
00012 #define NVARS 7 // Fixup used only for vector of state and 2 scalars
00013
00014 #define OWN_AMRSOLVER
00015 #define OWN_STATISTICS
00016
00017 #include "WENOProblem.h"
00018 #include "WENOStdProblem.h"
00019 #ifdef OWN_STATISTICS
00020 #include "AMRInterpolation.h"
00021 #include "WENOStatistics.h"
00022 #endif
00023
00024 #ifdef OWN_AMRSOLVER
00025
00026 #define f_init_commongm FORTRAN_NAME(comblgm, COMBLGM)
00027
00028 extern "C" {
00029 void f_init_commongm(const INTEGER& meqn, INTEGER* shape, DOUBLE* geom,
00030 INTEGER& maxlev, INTEGER* refine);
00031 }
00032
00033 class SolverSpecific :
00034 public AMRSolver<VectorType,FixupType,FlagType,DIM> {
00035 typedef AMRSolver<VectorType,FixupType,FlagType,DIM> base;
00036 typedef WENOFixup<VectorType,FixupType,DIM> weno_fixup_type;
00037 typedef WENOIntegrator<VectorType,DIM> weno_integ_type;
00038 #ifdef OWN_STATISTICS
00039 typedef AMRInterpolation<VectorType,DIM> interpolation_type;
00040 typedef WENOF77FileOutput<VectorType,DIM> output_type;
00041 typedef WENOStatistics<VectorType,interpolation_type,output_type,DIM> stat_type;
00042 #endif
00043 public:
00044 SolverSpecific(IntegratorSpecific& integ,
00045 base::initial_condition_type& init,
00046 base::boundary_conditions_type& bc) :
00047 AMRSolver<VectorType,FixupType,FlagType,DIM>(integ, init, bc) {
00048 SetLevelTransfer(new F77LevelTransfer<VectorType,DIM>(f_prolong, f_restrict));
00049 #ifdef f_flgout
00050 SetFileOutput(new WENOF77FileOutput<VectorType,DIM>(f_flgout,f_bounds));
00051 #else
00052 SetFileOutput(new FileOutput<VectorType,DIM>());
00053 #endif
00054 SetFixup(new FixupSpecific());
00055 SetFlagging(new FlaggingSpecific(*this));
00056 #ifdef OWN_STATISTICS
00057 _Interpolation = new interpolation_type();
00058 _Stats = new stat_type(_Interpolation, (output_type*)_FileOutput);
00059 #endif
00060 }
00061
00062 #ifdef OWN_STATISTICS
00063 virtual void register_at(ControlDevice& Ctrl) { base::register_at(Ctrl); }
00064 virtual void register_at(ControlDevice& Ctrl, const std::string& prefix) {
00065 base::register_at(Ctrl, prefix);
00066 if (_Stats) _Stats->register_at(base::LocCtrl, "");
00067 }
00068 #endif
00069
00070 virtual void SetupData() {
00071 base::SetupData();
00072 int dim = DIM;
00073 f_init_commongm(dim,shape,geom,MaxLev,_RefineFactor);
00074 #ifdef OWN_STATISTICS
00075 _Interpolation->SetupData(base::PGH(), base::NGhosts());
00076 _Stats->Setup(base::PGH(), base::NGhosts(), base::shape, base::geom);
00077 #endif
00078 }
00079
00080 #ifdef OWN_STATISTICS
00081 virtual void Advance(double& t, double& dt) {
00082 base::Advance(t, dt);
00083 _Stats->Evaluate(base::t, base::U(), base::Work());
00084 }
00085
00086 virtual void Initialize_(const double& dt_start) {
00087 base::Initialize_(dt_start);
00088 _Stats->Evaluate(base::t, base::U(), base::Work());
00089 }
00090 #endif
00091
00092 ~SolverSpecific() {
00093 delete _LevelTransfer;
00094 delete _Flagging;
00095 delete _Fixup;
00096 delete _FileOutput;
00097 #ifdef OWN_STATISTICS
00098 delete _Interpolation;
00099 delete _Stats;
00100 #endif
00101 }
00102 #ifdef OWN_STATISTICS
00103 protected:
00104 interpolation_type* _Interpolation;
00105 stat_type* _Stats;
00106 #endif
00107 };