Chombo + EB  3.0
NewPoissonOp4.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 // Qinghai Zhang, May 2009
12 
13 #ifndef _NEWPOISSONOP4_H_
14 #define _NEWPOISSONOP4_H_
15 
16 #include "AMRMultiGrid.H"
17 #include "REAL.H"
18 #include "Box.H"
19 #include "LevelDataOps.H"
20 #include "BCFunc.H"
21 #include "FArrayBox.H"
22 #include "NamespaceHeader.H"
23 
24 class NewPoissonOp4 : public MGLevelOp<FArrayBox>
25 {
26 public:
28  {
29  }
30 
31  virtual ~NewPoissonOp4()
32  {
33  }
34 
35  static const int m_nGhost = 2;
36 
37  /**
38  \name LinearOp functions */
39  /*@{*/
40 
41  void define(const RealVect& a_dx,
42  const ProblemDomain& a_domain,
43  BCFunc a_bc);
44 
45  virtual void createCoarsened( FArrayBox& a_lhs,
46  const FArrayBox& a_rhs,
47  const int& a_refRat);
48 
49  virtual void residual( FArrayBox& a_lhs,
50  const FArrayBox& a_phi,
51  const FArrayBox& a_rhs,
52  bool a_homogeneous = false);
53  virtual void preCond( FArrayBox& a_correction,
54  const FArrayBox& a_residual);
55  virtual void applyOp( FArrayBox& a_lhs,
56  const FArrayBox& a_phi,
57  bool a_homogeneous = false);
58  virtual void create( FArrayBox& a_lhs,
59  const FArrayBox& a_rhs);
60  virtual void assign( FArrayBox& a_lhs,
61  const FArrayBox& a_rhs) ;
62  virtual Real dotProduct(const FArrayBox& a_1,
63  const FArrayBox& a_2) ;
64  virtual void incr( FArrayBox& a_lhs,
65  const FArrayBox& a_x,
66  Real a_scale) ;
67  virtual void axby( FArrayBox& a_lhs, const FArrayBox& a_x,
68  const FArrayBox& a_y,
69  Real a, Real b) ;
70  virtual void scale(FArrayBox& a_lhs, const Real& a_scale) ;
71 
72  virtual Real norm(const FArrayBox& a_x, int a_ord);
73 
74  virtual void setToZero(FArrayBox& a_x);
75 
76  /*@}*/
77 
78  /**
79  \name MGLevelOp functions */
80  /*@{*/
81 
82  virtual void relax(FArrayBox& a_e,
83  const FArrayBox& a_residual,
84  int iterations);
85 
86  virtual void createCoarser(FArrayBox& a_coarse,
87  const FArrayBox& a_fine,
88  bool ghost);
89  /**
90  calculate restricted residual
91  a_resCoarse[2h] = I[h->2h] (rhsFine[h] - L[h](phiFine[h])
92  */
93  virtual void restrictResidual(FArrayBox& a_resCoarse,
94  FArrayBox& a_phiFine,
95  const FArrayBox& a_rhsFine);
96 
97  /**
98  correct the fine solution based on coarse correction
99  a_phiThisLevel += I[2h->h](a_correctCoarse)
100  */
101  virtual void prolongIncrement(FArrayBox& a_phiThisLevel,
102  const FArrayBox& a_correctCoarse);
103 
104  /*@}*/
105 
106 
107 protected:
108 
113 
114  void levelGSRB(FArrayBox& a_e, const FArrayBox& a_residual);
115 
116 };
117 
118 class NewPoissonOp4Factory : public MGLevelOpFactory<FArrayBox>
119 {
120 public:
121 
123 
124  NewPoissonOp4Factory(RealVect& a_dx, BCFunc a_bc);
125 
126  void define(const RealVect& m_dx, BCFunc m_bc);
127 
129  {
130  }
131 
132  virtual NewPoissonOp4* MGnewOp(const ProblemDomain& a_FineindexSpace,
133  int a_depth,
134  bool a_homoOnly = true);
135 
136  virtual void MGreclaim(NewPoissonOp4* a_reclaim);
137 
140 
141 };
142 
143 #include "NamespaceFooter.H"
144 #endif
NewPoissonOp4()
Definition: NewPoissonOp4.H:27
virtual void preCond(FArrayBox &a_correction, const FArrayBox &a_residual)
BCFunc m_bc
Definition: NewPoissonOp4.H:112
virtual void restrictResidual(FArrayBox &a_resCoarse, FArrayBox &a_phiFine, const FArrayBox &a_rhsFine)
virtual ~NewPoissonOp4Factory()
Definition: NewPoissonOp4.H:128
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
BCFunc m_bc
Definition: NewPoissonOp4.H:139
virtual void relax(FArrayBox &a_e, const FArrayBox &a_residual, int iterations)
ProblemDomain m_domain
Definition: NewPoissonOp4.H:111
virtual void createCoarser(FArrayBox &a_coarse, const FArrayBox &a_fine, bool ghost)
virtual void prolongIncrement(FArrayBox &a_phiThisLevel, const FArrayBox &a_correctCoarse)
void(* BCFunc)(FArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: BCFunc.H:30
Definition: NewPoissonOp4.H:118
virtual void assign(FArrayBox &a_lhs, const FArrayBox &a_rhs)
Definition: NewPoissonOp4.H:24
Definition: MultiGrid.H:259
virtual ~NewPoissonOp4()
Definition: NewPoissonOp4.H:31
double Real
Definition: REAL.H:33
virtual Real norm(const FArrayBox &a_x, int a_ord)
Definition: MultiGrid.H:30
RealVect m_dx
Definition: NewPoissonOp4.H:109
RealVect m_dx
Definition: NewPoissonOp4.H:138
virtual void residual(FArrayBox &a_lhs, const FArrayBox &a_phi, const FArrayBox &a_rhs, bool a_homogeneous=false)
static const int m_nGhost
Definition: NewPoissonOp4.H:35
virtual void setToZero(FArrayBox &a_x)
void define(const RealVect &a_dx, const ProblemDomain &a_domain, BCFunc a_bc)
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
virtual void createCoarsened(FArrayBox &a_lhs, const FArrayBox &a_rhs, const int &a_refRat)
virtual Real dotProduct(const FArrayBox &a_1, const FArrayBox &a_2)
Definition: FArrayBox.H:44
virtual void scale(FArrayBox &a_lhs, const Real &a_scale)
virtual void create(FArrayBox &a_lhs, const FArrayBox &a_rhs)
virtual void applyOp(FArrayBox &a_lhs, const FArrayBox &a_phi, bool a_homogeneous=false)
RealVect m_dxCrse
Definition: NewPoissonOp4.H:110
void levelGSRB(FArrayBox &a_e, const FArrayBox &a_residual)
virtual void axby(FArrayBox &a_lhs, const FArrayBox &a_x, const FArrayBox &a_y, Real a, Real b)
virtual void incr(FArrayBox &a_lhs, const FArrayBox &a_x, Real a_scale)