Chombo + EB + MF  3.2
EBBackwardEuler.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _EBBACKWARDEULER_H_
12 #define _EBBACKWARDEULER_H_
13 
14 #include <cmath>
15 #include <cstdlib>
16 #include <cstdio>
17 #include <iostream>
18 #include <iomanip>
19 #include <fstream>
20 #include <string>
21 #include "AMRMultiGrid.H"
22 #include "LevelData.H"
23 #include "EBCellFAB.H"
24 #include "AMRTGA.H"
25 #include "NamespaceHeader.H"
26 
27 ///
28 /**
29  Solves dphi/dt = L phi + rho
30  using backward euler.
31  Uses TGAHelmOp functionaltity.
32  **/
34 {
35 public:
36 
37 
38  ///
40 
41  ///
42  /**
43  **/
45  const AMRLevelOpFactory<LevelData<EBCellFAB> >& a_factory,
46  const ProblemDomain& a_level0Domain,
47  const Vector<int>& a_refRat,
48  int a_numLevels = -1, int a_verbosity = 3);
49 
50 
51  ///
52  /**
53  This advances a parabolic pde from a_phiOld to a_phiNew using TGA on a non-moving domain with source term a_source
54  **/
55  void oneStep(Vector<LevelData<EBCellFAB>*>& a_phiNew,
56  Vector<LevelData<EBCellFAB>*>& a_phiOld,
57  Vector<LevelData<EBCellFAB>*>& a_source,
58  const Real& a_dt,
59  int a_lbase,
60  int a_lmax,
61  bool a_zeroPhi = true,
62  const bool a_kappaWeighted = false);
63 
64  ///
65  void resetAlphaAndBeta(const Real& a_alpha,
66  const Real& a_beta);
67 
68  void
69  computeDiffusion(Vector< LevelData<EBCellFAB>* >& a_diffusiveTerm,
70  Vector< LevelData<EBCellFAB>* >& a_phiOld,
71  Vector< LevelData<EBCellFAB>* >& a_src,
72  Real a_oldTime, Real a_dt,
73  int a_lbase, int a_lmax, bool a_zeroPhi);
74 
75 
76 protected:
77  void solveHelm(Vector<LevelData<EBCellFAB>* >& a_ans,
78  Vector<LevelData<EBCellFAB>* >& a_rhs,
79  int a_lbase,
80  int a_lmax,
81  Real a_dt,
82  bool a_zeroPhi);
83 
84  //fills a_ans = dt*kappa*a_source + dt*phiOld
86  Vector<LevelData<EBCellFAB>* >& a_source,
87  Vector<LevelData<EBCellFAB>* >& a_phiOld,
88  int a_lbase,
89  int a_lmax,
90  Real a_dt,
91  const bool a_kappaWeighted = false);
92  void createData(Vector<LevelData<EBCellFAB>* >& a_source,
93  int a_lbase,
94  int a_lmax);
95 
97  newOp(const ProblemDomain& a_indexSpace,
98  const AMRLevelOpFactory<LevelData<EBCellFAB> >& a_opFact);
99 
100 private:
101  //You do not own these operators!! don't delete it. the memory is
102  //owned by the solver
110 
111  //copy constructor and operator= disallowed for all the usual reasons
113  {
114  MayDay::Error("invalid operator");
115  }
116 
117  void operator=(const EBBackwardEuler& a_opin)
118  {
119  MayDay::Error("invalid operator");
120  }
121 
122  /// weak construction is bad. Ref Counted pointers are your friends.
124  {
125  MayDay::Error("invalid operator");
126  }
127 
128 
129 };
130 
131 #include "NamespaceFooter.H"
132 #endif
Vector< LevelData< EBCellFAB > *> m_rhst
Definition: EBBackwardEuler.H:104
void solveHelm(Vector< LevelData< EBCellFAB > * > &a_ans, Vector< LevelData< EBCellFAB > * > &a_rhs, int a_lbase, int a_lmax, Real a_dt, bool a_zeroPhi)
A reference-counting handle class.
Definition: RefCountedPtr.H:173
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
void computeDiffusion(Vector< LevelData< EBCellFAB > * > &a_diffusiveTerm, Vector< LevelData< EBCellFAB > * > &a_phiOld, Vector< LevelData< EBCellFAB > * > &a_src, Real a_oldTime, Real a_dt, int a_lbase, int a_lmax, bool a_zeroPhi)
void resetAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
EBBackwardEuler()
weak construction is bad. Ref Counted pointers are your friends.
Definition: EBBackwardEuler.H:123
int m_verbosity
Definition: EBBackwardEuler.H:108
Definition: EBBackwardEuler.H:33
EBBackwardEuler(const EBBackwardEuler &a_opin)
Definition: EBBackwardEuler.H:112
Definition: AMRMultiGrid.H:308
Definition: AMRTGA.H:31
void createData(Vector< LevelData< EBCellFAB > * > &a_source, int a_lbase, int a_lmax)
TGAHelmOp< LevelData< EBCellFAB > > * newOp(const ProblemDomain &a_indexSpace, const AMRLevelOpFactory< LevelData< EBCellFAB > > &a_opFact)
RefCountedPtr< AMRMultiGrid< LevelData< EBCellFAB > > > m_solver
Definition: EBBackwardEuler.H:107
void oneStep(Vector< LevelData< EBCellFAB > *> &a_phiNew, Vector< LevelData< EBCellFAB > *> &a_phiOld, Vector< LevelData< EBCellFAB > *> &a_source, const Real &a_dt, int a_lbase, int a_lmax, bool a_zeroPhi=true, const bool a_kappaWeighted=false)
double Real
Definition: REAL.H:33
bool m_dataCreated
Definition: EBBackwardEuler.H:109
void createEulerRHS(Vector< LevelData< EBCellFAB > * > &a_ans, Vector< LevelData< EBCellFAB > * > &a_source, Vector< LevelData< EBCellFAB > * > &a_phiOld, int a_lbase, int a_lmax, Real a_dt, const bool a_kappaWeighted=false)
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
void operator=(const EBBackwardEuler &a_opin)
Definition: EBBackwardEuler.H:117
Vector< int > m_refRat
Definition: EBBackwardEuler.H:106
ProblemDomain m_level0Domain
Definition: EBBackwardEuler.H:105
Definition: AMRMultiGrid.H:233
int m_numLevels
Definition: EBBackwardEuler.H:108
Vector< TGAHelmOp< LevelData< EBCellFAB > > *> m_ops
Definition: EBBackwardEuler.H:103