Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AMRNavierStokes.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 
00007 // AMRNavierStokes.H
00008 
00009 //
00010 // This software is copyright (C) by the Lawrence Berkeley
00011 // National Laboratory.  Permission is granted to reproduce
00012 // this software for non-commercial purposes provided that
00013 // this notice is left intact.
00014 // 
00015 // It is acknowledged that the U.S. Government has rights to
00016 // this software under Contract DE-AC03-765F00098 between
00017 // the U.S.  Department of Energy and the University of
00018 // California.
00019 //
00020 // This software is provided as a professional and academic
00021 // contribution for joint exchange. Thus it is experimental,
00022 // is provided ``as is'', with no warranties of any kind
00023 // whatsoever, no support, no promise of updates, or printed
00024 // documentation. By using this software, you acknowledge
00025 // that the Lawrence Berkeley National Laboratory and
00026 // Regents of the University of California shall have no
00027 // liability with respect to the infringement of other
00028 // copyrights by any part of this software.
00029 //
00030 // Dan Martin, Fri, Jan 14, 2000
00031 
00032 #ifndef _AMRNavierStokes_H_
00033 #define _AMRNavierStokes_H_
00034 
00035 #include "AMRLevel.H"
00036 #include "LevelFluxRegister.H"
00037 #include "CoarseAverage.H"
00038 #include "PiecewiseLinearFillPatch.H"
00039 #include "CCProjector.H"
00040 #include "LevelHelmholtzSolver.H"
00041 #include "PoissonOp.H"
00042 #include "VelocityPoissonOp.H"
00043 #include "PhysBCUtil.H"
00045 enum viscousSolverTypes {
00047   backwardEuler = 0,
00049   CrankNicolson,
00051   TGA, 
00053   NUM_SOLVER_TYPES};
00054 
00055 
00056 
00058 enum scalTypes {
00060   xMarker = 0,
00062   yMarker,
00063 #if CH_SPACEDIM >= 3
00064 
00065   zMarker,
00066 #endif
00067 
00068   NUM_SCAL_TYPES};
00069 
00070 
00071 
00072 
00074 class AMRNavierStokes: public AMRLevel
00075 {
00076 public:
00077   
00079   AMRNavierStokes();
00080   
00082   AMRNavierStokes(AMRLevel* a_coarser_level_ptr, 
00083            const Box& a_prob_domain,
00084            int a_level, int a_ref_ratio);
00085 
00087   AMRNavierStokes(AMRLevel* a_coarser_level_ptr, 
00088            const ProblemDomain& a_prob_domain,
00089            int a_level, int a_ref_ratio);
00090 
00092   virtual ~AMRNavierStokes();
00093 
00094 
00096   virtual AMRLevel* makeAMRLevel(AMRLevel* a_coarser_level_ptr,
00097                                  const Box& a_problem_domain,
00098                                  int a_level, int a_ref_ratio) const;
00099 
00101   virtual AMRLevel* makeAMRLevel(AMRLevel* a_coarser_level_ptr,
00102                                  const ProblemDomain& a_problem_domain,
00103                                  int a_level, int a_ref_ratio) const;
00104 
00106   virtual void define(AMRLevel* a_coarse_level_ptr, 
00107                       const Box& a_problem_domain,
00108                       int a_level, int a_ref_ratio);
00109 
00111   virtual void define(AMRLevel* a_coarse_level_ptr, 
00112                       const ProblemDomain& a_problem_domain,
00113                       int a_level, int a_ref_ratio);
00114 
00116   virtual Real advance();
00117 
00119   virtual void postTimeStep();
00120 
00122   virtual void tagCells(IntVectSet& a_tags);
00123 
00125   virtual void tagCellsInit(IntVectSet& a_tags);
00126 
00128   virtual void regrid(const Vector<Box>& a_new_grids);
00129 
00130 
00131 
00133   virtual void postRegrid(int a_lBase);
00134 
00135 
00137   virtual void initialGrid(const Vector<Box>& a_new_grids);
00138 
00140   virtual void initialData();
00141 
00143   virtual void postInitialize();
00144 
00145 #ifdef HDF5
00146 
00147   virtual void writeCheckpointHeader(HDF5Handle& a_handle) const;
00148 
00150   virtual void writeCheckpointLevel(HDF5Handle& a_handle) const;
00151 
00153   virtual void readCheckpointHeader(HDF5Handle& a_handle);
00154 
00156   virtual void readCheckpointLevel(HDF5Handle& a_handle);
00157 
00159   virtual void writePlotHeader(HDF5Handle& a_handle) const;
00160 
00162   virtual void writePlotLevel(HDF5Handle& a_handle) const;
00163 #endif
00164 
00166   virtual Real computeDt();
00167 
00169   virtual Real computeInitialDt();
00170 
00172   virtual void CFL(Real a_cfl);
00173 
00175   virtual void refinementThreshold(Real a_refine_threshold);
00176 
00178   bool finestLevel() const;
00179   
00181   bool isEmpty() const;
00182   
00183   // compute vorticity
00184   void computeVorticity(LevelData<FArrayBox>& a_vorticity) const;
00185 
00187 
00189   Real Dx() const;
00190   
00192   Real Nu() const;
00193 
00195   AMRNavierStokes* finerNSPtr() const;
00196 
00198   AMRNavierStokes* crseNSPtr() const;
00199 
00201   LevelData<FArrayBox>& newVel();
00202 
00204   const LevelData<FArrayBox>& newVel() const;
00205 
00207   LevelData<FArrayBox>& oldVel();
00208 
00210   const LevelData<FArrayBox>& oldVel() const;
00211 
00213   void velocity(LevelData<FArrayBox>& a_vel, Real a_time) const;
00214 
00216   LevelData<FArrayBox>& newLambda();
00217 
00219   const LevelData<FArrayBox>& newLambda() const;
00220 
00222   LevelData<FArrayBox>& oldLambda();
00223 
00225   const LevelData<FArrayBox>& oldLambda() const;
00226 
00228   void lambda(LevelData<FArrayBox>& a_lambda, Real a_time) const;
00229   
00231   LevelData<FArrayBox>& newScal(const int a_comp);
00232 
00234   const LevelData<FArrayBox>& newScal(const int a_comp) const;
00235 
00237   LevelData<FArrayBox>& oldScal(const int a_comp);
00238 
00240   const LevelData<FArrayBox>& oldScal(const int a_comp) const;
00241 
00243   void scalars(LevelData<FArrayBox>& a_scalars, const Real a_time, 
00244                const int a_comp) const;
00245 
00246   
00248   void setPhysBC(const PhysBCUtil& a_BC);
00249 
00251   PhysBCUtil* getPhysBCPtr() const;
00252 
00253 
00254 protected:
00256   DisjointBoxLayout loadBalance(const Vector<Box>& a_grids);
00257 
00259   void levelSetup (const DisjointBoxLayout& level_domain);
00260 
00262   void readParameters();
00263 
00265   void finestLevel(bool a_finest_level);
00266 
00268   void swapOldAndNewStates();
00269 
00271   void resetStates(const Real a_time);
00272 
00274   void computeAdvectionVelocities(LevelData<FluxBox>& a_adv_vel);
00275 
00276 
00277   /*@ManMemo: do predictor -- returns approx. to (U dot del)U.
00278     Also updates flux registers with momentum fluxes and
00279     part of viscous fluxes which contains the old-time velocity.
00280   */
00281   void predictVelocities(LevelData<FArrayBox>& a_uDelU,
00282                          LevelData<FluxBox>& a_advVel);
00283 
00284   /*@ManMemo: This function computes uStar -- the approximation
00285     of the new-time velocity which will be projected.  The
00286     advection term (u-dot-del-U) is passed in in a_uStar, which 
00287     is modified in place to contain uStar. Note that both viscous
00288     and inviscid cases, this returns the approximation to 
00289     u^{n+1} + dt*gradPi */
00290   void computeUStar(LevelData<FArrayBox>& a_uStar);
00291   void computeUStarInit(LevelData<FArrayBox>& a_uStar);  //noel
00292 
00293 
00294 
00296   void advectScalar(LevelData<FArrayBox>& a_new_scal,
00297                     LevelData<FArrayBox>& a_old_scal,
00298                     LevelData<FluxBox>& a_adv_vel,
00299                     LevelFluxRegister* a_crseFluxRegPtr,
00300                     LevelFluxRegister& a_fineFluxReg,
00301                     Real a_dt);
00302 
00304   void advectDiffuseScalar(LevelData<FArrayBox>& a_new_scal,
00305                            LevelData<FArrayBox>& a_old_scal,
00306                            LevelData<FluxBox>& a_adv_vel,
00307                            const Real& a_diffusive_coeff,
00308                            const LevelData<FArrayBox>* a_crse_scal_old,
00309                            const LevelData<FArrayBox>* a_crse_scal_new,
00310                            const Real a_old_crse_time,
00311                            const Real a_new_crse_time,
00312                            LevelFluxRegister* a_crseFluxRegPtr,
00313                            LevelFluxRegister& a_fineFluxReg,
00314                            DomainGhostBC& a_scalPhysBC,
00315                            Real a_dt);
00316 
00318   void initializeGlobalPressure();
00319 
00321   void initializeLevelPressure(Real a_currentTime, Real a_dtInit);
00322 
00324   void smoothVelocityField(int lbase);
00325 
00327   void computeLapVel(LevelData<FArrayBox>& a_lapVel,
00328                      LevelData<FArrayBox>& a_vel,
00329                      const LevelData<FArrayBox>* a_crseVelPtr);
00330 
00332   void computeLapScal(LevelData<FArrayBox>& a_lapScal,
00333                       LevelData<FArrayBox>& a_scal,
00334                       DomainGhostBC& a_physBC,
00335                       const LevelData<FArrayBox>* a_crseScalPtr);
00336 
00338   void fillVelocity(LevelData<FArrayBox>& a_vel, Real a_time);
00339 
00341   void fillVelocity(LevelData<FArrayBox>& a_vel, Real a_time,  
00342                     int vel_comp, int dest_comp, int num_comp);
00343 
00346   void fillLambda(LevelData<FArrayBox>& a_lambda, Real a_time) const;
00347 
00349   void fillScalars(LevelData<FArrayBox>& a_scal, Real a_time,
00350                    const int a_comp) const;
00351 
00352 
00354   virtual int numPlotComps() const;
00355 
00357   virtual void getPlotData(LevelData<FArrayBox>& a_plot_data) const;
00358 
00360   void  defineRegridAMRSolver(AMRSolver& a_solver, 
00361                               const Vector<DisjointBoxLayout>& a_grids,
00362                               const Vector<ProblemDomain>& a_domains,
00363                               const Vector<Real>& a_amrDx,
00364                               const Vector<int>& a_refRatios,
00365                               const int& a_lBase);
00366   
00367 
00368 
00369 
00370 
00371 protected:
00373   LevelData<FArrayBox>* m_vel_old_ptr;
00374 
00376   LevelData<FArrayBox>* m_vel_new_ptr;
00377 
00378 #ifdef DEBUG
00379 
00380   LevelData<FArrayBox>* m_vel_save_ptr;  
00381 
00382   Real m_saved_time;
00383 
00384 #endif
00385 
00387   LevelData<FArrayBox>* m_lambda_old_ptr;
00388   
00390   LevelData<FArrayBox>* m_lambda_new_ptr;
00391 
00392 #ifdef DEBUG
00393 
00394   LevelData<FArrayBox>* m_lambda_save_ptr;  
00395 
00396 
00397 #endif
00398 
00400   Vector<LevelData<FArrayBox>*> m_scal_old;
00401   
00403   Vector<LevelData<FArrayBox>*> m_scal_new;
00404 
00405 #ifdef DEBUG
00406 
00407   Vector<LevelData<FArrayBox>*> m_scal_save;
00408 #endif
00409 
00411   static const int s_num_vel_comps = SpaceDim;
00412 
00414   static int s_num_scal_comps;
00415 
00417   static const int s_max_scal_comps=SpaceDim;
00418 
00420   static const char* s_vel_names[s_num_vel_comps];
00421 
00423   static const char* s_scal_names[s_max_scal_comps];
00424 
00426   static Vector<Real> s_scal_coeffs;
00427 
00429   static Vector<Real> s_domLength;
00430   
00432   static bool s_ppInit;
00433 
00435   static Real s_init_shrink;
00436 
00438   static Real s_max_dt;
00439 
00440   static Real s_prescribedDt;
00441 
00443   static bool s_project_initial_vel;
00444 
00446   static bool s_initialize_pressures;
00447 
00449   static bool s_smooth_after_regrid;
00450 
00452   static bool s_dump_smoothing_plots;
00453 
00455   static Real s_regrid_smoothing_coeff;
00456 
00458   static int s_num_init_passes;
00459 
00461   static bool s_reflux_momentum;
00462 
00464   static bool s_set_bogus_values;
00465 
00467   static Real s_bogus_value;
00468 
00470   static bool s_tag_vorticity;
00471 
00473   static bool s_tag_theta;
00474 
00476   static Real s_vort_factor;
00477 
00479   static int s_tags_grow;
00480 
00482   static bool s_implicit_reflux;
00483 
00485   static bool s_applyFreestreamCorrection;
00486 
00488   static bool s_reflux_scal;
00489 
00491   static bool s_implicit_scal_reflux;
00492 
00494   static int s_viscous_solver_type;
00495 
00497   static Real s_viscous_solver_tol;
00498 
00500   static Real s_nu;
00501 
00503   static bool s_boussinesq;
00504 
00506   static Real s_theta_coeff;
00507 
00509   static Real s_rayleighNo;
00510 
00512   static Real s_prandtlNo;
00513 
00515   static Real s_wallTemp;
00516 
00518   static bool s_specifyInitialGrids;
00519 
00521   static string s_initialGridFile;
00522 
00524   static bool s_init_vel_from_vorticity;
00525   
00527   static Real s_backgroundVel;
00528   
00529 
00531   Vector<Tuple<Real, SpaceDim> > m_dataPoints;
00532 
00534   Real m_dx;
00535 
00537   Real m_cfl;
00538 
00540   Real m_dt_save;
00541 
00543   int m_level_steps;
00544 
00546   CoarseAverage m_coarse_average;
00547 
00549   CoarseAverage m_coarse_average_lambda;
00550 
00551 #if 0
00552 
00553   CoarseAverage m_coarse_average_scal;
00554 #endif
00555 
00557   CCProjector m_projection;
00558   
00560   LevelFluxRegister m_flux_register;
00561 
00563   LevelFluxRegister m_lambda_flux_reg;
00564 
00566   Vector<LevelFluxRegister*> m_scal_fluxreg_ptrs;
00567 
00569   QuadCFInterp m_velCFInterp; 
00570 
00572   VelocityPoissonOp m_velocityPoissonOp;
00573 
00575   PoissonOp m_scalarsPoissonOp;
00576 
00578   LevelHelmholtzSolver m_viscous_solver;
00579 
00581   Real m_refine_threshold;
00582 
00584   bool m_finest_level;
00585 
00587   bool m_is_empty;
00588 
00590   bool m_regrid_smoothing_done;
00591 
00593   PhysBCUtil* m_physBCPtr;
00594 
00595 
00596 };
00597 
00598 #endif
00599 
00600 

Generated on Thu Aug 29 11:05:44 2002 for Chombo&INS by doxygen1.2.16