Chombo + EB  3.2
NewPoissonOp.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 // BVS, June 18, 2003
12 
13 // We can assume that template class T has null construction.
14 
15 #ifndef _NEWPOISSONOP_H_
16 #define _NEWPOISSONOP_H_
17 
18 #include "AMRMultiGrid.H"
19 #include "REAL.H"
20 #include "Box.H"
21 #include "LevelDataOps.H"
22 #include "BCFunc.H"
23 #include "FArrayBox.H"
24 #include "NamespaceHeader.H"
25 
26 class NewPoissonOp : public MGLevelOp<FArrayBox>
27 {
28 public:
30  {
31  }
32 
33  virtual ~NewPoissonOp()
34  {
35  }
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:
112 
113  void levelGSRB(FArrayBox& a_e, const FArrayBox& a_residual);
114 
115  void colorGS(FArrayBox& a_phi,
116  const FArrayBox& a_rhs,
117  const IntVect& color);
118 
119  bool nextColor(IntVect& color,
120  const IntVect& limit);
121 
122  void levelRelaxColor(FArrayBox& a_phi,
123  const FArrayBox& a_rhs,
124  const IntVect& a_color,
125  const Real& a_weight,
126  const bool& a_homogeneousPhysBC);
127 
128 };
129 
130 class NewPoissonOpFactory : public MGLevelOpFactory<FArrayBox>
131 {
132 public:
133 
135 
136  NewPoissonOpFactory(RealVect& a_dx, BCFunc a_bc);
137 
138  void define(const RealVect& m_dx,BCFunc m_bc);
139 
141  {
142 
143  }
144  virtual NewPoissonOp* MGnewOp(const ProblemDomain& a_FineindexSpace,
145  int a_depth,
146  bool a_homoOnly = true);
147 
148  virtual void MGreclaim(NewPoissonOp* a_reclaim);
149 
152 };
153 
154 #include "NamespaceFooter.H"
155 #endif
virtual NewPoissonOp * MGnewOp(const ProblemDomain &a_FineindexSpace, int a_depth, bool a_homoOnly=true)
Definition: NewPoissonOp.H:130
virtual void preCond(FArrayBox &a_correction, const FArrayBox &a_residual)
Definition: NewPoissonOp.H:26
virtual void axby(FArrayBox &a_lhs, const FArrayBox &a_x, const FArrayBox &a_y, Real a, Real b)
virtual void residual(FArrayBox &a_lhs, const FArrayBox &a_phi, const FArrayBox &a_rhs, bool a_homogeneous=false)
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
virtual void setToZero(FArrayBox &a_x)
void colorGS(FArrayBox &a_phi, const FArrayBox &a_rhs, const IntVect &color)
virtual void relax(FArrayBox &a_e, const FArrayBox &a_residual, int iterations)
virtual void create(FArrayBox &a_lhs, const FArrayBox &a_rhs)
RealVect m_dx
Definition: NewPoissonOp.H:108
virtual Real norm(const FArrayBox &a_x, int a_ord)
virtual void createCoarser(FArrayBox &a_coarse, const FArrayBox &a_fine, bool ghost)
virtual void incr(FArrayBox &a_lhs, const FArrayBox &a_x, Real a_scale)
virtual Real dotProduct(const FArrayBox &a_1, const FArrayBox &a_2)
virtual ~NewPoissonOpFactory()
Definition: NewPoissonOp.H:140
RealVect m_dx
Definition: NewPoissonOp.H:150
virtual void createCoarsened(FArrayBox &a_lhs, const FArrayBox &a_rhs, const int &a_refRat)
ProblemDomain m_domain
Definition: NewPoissonOp.H:110
BCFunc m_bc
Definition: NewPoissonOp.H:151
NewPoissonOp()
Definition: NewPoissonOp.H:29
Definition: MultiGrid.H:294
virtual void MGreclaim(NewPoissonOp *a_reclaim)
double Real
Definition: REAL.H:33
Definition: MultiGrid.H:30
void levelGSRB(FArrayBox &a_e, const FArrayBox &a_residual)
bool nextColor(IntVect &color, const IntVect &limit)
void define(const RealVect &m_dx, BCFunc m_bc)
void(* BCFunc)(FArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: BCFunc.H:30
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 assign(FArrayBox &a_lhs, const FArrayBox &a_rhs)
virtual void applyOp(FArrayBox &a_lhs, const FArrayBox &a_phi, bool a_homogeneous=false)
virtual void scale(FArrayBox &a_lhs, const Real &a_scale)
virtual void restrictResidual(FArrayBox &a_resCoarse, FArrayBox &a_phiFine, const FArrayBox &a_rhsFine)
RealVect m_dxCrse
Definition: NewPoissonOp.H:109
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
BCFunc m_bc
Definition: NewPoissonOp.H:111
void levelRelaxColor(FArrayBox &a_phi, const FArrayBox &a_rhs, const IntVect &a_color, const Real &a_weight, const bool &a_homogeneousPhysBC)
virtual ~NewPoissonOp()
Definition: NewPoissonOp.H:33
virtual void prolongIncrement(FArrayBox &a_phiThisLevel, const FArrayBox &a_correctCoarse)