00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _CCProjector_H_
00033 #define _CCProjector_H_
00034
00035
00036 #include <cstdlib>
00037 #include <cmath>
00038 #include <cassert>
00039
00040 #include <iostream>
00041 using std::istream;
00042 using std::cout;
00043 using std::cerr;
00044
00045
00046 #include "REAL.H"
00047 #include "IntVect.H"
00048 #include "Box.H"
00049 #include "FArrayBox.H"
00050 #include "Vector.H"
00051 #include "IntVectSet.H"
00052 #include "DisjointBoxLayout.H"
00053 #include "LevelData.H"
00054 #include "LevelSolver.H"
00055 #include "AMRSolver.H"
00056 #include "QuadCFInterp.H"
00057 #include "GhostBC.H"
00058 #include "PhysBCUtil.H"
00059
00060 #include "FluxBox.H"
00061
00063 class CCProjector
00068 {
00069
00070 public:
00072 CCProjector();
00073
00075 CCProjector(const DisjointBoxLayout& a_grids,
00076 const Box& a_domain,
00077 const Real a_dx,
00078 CCProjector* a_finerProj,
00079 CCProjector* a_crseProj,
00080 int a_nRefCrse,
00081 int a_level,
00082 const PhysBCUtil& a_physBC);
00083
00085 CCProjector(const DisjointBoxLayout& a_grids,
00086 const ProblemDomain& a_domain,
00087 const Real a_dx,
00088 CCProjector* a_finerProj,
00089 CCProjector* a_crseProj,
00090 int a_nRefCrse,
00091 int a_level,
00092 const PhysBCUtil& a_physBC);
00093
00095 ~CCProjector();
00096
00098 void define(const DisjointBoxLayout& a_grids,
00099 const Box& a_domain,
00100 const Real a_dx,
00101 CCProjector* a_finerProj,
00102 CCProjector* a_crseProj,
00103 int a_nRefCrse,
00104 int a_level,
00105 const PhysBCUtil& a_physBC);
00106
00108 void define(const DisjointBoxLayout& a_grids,
00109 const ProblemDomain& a_domain,
00110 const Real a_dx,
00111 CCProjector* a_finerProj,
00112 CCProjector* a_crseProj,
00113 int a_nRefCrse,
00114 int a_level,
00115 const PhysBCUtil& a_physBC);
00116
00117
00119 void init(const CCProjector& a_oldProj);
00120
00122 void variableSetUp();
00123
00125 void setCrseProj(CCProjector* a_crseProj, int nRefCrse);
00126
00128 void setFineProj(CCProjector* a_fineProj);
00129
00131 void writeCheckpointHeader(HDF5Handle& a_handle) const;
00132
00134 void writeCheckpointLevel(HDF5Handle& a_handle) const;
00135
00137 void readCheckpointHeader(HDF5Handle& a_handle);
00138
00140 void readCheckpointLevel(HDF5Handle& a_handle);
00141
00142
00143
00144
00145
00146 void levelMacProject(LevelData<FluxBox>& uEdge,
00147 Real a_oldTime, Real a_dt);
00148
00149
00150
00151
00152
00153 void LevelProject(LevelData<FArrayBox>& a_velocity,
00154 LevelData<FArrayBox>* a_crseVelPtr,
00155 const Real a_newTime, const Real a_dt);
00156
00157
00158
00159
00160
00161 void doSyncOperations(Vector<LevelData<FArrayBox>* >& a_velocity,
00162 Vector<LevelData<FArrayBox>* >& a_lambda,
00163 const Real a_newTime, const Real a_dtSync);
00164
00165
00168 void initialLevelProject(LevelData<FArrayBox>& a_velocity,
00169 LevelData<FArrayBox>* a_crseVelPtr,
00170 const Real a_oldTime, const Real a_newTime);
00171
00172
00173
00174
00175 void doInitialSyncOperations(Vector<LevelData<FArrayBox>* >& a_vel,
00176 Vector<LevelData<FArrayBox>* >& a_lambda,
00177 const Real a_newTime, const Real a_dtSync);
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 void initialVelocityProject(Vector<LevelData<FArrayBox>* >& a_velocity,
00189 bool a_homogeneousCFBC = true);
00190
00191
00192
00193 void initialVelocityProject(Vector<LevelData<FArrayBox>* >& a_velocity,
00194 AMRSolver& a_solver,
00195 bool a_homogeneousCFBC = true);
00196
00197
00198
00199
00200
00201
00202 void doPostRegridOps(Vector<LevelData<FArrayBox>* >& a_velocity,
00203 Vector<LevelData<FArrayBox>* >& a_lambda,
00204 const Real a_dt, const Real a_time);
00205
00207
00209 int getLevel() const;
00210
00212 const ProblemDomain& dProblem() const;
00213
00215 const DisjointBoxLayout& getBoxes() const;
00216
00218 int nRefCrse() const;
00219
00221 Real dx() const;
00222
00224 Real etaLambda() const;
00225
00227 CCProjector* fineProjPtr() const;
00228
00230 CCProjector* crseProjPtr() const;
00231
00233 LevelData<FArrayBox>& phi();
00234
00236 const LevelData<FArrayBox>& phi() const;
00237
00239 void gradPhi(LevelData<FArrayBox>& a_gradPhi, int a_dir) const;
00240
00242 void gradPhi(LevelData<FluxBox>& a_gradPhi) const;
00243
00245 LevelData<FArrayBox>& Pi();
00246
00248 void gradPi(LevelData<FArrayBox>& a_gradPi, int a_dir) const;
00249
00250
00251
00252
00253 void gradPi(LevelData<FArrayBox>& a_gradPi) const;
00254
00256 LevelData<FArrayBox>& eSync();
00257
00259 const LevelData<FArrayBox>& eSync() const;
00260
00262 void grad_eSync(LevelData<FArrayBox>& a_grad_eSync, int a_dir) const;
00263
00265 void grad_eSync(LevelData<FArrayBox>& a_grad_eSync) const;
00266
00267
00269 LevelData<FArrayBox>& eLambda();
00270
00272 const LevelData<FArrayBox>& eLambda() const;
00273
00275 void grad_eLambda(LevelData<FArrayBox>& a_grad_eLambda, int a_dir) const;
00276
00277
00278
00279 LevelData<FluxBox>& grad_eLambda();
00280
00282 const LevelData<FluxBox>& grad_eLambda() const;
00283
00285 bool doSyncProjection() const;
00286
00288 bool doMacSync() const;
00289
00291 bool isInitialized() const;
00292
00294 bool doQuadInterp() const;
00295
00297 QuadCFInterp& quadCFInterpolator();
00298
00300 bool isFinestLevel() const;
00301
00303 void isFinestLevel(bool a_finest_level);
00304
00306 void verbosity(int a_verbosity);
00307
00309 int verbosity() const;
00310
00312 void setPhysBC(const PhysBCUtil& a_bc);
00313
00315 PhysBCUtil* getPhysBCPtr() const;
00316
00317 protected:
00319 void applyMacCorrection(LevelData<FluxBox>& a_uEdge, Real CFscale);
00320
00322 void correctCCVelocities(LevelData<FArrayBox>& a_velocity,
00323 const Real scale) const;
00324
00325
00326
00327
00328 void doSyncProjection(Vector<LevelData<FArrayBox>* >& a_velocity,
00329 const Real a_newTime, const Real a_dtSync,
00330 AMRSolver& solver);
00331
00333 void initialSyncProjection(Vector<LevelData<FArrayBox>* >& a_velocity,
00334 const Real a_newTime, const Real a_dtSync,
00335 AMRSolver& a_solver);
00336
00337
00338
00339
00340 void computeVDCorrection(Vector<LevelData<FArrayBox>* >& a_lambda,
00341 const Real a_newTime, const Real
00342 a_dtSync, AMRSolver& solver);
00343
00344
00345
00346
00347 void applySyncCorrection(Vector<LevelData<FArrayBox>* >& a_velocity,
00348 const Real scale,
00349 LevelData<FArrayBox>* crseCorr);
00350
00351
00353 void computeGrad_eLambda();
00354
00356
00360 void rescaleGrad_eLambda(Real a_dx_lbase);
00361
00362
00363
00364
00365
00366
00367 void defineSolver(AMRSolver& a_solver,
00368 const Vector<LevelData<FArrayBox>* >& a_vel,
00369 bool a_freestreamSolver);
00370
00372 void postRestart();
00373
00374 private:
00375
00377 int m_level;
00378
00380 Real m_dx;
00381
00383 ProblemDomain m_domain;
00384
00385
00387 QuadCFInterp m_cfInterp;
00388
00390 CCProjector* m_fineProjPtr;
00392 CCProjector* m_crseProjPtr;
00393
00395 int m_nRefCrse;
00396
00398 LevelData<FArrayBox> m_Pi;
00399
00401 LevelData<FArrayBox> m_phi;
00402
00404 LevelData<FArrayBox> m_eSync;
00406 LevelData<FArrayBox> m_eLambda;
00407
00409 LevelData<FluxBox> m_grad_eLambda;
00410
00412 LevelSolver m_levelSolver;
00413
00415 static bool m_doSyncProjection;
00416
00418 static bool m_applySyncCorrection;
00419
00421 bool m_isInitialized;
00422
00424 static bool m_doQuadInterp;
00425
00427 static Real m_etaLambda;
00428
00430 static bool pp_init;
00431
00433 static int s_verbosity;
00434
00436 static bool s_applyVDCorrection;
00437
00439 bool m_finest_level;
00440
00442 PhysBCUtil* m_physBCPtr;
00443
00444 };
00445
00446 #endif
00447
00448