Chombo + EB + MF  3.2
MFBackwardEuler.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 _MFBACKWARDEULER_H_
12 #define _MFBACKWARDEULER_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 "MFCellFAB.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<MFCellFAB> >& 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<MFCellFAB>*>& a_phiNew,
56  Vector<LevelData<MFCellFAB>*>& a_phiOld,
57  Vector<LevelData<MFCellFAB>*>& a_source,
58  const Real& a_dt,
59  int a_lbase,
60  int a_lmax,
61  Real a_told = 0,
62  bool a_zeroPhi = true);
63 
64  ///
65  void residual(Vector<LevelData<MFCellFAB>* >& a_error,
66  Vector<LevelData<MFCellFAB>* >& a_phiNew,
67  Vector<LevelData<MFCellFAB>* >& a_phiOld,
68  Vector<LevelData<MFCellFAB>* >& a_source,
69  const Real& a_dt,
70  int a_lbase,
71  int a_lmax,
72  Real a_told);
73 
74  ///
75  void resetAlphaAndBeta(const Real& a_alpha,
76  const Real& a_beta);
77 
78  ///
79  void setTime(Real a_time);
80 
81 protected:
82  void solveHelm(Vector<LevelData<MFCellFAB>* >& a_ans,
83  Vector<LevelData<MFCellFAB>* >& a_rhs,
84  int a_lbase,
85  int a_lmax,
86  Real a_dt,
87  bool a_zeroPhi);
88 
91  int a_lbase,
92  int a_lmax,
93  Real a_mu,
94  Real a_dt,
95  bool a_homogeneousBC);
96 
97  //fills a_ans = dt*kappa*a_source + dt*phiOld
99  Vector<LevelData<MFCellFAB>* >& a_source,
100  Vector<LevelData<MFCellFAB>* >& a_phiOld,
101  int a_lbase,
102  int a_lmax,
103  Real a_dt);
104  void createData(Vector<LevelData<MFCellFAB>* >& a_source,
105  int a_lbase,
106  int a_lmax);
107 
109  newOp(const ProblemDomain& a_indexSpace,
110  const AMRLevelOpFactory<LevelData<MFCellFAB> >& a_opFact);
111 
112 private:
120 
121  //copy constructor and operator= disallowed for all the usual reasons
123  {
124  MayDay::Error("invalid operator");
125  }
126 
127  void operator=(const MFBackwardEuler& a_opin)
128  {
129  MayDay::Error("invalid operator");
130  }
131 
132  /// weak construction is bad. Ref Counted pointers are your friends.
134  {
135  MayDay::Error("invalid operator");
136  }
137 
138 
139 };
140 
141 #include "NamespaceFooter.H"
142 #endif
void applyHelm(Vector< LevelData< MFCellFAB > * > &a_ans, Vector< LevelData< MFCellFAB > * > &a_phi, int a_lbase, int a_lmax, Real a_mu, Real a_dt, bool a_homogeneousBC)
void solveHelm(Vector< LevelData< MFCellFAB > * > &a_ans, Vector< LevelData< MFCellFAB > * > &a_rhs, int a_lbase, int a_lmax, Real a_dt, bool a_zeroPhi)
void createEulerRHS(Vector< LevelData< MFCellFAB > * > &a_ans, Vector< LevelData< MFCellFAB > * > &a_source, Vector< LevelData< MFCellFAB > * > &a_phiOld, int a_lbase, int a_lmax, Real a_dt)
A reference-counting handle class.
Definition: RefCountedPtr.H:173
Definition: MFBackwardEuler.H:33
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
ProblemDomain m_level0Domain
Definition: MFBackwardEuler.H:115
Vector< int > m_refRat
Definition: MFBackwardEuler.H:116
Definition: AMRMultiGrid.H:308
Definition: AMRTGA.H:31
TGAHelmOp< LevelData< MFCellFAB > > * newOp(const ProblemDomain &a_indexSpace, const AMRLevelOpFactory< LevelData< MFCellFAB > > &a_opFact)
Vector< LevelData< MFCellFAB > * > m_rhst
Definition: MFBackwardEuler.H:114
MFBackwardEuler()
weak construction is bad. Ref Counted pointers are your friends.
Definition: MFBackwardEuler.H:133
MFBackwardEuler(const MFBackwardEuler &a_opin)
Definition: MFBackwardEuler.H:122
double Real
Definition: REAL.H:33
int m_numLevels
Definition: MFBackwardEuler.H:118
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 resetAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
int m_verbosity
Definition: MFBackwardEuler.H:118
bool m_dataCreated
Definition: MFBackwardEuler.H:119
void residual(Vector< LevelData< MFCellFAB > * > &a_error, Vector< LevelData< MFCellFAB > * > &a_phiNew, Vector< LevelData< MFCellFAB > * > &a_phiOld, Vector< LevelData< MFCellFAB > * > &a_source, const Real &a_dt, int a_lbase, int a_lmax, Real a_told)
void operator=(const MFBackwardEuler &a_opin)
Definition: MFBackwardEuler.H:127
void oneStep(Vector< LevelData< MFCellFAB > * > &a_phiNew, Vector< LevelData< MFCellFAB > * > &a_phiOld, Vector< LevelData< MFCellFAB > * > &a_source, const Real &a_dt, int a_lbase, int a_lmax, Real a_told=0, bool a_zeroPhi=true)
Vector< RefCountedPtr< TGAHelmOp< LevelData< MFCellFAB > > > > m_ops
Definition: MFBackwardEuler.H:113
void setTime(Real a_time)
Definition: AMRMultiGrid.H:233
RefCountedPtr< AMRMultiGrid< LevelData< MFCellFAB > > > m_solver
Definition: MFBackwardEuler.H:117
void createData(Vector< LevelData< MFCellFAB > * > &a_source, int a_lbase, int a_lmax)