CG  Version 25
Cgmp.h
Go to the documentation of this file.
1 // ================================================================================
2 // Cgmp : CG multi-domain multi-physics solver
3 // ================================================================================
4 
5 
6 #ifndef CGMP_H
7 #define CGMP_H
8 
9 #include "DomainSolver.h"
10 #include "Interface.h"
11 
12 // loop over the value domains in default order
13 #define ForDomain(d) for( int d=0; d<domainSolver.size(); d++ )\
14  if( domainSolver[d]!=NULL )
15 
16 // define a loop over all valid domains (in the order indicated by domainOrder):
17 #define ForDomainOrdered(d) for( int dd=0, d=0; dd<domainSolver.size(); dd++ )\
18  if( domainSolver[d=parameters.dbase.get<std::vector<int> >("domainOrder")[dd]]!=NULL )
19 
20 
21 
22 class Cgmp : public DomainSolver
23 {
24 public:
25 
26 Cgmp(CompositeGrid & cg, GenericGraphicsInterface *ps=NULL, Ogshow *show=NULL, const int & plotOption=1 );
27 
28 virtual ~Cgmp();
29 
30 virtual int
31 assignInterfaceBoundaryConditions(std::vector<int> & newIndex,
32  const real dt );
33 
34 virtual int
35 assignInterfaceRightHandSide( int d, real t, real dt, int correct, std::vector<int> & gfIndex );
36 
37 // Old version:
38 virtual int
39 assignInterfaceRightHandSideOld( int d, real t, real dt, int correct, std::vector<int> & gfIndex );
40 
41 virtual DomainSolver*
42 buildModel( const aString & modelName, CompositeGrid & cg, GenericGraphicsInterface *ps=NULL, Ogshow *show=NULL, const int & plotOption=1 );
43 
44 virtual int
46 
47 virtual int
48 buildTimeSteppingDialog(DialogData & dialog );
49 
50 bool
51 checkInterfaceForConvergence( const int correct,
52  const int numberOfCorrectorSteps,
53  const int numberOfRequiredCorrectorSteps,
54  const real tNew,
55  const bool alwaysSetBoundaryData,
56  std::vector<int> & gfIndex,
57  std::vector<real> & oldResidual,
58  std::vector<real> & initialResidual,
59  std::vector<real> & firstResidual,
60  std::vector<real> & maxResidual,
61  bool & interfaceIterationsHaveConverged );
62 
64 virtual int
65 cycleZero();
66 
67 bool
68 checkIfInterfacesMatch(Mapping &map1, int &dir1, int &side1, Mapping &map2, int &dir2, int &side2);
69 
71 virtual int
72 finishAdvance();
73 
75 {
79 };
80 
81 virtual int
82 getInterfaceResiduals( real t, real dt, std::vector<int> & gfIndex, std::vector<real> & maxResidual,
83  InterfaceValueEnum saveInterfaceValues=doNotSaveInterfaceValues );
84 
85 // OLD version -- only for interfaces with a single face:
86 virtual int
87 getInterfaceResidualsOld( real t, real dt, std::vector<int> & gfIndex, std::vector<real> & maxResidual,
88  InterfaceValueEnum saveInterfaceValues=doNotSaveInterfaceValues );
89 
90 virtual int
91 getModelInfo( std::vector<aString> & modelName );
92 
93 virtual real
95 
96 virtual int
97 getTimeSteppingOption(const aString & answer, DialogData & dialog );
98 
99 virtual int
100 initializeInterfaceBoundaryConditions( real t, real dt, std::vector<int> & gfIndex );
101 
102 virtual int
103 initializeInterfaces(std::vector<int> & newIndex);
104 
105 virtual int
106 interfaceProjection( real t, real dt, int correct, std::vector<int> & gfIndex, int option );
107 
108 // The next routine is used to advance solutions on multi-domains and supports forward-Euler,
109 // predictor-corrector, implicit methods etc.
110 virtual int
111 multiDomainAdvance(real & t, real &tFinal );
112 
113 // here is the new multi-domain advance routine that works with AMR
114 virtual int
115 multiDomainAdvanceNew(real & t, real &tFinal );
116 
117 virtual int
118 plot(const real & t, const int & optionIn, real & tFinal );
119 
120 int
121 plotDomainQuantities( std::vector<realCompositeGridFunction*> u, real t );
122 
123 virtual int
124 printStatistics(FILE *file = stdout);
125 
126 virtual void
127 printTimeStepInfo( const int & step, const real & t, const real & cpuTime );
128 
129 
130 virtual int
131 setParametersInteractively(bool runSetupOnExit=true);
132 
134 virtual int
135 setupAdvance();
136 
137 virtual int
138 setupDomainSolverParameters( int domain, std::vector<aString> & modelNames );
139 
140 virtual int
141 setupPde(aString & reactionName,bool restartChosen, IntegerArray & originalBoundaryCondition);
142 
143 virtual void setup(const real & time = 0.);
144 
145 virtual void
146 setTopLabel(std::vector<realCompositeGridFunction*> u, real t);
147 
148 virtual void
150 
151 virtual int
152 advance(real &tFinal);
153 
154 virtual int
155 solve();
156 
157 // virtual int
158 // solve2();
159 
160 std::vector<DomainSolver*> domainSolver; // holds PDE solvers for each domain
161 
162 Interpolant *interpolant;
163 
164 protected:
165 
166 // utility routine to return the interface type for a grid face on the interface:
167 int
168 getInterfaceType( GridFaceDescriptor & gridDescriptor );
169 
170 
171 
172 private:
173 
174 
175 };
176 
177 #endif