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