00001
00002
00003
00004
00005
00006 #ifndef AMROC_PROBLEM_H
00007 #define AMROC_PROBLEM_H
00008
00009 #include "DAGH.h"
00010 #include "IO/control-device.h"
00011 #include "Vector.h"
00012 #include "VectorLarge.h"
00013
00014 #define DIM 3
00015 #define NEQUATIONS 1
00016 typedef DOUBLE DataType;
00017 typedef Vector<DataType,NEQUATIONS> VectorType;
00018
00019 #include "DAGHFortranInterfaces.h"
00020
00021
00022
00023
00024
00025 #include "Integrator.h"
00026
00027 class IntegratorSpecific : public Integrator<VectorType,DIM> {
00028 typedef Integrator<VectorType,DIM> base;
00029 public:
00030 IntegratorSpecific() : _MethodOrder(2) {}
00031
00032 virtual double CalculateGrid(base::vec_grid_data_type& NewStateVec,
00033 base::vec_grid_data_type& OldStateVec,
00034 base::vec_grid_data_type* Flux[],
00035 const int& level,
00036 const double& t, const double& dt,
00037 const int& mpass)
00038 { NewStateVec.copy(OldStateVec); return 1.0; }
00039
00040 virtual void AllocGridFluxes(const BBox &bb, base::vec_grid_data_type**& Flux) {
00041 Flux = new base::vec_grid_data_type* [2*base::Dim()];
00042 for (register int d=0; d<base::Dim(); d++) {
00043 Flux[2*d] = new base::vec_grid_data_type(bb);
00044 Flux[2*d+1] = Flux[2*d];
00045 }
00046 }
00047
00048 virtual void DeAllocGridFluxes(base::vec_grid_data_type**& Flux) {
00049 if (Flux) {
00050 for (register int d=0; d<base::Dim(); d++)
00051 if (Flux[2*d]) delete Flux[2*d];
00052 delete [] Flux;
00053 }
00054 }
00055
00056 virtual void ResetGridFluxes(vec_grid_data_type**& Flux) {
00057 if (Flux) {
00058 VectorType zero(0.0);
00059 for (register int d=0; d<2*base::Dim(); d++)
00060 if (Flux[d])
00061 Flux[d]->equals(zero);
00062 }
00063 }
00064
00065 virtual int ControlGrid(base::vec_grid_data_type& StateVec, const int& level,
00066 const BBox& where, const double& time, const int verbose)
00067 { return 1; }
00068 virtual int NMethodOrder() const { return _MethodOrder; }
00069 private:
00070 int _MethodOrder;
00071 };
00072
00073
00074
00075
00076
00077
00078 #define f_initial FORTRAN_NAME(ic, IC)
00079
00080 extern "C" {
00081 void f_initial();
00082 }
00083
00084 #include "F77Interfaces/F77InitialCondition.h"
00085
00086 class InitialConditionSpecific :
00087 public F77InitialCondition<VectorType,DIM> {
00088 public:
00089 InitialConditionSpecific() :
00090 F77InitialCondition<VectorType,DIM>(f_initial) {}
00091 };
00092
00093
00094
00095
00096
00097 #define f_boundary FORTRAN_NAME(physbd, PHYSBD)
00098
00099 extern "C" {
00100 void f_boundary();
00101 }
00102
00103 #include "F77Interfaces/F77BoundaryConditions.h"
00104
00105 class BoundaryConditionsSpecific :
00106 public F77BoundaryConditions<VectorType,DIM> {
00107 public:
00108 BoundaryConditionsSpecific() :
00109 F77BoundaryConditions<VectorType,DIM>(f_boundary) {}
00110 };
00111
00112
00113
00114
00115
00116 #define f_restrict FORTRAN_NAME(restrict3, RESTRICT3)
00117 #define f_prolong FORTRAN_NAME(prolong3, PROLONG3)
00118
00119 extern "C" {
00120 void f_restrict();
00121 void f_prolong();
00122 }
00123
00124 #include "F77Interfaces/F77LevelTransfer.h"
00125
00126 class LevelTransferSpecific :
00127 public F77LevelTransfer<VectorType,DIM> {
00128 public:
00129 LevelTransferSpecific() :
00130 F77LevelTransfer<VectorType,DIM>(f_prolong, f_restrict) {}
00131 };
00132
00133
00134
00135
00136
00137 #define NFIXUP 5
00138 typedef Vector<DataType,NFIXUP> FixupType;
00139
00140 #include "AMRFixup.h"
00141
00142 class FixupSpecific : public AMRFixup<VectorType,FixupType,DIM> {
00143 public:
00144 FixupSpecific() : AMRFixup<VectorType,FixupType,DIM>() {}
00145 };
00146
00147
00148
00149
00150
00151 typedef short FlagType;
00152
00153 #include "AMRFlagging.h"
00154 #include "Criteria/LimiterType.h"
00155
00156 class FlaggingSpecific :
00157 public AMRFlagging<VectorType,FixupType,FlagType,DIM> {
00158 typedef AMRFlagging<VectorType,FixupType,FlagType,DIM> base;
00159 public:
00160 FlaggingSpecific(base::solver_type& solver) : base(solver) {
00161 base::AddCriterion(new LimiterType<VectorType,FlagType,DIM>());
00162 }
00163
00164 ~FlaggingSpecific() { DeleteAllCriterions(); }
00165 };
00166
00167
00168
00169
00170
00171 #include "AMRSolver.h"
00172
00173 class SolverSpecific :
00174 public AMRSolver<VectorType,FixupType,FlagType,DIM> {
00175 typedef AMRSolver<VectorType,FixupType,FlagType,DIM> base;
00176 public:
00177 SolverSpecific(IntegratorSpecific& integ,
00178 base::initial_condition_type& init,
00179 base::boundary_conditions_type& bc) :
00180 AMRSolver<VectorType,FixupType,FlagType,DIM>(integ, init, bc) {
00181 SetLevelTransfer(new LevelTransferSpecific());
00182 SetFileOutput(new FileOutput<VectorType,DIM>());
00183 SetFixup(new FixupSpecific());
00184 SetFlagging(new FlaggingSpecific(*this));
00185 }
00186
00187 ~SolverSpecific() {
00188 delete _LevelTransfer;
00189 delete _Flagging;
00190 delete _Fixup;
00191 delete _FileOutput;
00192 }
00193
00194 virtual void Initialize(double& t, double& dt) {
00195
00196 U().GF_SetAdaptBoundaryType(DAGHNoAdaptBoundary);
00197 U().GF_SetCommType(DAGHNoComm);
00198
00199 AMRSolver<VectorType,FixupType,FlagType,DIM>::Initialize(t,dt);
00200 }
00201 };
00202
00203
00204
00205
00206
00207 #include "SolverControl.h"
00208
00209 class SolverControlSpecific :
00210 public SolverControl {
00211 public:
00212 SolverControlSpecific(AMRSolver<VectorType,FixupType,FlagType,DIM>& solver) :
00213 SolverControl(solver) {}
00214 };