Chombo + EB  3.2
ViscousTensorOp.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 _VISCOUSTENSOROP_H_
12 #define _VISCOUSTENSOROP_H_
13 
14 #include "AMRMultiGrid.H"
15 #include "REAL.H"
16 #include "Box.H"
17 #include "LevelDataOps.H"
18 #include "BCFunc.H"
19 #include "FArrayBox.H"
20 #include "FluxBox.H"
21 #include "CFIVS.H"
22 #include "AMRTGA.H"
23 #include "TensorCFInterp.H"
24 #include "CoarseAverage.H"
25 #include "LevelFluxRegister.H"
26 #include "AMRIO.H"
27 #include "NamespaceHeader.H"
28 
29 #define VTOP_DEFAULT_SAFETY 0.9
30 ///
31 /**
32  operator is alpha a I + (divF) = alpha*acoef I + beta*div(eta(grad B + grad BT) + lambda I div B )
33  beta, lambda, and eta are incorporated into the flux F
34 */
35 class ViscousTensorOp : public LevelTGAHelmOp<LevelData<FArrayBox>, FluxBox>
36 {
37 public:
38 
40  {
44  };
45 
46  virtual void diagonalScale(LevelData<FArrayBox>& a_rhs, bool a_kappaWeighted)
47  {
48  diagonalScale(a_rhs);
49  }
50 
51  virtual void setAlphaAndBeta(const Real& a_alpha,
52  const Real& a_beta)
53  {
54  m_alpha = a_alpha;
55  m_beta = a_beta;
56  defineRelCoef();
57  }
58 
59  virtual void diagonalScale(LevelData<FArrayBox>& a_rhs)
60  {
61  DisjointBoxLayout grids = a_rhs.disjointBoxLayout();
62  for (DataIterator dit = grids.dataIterator(); dit.ok(); ++dit)
63  {
64  for (int idir = 0; idir < SpaceDim; idir++)
65  {
66  int isrc = 0; int idst = idir; int inco = 1;
67  a_rhs[dit()].mult((*m_acoef)[dit()], isrc, idst, inco);
68  }
69  }
70  }
71 
73  {
74  DisjointBoxLayout grids = a_rhs.disjointBoxLayout();
75  for (DataIterator dit = grids.dataIterator(); dit.ok(); ++dit)
76  {
77  for (int idir = 0; idir < SpaceDim; idir++)
78  {
79  int isrc = 0; int idst = idir; int inco = 1;
80  a_rhs[dit()].divide((*m_acoef)[dit()], isrc, idst, inco);
81  }
82  }
83  }
84 
85  ///
86  /**
87  */
88  virtual ~ViscousTensorOp()
89  {
90 #if 0
91  // these explicitly de-reference the storage
96 #endif
97  }
98 
99  ///
100  /**
101  */
102  ViscousTensorOp(const DisjointBoxLayout& a_grids,
103  const DisjointBoxLayout& a_gridsFine,
104  const DisjointBoxLayout& a_gridsCoar,
105  const RefCountedPtr<LevelData<FluxBox> >& a_eta,
106  const RefCountedPtr<LevelData<FluxBox> >& a_lambda,
107  const RefCountedPtr<LevelData<FArrayBox> >& a_acoef,
108  Real a_alpha,
109  Real a_beta,
110  int a_refToFine,
111  int a_refToCoar,
112  const ProblemDomain& a_domain,
113  const Real& a_dxLevel,
114  const Real& a_dxCoar,
115  BCFunc a_bc,
116  Real a_safety = VTOP_DEFAULT_SAFETY,
117  Real a_relaxTolerance = 0.0,
118  int a_relaxMinIter = 1000
119  );
120 
121  ///
122  /**
123  */
124  ViscousTensorOp(const DisjointBoxLayout& a_grids,
125  const DisjointBoxLayout& a_gridsFine,
126  const DisjointBoxLayout& a_gridsCoar,
127  const RefCountedPtr<LevelData<FluxBox> >& a_eta,
128  const RefCountedPtr<LevelData<FluxBox> >& a_lambda,
129  const RefCountedPtr<LevelData<FArrayBox> >& a_acoef,
130  Real a_alpha,
131  Real a_beta,
132  int a_refToFine,
133  int a_refToCoar,
134  const ProblemDomain& a_domain,
135  const Real& a_dxLevel,
136  const Real& a_dxCoar,
137  BCHolder& a_bc,
138  Real a_safety = VTOP_DEFAULT_SAFETY,
139  Real a_relaxTolerance = 0.0,
140  int a_relaxMinIter = 1000
141  );
142 
143  ///
144  /**
145  */
146  void define(const DisjointBoxLayout& a_grids,
147  const DisjointBoxLayout& a_gridsFine,
148  const DisjointBoxLayout& a_gridsCoar,
149  const RefCountedPtr<LevelData<FluxBox> >& a_eta,
150  const RefCountedPtr<LevelData<FluxBox> >& a_lambda,
151  const RefCountedPtr<LevelData<FArrayBox> >& a_acoef,
152  Real a_alpha,
153  Real a_beta,
154  int a_refToFine,
155  int a_refToCoar,
156  const ProblemDomain& a_domain,
157  const Real& a_dxLevel,
158  const Real& a_dxCoar,
159  BCHolder& a_bc,
160  Real a_safety = VTOP_DEFAULT_SAFETY,
161  Real a_relaxTolerance = 0.0,
162  int a_relaxMinIter = 1000
163  );
164 
165  virtual void residual( LevelData<FArrayBox>& a_lhs,
166  const LevelData<FArrayBox>& a_phi,
167  const LevelData<FArrayBox>& a_rhs,
168  bool a_homogeneous = false);
169 
170  virtual void preCond( LevelData<FArrayBox>& a_correction,
171  const LevelData<FArrayBox>& a_residual);
172 
173  virtual void applyOp( LevelData<FArrayBox>& a_lhs,
174  const LevelData<FArrayBox>& a_phi,
175  bool a_homogeneous = false);
176  virtual void create( LevelData<FArrayBox>& a_lhs,
177  const LevelData<FArrayBox>& a_rhs);
178  virtual void createCoarsened( LevelData<FArrayBox>& a_lhs,
179  const LevelData<FArrayBox>& a_rhs,
180  const int& a_refRat);
181 
182  void reflux(const LevelData<FArrayBox>& a_phiFine,
183  const LevelData<FArrayBox>& a_phi,
185  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
186 
187  //use at thy peril
188  virtual void getFlux(FluxBox& a_flux,
189  const LevelData<FArrayBox>& a_data,
190  const Box& a_grid,
191  const DataIndex& a_dit,
192  Real a_scale)
193  {
194  const FArrayBox& data = a_data[a_dit];
195  a_flux.define(a_grid, SpaceDim);
196  for (int idir = 0; idir < SpaceDim; idir++)
197  {
198  const FArrayBox& etaFace = (*m_eta)[a_dit][idir];
199  const FArrayBox& lambdaFace = (*m_lambda)[a_dit][idir];
200  const FArrayBox& gradData = m_grad[a_dit];
201  Box faceBox = a_flux[idir].box();
202  Box domFaceBox = surroundingNodes(m_domain.domainBox(), idir);
203  faceBox &= domFaceBox;
204  getFlux(a_flux[idir], data, gradData, etaFace, lambdaFace, faceBox, idir, 1);
205  a_flux[idir] *= a_scale;
206  }
207  }
209  const LevelData<FArrayBox>& a_phi)
210  {
211  this->fillGrad(a_phi);
212  computeOperatorNoBCs(a_lhs, a_phi);
213  }
214 
215  void getFlux(FArrayBox& a_flux,
216  const FArrayBox& a_data,
217  const FArrayBox& a_gradData,
218  const FArrayBox& a_etaFace,
219  const FArrayBox& a_lambdaFace,
220  const Box& a_facebox,
221  int a_dir,
222  int ref = 1);
223 
224  /// utility function which computes operator after all bc's have been set
226  const LevelData<FArrayBox>& a_phi);
227 
228  virtual void assign( LevelData<FArrayBox>& a_lhs,
229  const LevelData<FArrayBox>& a_rhs) ;
230  virtual Real dotProduct(const LevelData<FArrayBox>& a_1,
231  const LevelData<FArrayBox>& a_2) ;
232  virtual void incr( LevelData<FArrayBox>& a_lhs,
233  const LevelData<FArrayBox>& a_x,
234  Real a_scale) ;
235  virtual void axby( LevelData<FArrayBox>& a_lhs,
236  const LevelData<FArrayBox>& a_x,
237  const LevelData<FArrayBox>& a_y,
238  Real a, Real b) ;
239 
240  virtual void scale(LevelData<FArrayBox>& a_lhs, const Real& a_scale) ;
241 
242  virtual Real norm(const LevelData<FArrayBox>& a_x, int a_ord);
243 
244  virtual Real dx() const
245  {
246  return m_dx;
247  }
248 
249  virtual Real dxCrse() const
250  {
251  return m_dxCrse;
252  }
253 
254  virtual void setToZero( LevelData<FArrayBox>& a_x);
255  /*@}*/
256 
257  /**
258  \name MGLevelOp functions */
259  /*@{*/
260 
261  virtual void relax(LevelData<FArrayBox>& a_e,
262  const LevelData<FArrayBox>& a_residual,
263  int iterations);
264 
265  virtual void createCoarser(LevelData<FArrayBox>& a_coarse,
266  const LevelData<FArrayBox>& a_fine,
267  bool ghosted);
268  /**
269  calculate restricted residual
270  a_resCoarse[2h] = I[h->2h] (rhsFine[h] - L[h](phiFine[h])
271  */
272  virtual void restrictResidual(LevelData<FArrayBox>& a_resCoarse,
273  LevelData<FArrayBox>& a_phiFine,
274  const LevelData<FArrayBox>& a_rhsFine);
275 
276  /**
277  correct the fine solution based on coarse correction
278  a_phiThisLevel += I[2h->h](a_correctCoarse)
279  */
280  virtual void prolongIncrement(LevelData<FArrayBox>& a_phiThisLevel,
281  const LevelData<FArrayBox>& a_correctCoarse);
282 
283  /*@}*/
284 
285  /**
286  \name AMRLevelOp functions */
287  /*@{*/
288 
289  /** returns 1 when there are no coarser AMRLevelOp objects */
290  virtual int refToCoarser()
291  {
292  return m_refToCoar;
293  }
294 
295  /** a_residual = a_rhs - L(a_phi, a_phiFine, a_phiCoarse) */
296  virtual void AMRResidual(LevelData<FArrayBox>& a_residual,
297  const LevelData<FArrayBox>& a_phiFine,
298  const LevelData<FArrayBox>& a_phi,
299  const LevelData<FArrayBox>& a_phiCoarse,
300  const LevelData<FArrayBox>& a_rhs,
301  bool a_homogeneousPhysBC,
302  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
303 
304  /** residual assuming no more coarser AMR levels */
305 
306  virtual void AMRResidualNC(LevelData<FArrayBox>& a_residual,
307  const LevelData<FArrayBox>& a_phiFine,
308  const LevelData<FArrayBox>& a_phi,
309  const LevelData<FArrayBox>& a_rhs,
310  bool a_homogeneousPhysBC,
311  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
312 
313  /** a_residual = a_rhs - L(a_phi, a_phiCoarse) */
314  virtual void AMRResidualNF(LevelData<FArrayBox>& a_residual,
315  const LevelData<FArrayBox>& a_phi,
316  const LevelData<FArrayBox>& a_phiCoarse,
317  const LevelData<FArrayBox>& a_rhs,
318  bool a_homogeneousPhysBC);
319 
320  /** a_resCoarse = I[h-2h]( a_residual - L(a_correction, a_coarseCorrection))
321  it is assumed that a_resCoarse has already been filled in with the coarse
322  version of AMRResidualNF and that this operation is free to overwrite
323  in the overlap regions.
324  */
325 
326  virtual void AMRRestrict(LevelData<FArrayBox>& a_resCoarse,
327  const LevelData<FArrayBox>& a_residual,
328  const LevelData<FArrayBox>& a_correction,
329  const LevelData<FArrayBox>& a_coarseCorrection,
330  bool a_skip_res = false );
331 
332  /** a_correction += I[h->h](a_coarseCorrection) */
333  virtual void AMRProlong(LevelData<FArrayBox>& a_correction,
334  const LevelData<FArrayBox>& a_coarseCorrection);
335 
336  /** a_residual = a_residual - L(a_correction, a_coarseCorrection) */
337  virtual void AMRUpdateResidual(LevelData<FArrayBox>& a_residual,
338  const LevelData<FArrayBox>& a_correction,
339  const LevelData<FArrayBox>& a_coarseCorrection);
340 
341  ///
342  /**
343  compute norm over all cells on coarse not covered by finer
344  */
345  virtual Real AMRNorm(const LevelData<FArrayBox>& a_coarseResid,
346  const LevelData<FArrayBox>& a_fineResid,
347  const int& a_refRat,
348  const int& a_ord);
349 
350  virtual void outputLevel(LevelData<FArrayBox>& a_rhs,
351  string& a_name)
352  {
353  string fname(a_name);
354  fname.append(".hdf5");
355 #ifdef CH_HDF5
356  writeLevelname(&a_rhs, fname.c_str());
357 #endif
358  }
359 
360  //debugging hook
361  virtual void outputAMR(Vector<LevelData<FArrayBox>* >& a_rhs, string& a_name)
362  {
363  // for now, klugs is to use outputLevel on level 0
364  outputLevel(*a_rhs[0], a_name);
365  }
366 
368  ///
369  /**
370  does homogeneous coarse/fine interpolation for phi
371  */
372  void
374  const DataIndex& a_datInd,
375  int a_idir,
376  Side::LoHiSide a_hiorlo);
377 
378  ///
379  /** does homogeneous coarse/fine interpolation for tangential gradient
380  (needs phi ghost cells to be filled in first, so should call
381  homogeneousCFInterpPhi first)
382  */
384  const LevelData<FArrayBox>& a_phi,
385  const DataIndex& a_datInd,
386  int a_idir,
387  Side::LoHiSide a_hiorlo);
388 
390  const DataIndex& a_datInd,
391  const int a_idir,
392  const Side::LoHiSide a_hiorlo,
393  const IntVectSet& a_interpIVS);
394  ///
395  /**
396  Apply the AMR operator, including coarse-fine matching
397  */
398  void AMROperator( LevelData<FArrayBox>& a_LofPhi,
399  const LevelData<FArrayBox>& a_phiFine,
400  const LevelData<FArrayBox>& a_phi,
401  const LevelData<FArrayBox>& a_phiCoarse,
402  bool a_homogeneousDomBC,
403  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
404 
405  void AMROperatorNF( LevelData<FArrayBox>& a_LofPhi,
406  const LevelData<FArrayBox>& a_phi,
407  const LevelData<FArrayBox>& a_phiCoarse,
408  bool a_homogeneousBC);
409 
410  virtual void AMROperatorNC( LevelData<FArrayBox>& a_LofPhi,
411  const LevelData<FArrayBox>& a_phiFine,
412  const LevelData<FArrayBox>& a_phi,
413  bool a_homogeneousBC,
414  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
415 
416  void cellGrad(FArrayBox& a_gradPhi,
417  const FArrayBox& a_phi,
418  const Box& a_grid);
419 
420  void cfinterp(const LevelData<FArrayBox>& a_phiFine,
421  const LevelData<FArrayBox>& a_phiCoarse);
422 
423  void fillGrad(const LevelData<FArrayBox>& a_phiFine);
424 
425  static void loHiCenterFace(Box& a_loBox,
426  int& a_hasLo,
427  Box& a_hiBox,
428  int& a_hasHi,
429  Box& a_centerBox,
430  const ProblemDomain& a_eblg,
431  const Box& a_inBox,
432  const int& a_dir);
433 
434  static void getFaceDivAndGrad(FArrayBox& a_faceDiv,
435  FArrayBox& a_faceGrad,
436  const FArrayBox& a_data,
437  const FArrayBox& a_gradData,
438  const ProblemDomain& a_domain,
439  const Box& a_faceBox,
440  const int& a_faceDir,
441  const Real a_dx);
442 
443  static void getFluxFromDivAndGrad(FArrayBox& a_flux,
444  const FArrayBox& a_faceDiv,
445  const FArrayBox& a_faceGrad,
446  const FArrayBox& a_etaFace,
447  const FArrayBox& a_lambdaFace,
448  const Box& a_faceBox,
449  int a_dir);
450 
451  ///take cell centered divergence of the inputs.
452  /**
453  not part of the operator evaluation. this is to
454  test whether the divergence of b converges at h^2
455  as b does if b is analytically divergence-free.
456  */
458  const LevelData<FArrayBox>& a_phi,
459  const LevelData<FArrayBox>* a_phiC);
460 
461  /// prolongation type
462  /** make this public/static to make it easy to change, while
463  also ensuring that it remains constent across all instances
464  */
465  static int s_prolongType;
466 
467  /// access function
468 
472  Real getAlpha() const {return m_alpha;}
473  Real getBeta() const {return m_beta;}
474 
475 
476 protected:
477  void defineRelCoef();
486 
487  //b is a scalar in 2d, vector in 3d
488  int m_ncomp;
492  //relaxation coef
493 public: // I want to get this from an owner of this -mfa
495 protected:
496  // underrelaxation parameter
498  // stopping tolerance for relaxation
500  // minimum number of smooths before tolerance check
502 
507 
510  // will need these to do tangential gradient computations
514 
515 private:
516  ///weak construction is bad
518  {
519  MayDay::Error("invalid operator");
520  }
521  //copy constructor and operator= disallowed for all the usual reasons
523  {
524  MayDay::Error("invalid operator");
525  }
526  void operator=(const ViscousTensorOp& a_opin)
527  {
528  MayDay::Error("invalid operator");
529  }
530 
531 };
532 
533 ///
534 /**
535  Factory to create ViscousTensorOps
536 */
537 class ViscousTensorOpFactory: public AMRLevelOpFactory<LevelData<FArrayBox> >
538 {
539 public:
541  {
542 #if 0
543  for (int ivec = 0; ivec < m_eta.size(); ivec++)
544  {
548  }
549 #endif
550 
551  }
552 
554  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
555  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
556  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
557  Real a_alpha,
558  Real a_beta,
559  const Vector<int>& a_refRatios,
560  const ProblemDomain& a_domainCoar,
561  const Real& a_dxCoar,
562  BCFunc a_bc,
563  Real a_safety = VTOP_DEFAULT_SAFETY,
564  Real a_relaxTolerance = 0.0,
565  int a_relaxMinIter = 1000
566  );
567 
569  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
570  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
571  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
572  Real a_alpha,
573  Real a_beta,
574  const Vector<int>& a_refRatios,
575  const ProblemDomain& a_domainCoar,
576  const Real& a_dxCoar,
577  BCHolder a_bc,
578  Real a_safety = VTOP_DEFAULT_SAFETY,
579  Real a_relaxTolerance = 0.0,
580  int a_relaxMinIter = 1000
581  );
582 
583  virtual void define(const Vector<DisjointBoxLayout>& a_grids,
584  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
585  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
586  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
587  Real a_alpha,
588  Real a_beta,
589  const Vector<int>& a_refRatios,
590  const ProblemDomain& a_domainCoar,
591  const Real& a_dxCoar,
592  BCHolder a_bc,
593  Real a_safety = VTOP_DEFAULT_SAFETY,
594  Real a_relaxTolerance = 0.0,
595  int a_relaxMinIter = 1000
596  );
597 
598  ///
599  virtual ViscousTensorOp*
600  MGnewOp(const ProblemDomain& a_FineindexSpace,
601  int depth,
602  bool homoOnly = true);
603 
604  ///
605  virtual ViscousTensorOp* AMRnewOp(const ProblemDomain& a_indexSpace);
606 
607  ///
608  virtual int refToFiner(const ProblemDomain&) const;
609 
610  /// set any relevant default values
611  void setDefaults();
612 
613  // 0 = arithmetic, 1 = harmonic
615 
616 
617 private:
625  // refinement to next coarser level
633 
634  ///weak construction is bad
636  {
637  MayDay::Error("invalid operator");
638  }
639  //copy constructor and operator= disallowed for all the usual reasons
641  {
642  MayDay::Error("invalid operator");
643  }
644 
645  void operator=(const ViscousTensorOpFactory& a_opin)
646  {
647  MayDay::Error("invalid operator");
648  }
649 };
650 
651 extern void
652 coarsenStuff(LevelData<FluxBox> & a_etaCoar,
653  LevelData<FluxBox> & a_lambdaCoar,
654  const LevelData<FluxBox> & a_etaFine,
655  const LevelData<FluxBox> & a_lambdaFine,
656  const int & a_refToDepth);
657 
658 #include "NamespaceFooter.H"
659 #endif
int m_ncomp
Definition: ViscousTensorOp.H:488
virtual void create(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs)
ProblemDomain m_domain
Definition: ViscousTensorOp.H:491
Real m_alpha
Definition: ViscousTensorOp.H:481
Real getAlpha() const
Definition: ViscousTensorOp.H:472
void reflux(const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phi, LevelData< FArrayBox > &residual, AMRLevelOp< LevelData< FArrayBox > > *a_finerOp)
void defineRelCoef()
virtual void residual(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_rhs, bool a_homogeneous=false)
Real m_dxCrse
Definition: ViscousTensorOp.H:490
Definition: ViscousTensorOp.H:42
void computeOperatorNoBCs(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_phi)
utility function which computes operator after all bc's have been set
A reference-counting handle class.
Definition: RefCountedPtr.H:173
LevelData< FArrayBox > m_relaxCoef
Definition: ViscousTensorOp.H:494
virtual int refToFiner(const ProblemDomain &) const
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
virtual ~ViscousTensorOp()
Definition: ViscousTensorOp.H:88
Definition: BCFunc.H:136
ViscousTensorOp()
weak construction is bad
Definition: ViscousTensorOp.H:517
Real m_beta
Definition: ViscousTensorOp.H:482
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
void homogeneousCFInterpTanGrad(LevelData< FArrayBox > &a_tanGrad, const LevelData< FArrayBox > &a_phi, const DataIndex &a_datInd, int a_idir, Side::LoHiSide a_hiorlo)
LayoutData< TensorFineStencilSet > m_hiTanStencilSets[SpaceDim]
Definition: ViscousTensorOp.H:511
virtual void applyOp(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_phi, bool a_homogeneous=false)
virtual void incr(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_x, Real a_scale)
void AMROperatorNF(LevelData< FArrayBox > &a_LofPhi, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_phiCoarse, bool a_homogeneousBC)
virtual void relax(LevelData< FArrayBox > &a_e, const LevelData< FArrayBox > &a_residual, int iterations)
LevelData< FArrayBox > m_grad
Definition: ViscousTensorOp.H:503
virtual void define(const Vector< DisjointBoxLayout > &a_grids, const Vector< RefCountedPtr< LevelData< FluxBox > > > &a_eta, const Vector< RefCountedPtr< LevelData< FluxBox > > > &a_lambda, const Vector< RefCountedPtr< LevelData< FArrayBox > > > &a_acoef, Real a_alpha, Real a_beta, const Vector< int > &a_refRatios, const ProblemDomain &a_domainCoar, const Real &a_dxCoar, BCHolder a_bc, Real a_safety=VTOP_DEFAULT_SAFETY, Real a_relaxTolerance=0.0, int a_relaxMinIter=1000)
one dimensional dynamic array
Definition: Vector.H:53
void coarsenStuff(LevelData< FluxBox > &a_etaCoar, LevelData< FluxBox > &a_lambdaCoar, const LevelData< FluxBox > &a_etaFine, const LevelData< FluxBox > &a_lambdaFine, const int &a_refToDepth)
BCHolder m_bc
Definition: ViscousTensorOp.H:485
Vector< DisjointBoxLayout > m_boxes
Definition: ViscousTensorOp.H:623
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:145
void define(const DisjointBoxLayout &a_grids, const DisjointBoxLayout &a_gridsFine, const DisjointBoxLayout &a_gridsCoar, const RefCountedPtr< LevelData< FluxBox > > &a_eta, const RefCountedPtr< LevelData< FluxBox > > &a_lambda, const RefCountedPtr< LevelData< FArrayBox > > &a_acoef, Real a_alpha, Real a_beta, int a_refToFine, int a_refToCoar, const ProblemDomain &a_domain, const Real &a_dxLevel, const Real &a_dxCoar, BCHolder &a_bc, Real a_safety=VTOP_DEFAULT_SAFETY, Real a_relaxTolerance=0.0, int a_relaxMinIter=1000)
Definition: ViscousTensorOp.H:35
static int s_coefficientAverageType
Definition: ViscousTensorOp.H:614
RefCountedPtr< LevelData< FluxBox > > m_lambda
Definition: ViscousTensorOp.H:479
static void getFluxFromDivAndGrad(FArrayBox &a_flux, const FArrayBox &a_faceDiv, const FArrayBox &a_faceGrad, const FArrayBox &a_etaFace, const FArrayBox &a_lambdaFace, const Box &a_faceBox, int a_dir)
Quadratic coarse-fine interpolation utility for tensors.
Definition: TensorCFInterp.H:36
virtual void axby(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_x, const LevelData< FArrayBox > &a_y, Real a, Real b)
Definition: DataIterator.H:190
virtual void getFlux(FluxBox &a_flux, const LevelData< FArrayBox > &a_data, const Box &a_grid, const DataIndex &a_dit, Real a_scale)
Definition: ViscousTensorOp.H:188
void fillGrad(const LevelData< FArrayBox > &a_phiFine)
These functions are part of the LevelTGA interface......
LayoutData< CFIVS > m_loCFIVS[SpaceDim]
Definition: ViscousTensorOp.H:508
LevelDataOps< FArrayBox > m_levelOps
Definition: ViscousTensorOp.H:504
virtual void diagonalScale(LevelData< FArrayBox > &a_rhs, bool a_kappaWeighted)
Definition: ViscousTensorOp.H:46
virtual ViscousTensorOp * MGnewOp(const ProblemDomain &a_FineindexSpace, int depth, bool homoOnly=true)
Real m_beta
Definition: ViscousTensorOp.H:629
BCHolder m_bc
Definition: ViscousTensorOp.H:627
void divergenceCC(LevelData< FArrayBox > &a_div, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > *a_phiC)
take cell centered divergence of the inputs.
RefCountedPtr< LevelData< FluxBox > > getLambda() const
Definition: ViscousTensorOp.H:470
const int SpaceDim
Definition: SPACE.H:38
Definition: AMRMultiGrid.H:39
virtual void outputLevel(LevelData< FArrayBox > &a_rhs, string &a_name)
Definition: ViscousTensorOp.H:350
virtual void setToZero(LevelData< FArrayBox > &a_x)
virtual void createCoarser(LevelData< FArrayBox > &a_coarse, const LevelData< FArrayBox > &a_fine, bool ghosted)
void operator=(const ViscousTensorOp &a_opin)
Definition: ViscousTensorOp.H:526
Definition: ViscousTensorOp.H:41
static void loHiCenterFace(Box &a_loBox, int &a_hasLo, Box &a_hiBox, int &a_hasHi, Box &a_centerBox, const ProblemDomain &a_eblg, const Box &a_inBox, const int &a_dir)
Vector< RefCountedPtr< LevelData< FArrayBox > > > m_acoef
Definition: ViscousTensorOp.H:620
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
void cellGrad(FArrayBox &a_gradPhi, const FArrayBox &a_phi, const Box &a_grid)
void applyOpNoBoundary(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_phi)
Definition: ViscousTensorOp.H:208
virtual void AMRResidualNF(LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_phiCoarse, const LevelData< FArrayBox > &a_rhs, bool a_homogeneousPhysBC)
virtual void restrictResidual(LevelData< FArrayBox > &a_resCoarse, LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_rhsFine)
Vector< ProblemDomain > m_domains
Definition: ViscousTensorOp.H:622
#define VTOP_DEFAULT_SAFETY
Definition: ViscousTensorOp.H:29
virtual Real dxCrse() const
Definition: ViscousTensorOp.H:249
virtual void diagonalScale(LevelData< FArrayBox > &a_rhs)
Definition: ViscousTensorOp.H:59
virtual Real dx() const
Definition: ViscousTensorOp.H:244
Real m_alpha
Definition: ViscousTensorOp.H:628
prolongationType
Definition: ViscousTensorOp.H:39
virtual int refToCoarser()
Definition: ViscousTensorOp.H:290
virtual void divideByIdentityCoef(LevelData< FArrayBox > &a_rhs)
Definition: ViscousTensorOp.H:72
void setDefaults()
set any relevant default values
virtual void outputAMR(Vector< LevelData< FArrayBox > * > &a_rhs, string &a_name)
Definition: ViscousTensorOp.H:361
int m_refToCoar
Definition: ViscousTensorOp.H:483
Real m_dx
Definition: ViscousTensorOp.H:489
double Real
Definition: REAL.H:33
Box surroundingNodes(const Box &b, int dir)
Definition: Box.H:2145
LayoutData< TensorFineStencilSet > m_loTanStencilSets[SpaceDim]
Definition: ViscousTensorOp.H:512
Definition: ViscousTensorOp.H:537
Real m_relaxTolerance
Definition: ViscousTensorOp.H:631
ViscousTensorOp(const ViscousTensorOp &a_opin)
Definition: ViscousTensorOp.H:522
virtual void setAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
Definition: ViscousTensorOp.H:51
const DisjointBoxLayout & disjointBoxLayout() const
Definition: LevelData.H:209
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
virtual void assign(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs)
LoHiSide
Definition: LoHiSide.H:27
void interpOnIVSHomo(LevelData< FArrayBox > &a_phif, const DataIndex &a_datInd, const int a_idir, const Side::LoHiSide a_hiorlo, const IntVectSet &a_interpIVS)
const Box & domainBox() const
Returns the logical computational domain.
Definition: ProblemDomain.H:887
Copier m_exchangeCopier
Definition: ViscousTensorOp.H:505
RefCountedPtr< LevelData< FArrayBox > > getACoef() const
Definition: ViscousTensorOp.H:471
void homogeneousCFInterpPhi(LevelData< FArrayBox > &a_phif, const DataIndex &a_datInd, int a_idir, Side::LoHiSide a_hiorlo)
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 homogeneousCFInterp(LevelData< FArrayBox > &a_phif)
virtual void AMRResidualNC(LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_rhs, bool a_homogeneousPhysBC, AMRLevelOp< LevelData< FArrayBox > > *a_finerOp)
void(* BCFunc)(FArrayBox &a_state, const Box &a_valid, const ProblemDomain &a_domain, Real a_dx, bool a_homogeneous)
Definition: BCFunc.H:30
void cfinterp(const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phiCoarse)
DataIterator dataIterator() const
Parallel iterator.
virtual void AMRRestrict(LevelData< FArrayBox > &a_resCoarse, const LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_coarseCorrection, bool a_skip_res=false)
LayoutData< CFIVS > m_hiCFIVS[SpaceDim]
Definition: ViscousTensorOp.H:509
Real getBeta() const
Definition: ViscousTensorOp.H:473
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
int m_relaxMinIter
Definition: ViscousTensorOp.H:632
Vector< Real > m_dx
Definition: ViscousTensorOp.H:624
int m_relaxMinIter
Definition: ViscousTensorOp.H:501
void operator=(const ViscousTensorOpFactory &a_opin)
Definition: ViscousTensorOp.H:645
Definition: DataIndex.H:112
Vector< RefCountedPtr< LevelData< FluxBox > > > m_eta
Definition: ViscousTensorOp.H:618
virtual ViscousTensorOp * AMRnewOp(const ProblemDomain &a_indexSpace)
virtual void createCoarsened(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs, const int &a_refRat)
virtual void AMRProlong(LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_coarseCorrection)
Definition: FArrayBox.H:45
Definition: AMRTGA.H:159
size_t size() const
Definition: Vector.H:192
virtual void preCond(LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_residual)
ViscousTensorOpFactory()
weak construction is bad
Definition: ViscousTensorOp.H:635
void AMROperator(LevelData< FArrayBox > &a_LofPhi, const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_phiCoarse, bool a_homogeneousDomBC, AMRLevelOp< LevelData< FArrayBox > > *a_finerOp)
virtual void AMRResidual(LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > &a_phiCoarse, const LevelData< FArrayBox > &a_rhs, bool a_homogeneousPhysBC, AMRLevelOp< LevelData< FArrayBox > > *a_finerOp)
Real m_safety
Definition: ViscousTensorOp.H:497
virtual bool ok() const
return true if this iterator is still in its Layout
Definition: LayoutIterator.H:117
const Box & box() const
Returns cell-centered box which defines fluxBox.
RefCountedPtr< LevelData< FluxBox > > m_eta
Definition: ViscousTensorOp.H:478
virtual Real norm(const LevelData< FArrayBox > &a_x, int a_ord)
Real m_relaxTolerance
Definition: ViscousTensorOp.H:499
Vector< int > m_refRatios
Definition: ViscousTensorOp.H:626
Real m_safety
Definition: ViscousTensorOp.H:630
virtual void prolongIncrement(LevelData< FArrayBox > &a_phiThisLevel, const LevelData< FArrayBox > &a_correctCoarse)
void writeLevelname(const LevelData< FArrayBox > *a_dataPtr, const char *a_filename)
void define(const Box &bx, int n=1)
Resize FluxBox similar to BaseFab::resize()
static int s_prolongType
prolongation type
Definition: ViscousTensorOp.H:465
virtual Real AMRNorm(const LevelData< FArrayBox > &a_coarseResid, const LevelData< FArrayBox > &a_fineResid, const int &a_refRat, const int &a_ord)
Definition: AMRMultiGrid.H:233
virtual void scale(LevelData< FArrayBox > &a_lhs, const Real &a_scale)
virtual ~ViscousTensorOpFactory()
Definition: ViscousTensorOp.H:540
virtual Real dotProduct(const LevelData< FArrayBox > &a_1, const LevelData< FArrayBox > &a_2)
RefCountedPtr< LevelData< FluxBox > > getEta() const
access function
Definition: ViscousTensorOp.H:469
Vector< IntVect > m_colors
Definition: ViscousTensorOp.H:513
LevelData< FArrayBox > m_phic
Definition: ViscousTensorOp.H:621
virtual void AMRUpdateResidual(LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_coarseCorrection)
virtual void AMROperatorNC(LevelData< FArrayBox > &a_LofPhi, const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phi, bool a_homogeneousBC, AMRLevelOp< LevelData< FArrayBox > > *a_finerOp)
TensorCFInterp m_interpWithCoarser
Definition: ViscousTensorOp.H:506
static void getFaceDivAndGrad(FArrayBox &a_faceDiv, FArrayBox &a_faceGrad, const FArrayBox &a_data, const FArrayBox &a_gradData, const ProblemDomain &a_domain, const Box &a_faceBox, const int &a_faceDir, const Real a_dx)
int m_refToFine
Definition: ViscousTensorOp.H:484
ViscousTensorOpFactory(const ViscousTensorOpFactory &a_opin)
Definition: ViscousTensorOp.H:640
Vector< RefCountedPtr< LevelData< FluxBox > > > m_lambda
Definition: ViscousTensorOp.H:619
Definition: ViscousTensorOp.H:43
RefCountedPtr< LevelData< FArrayBox > > m_acoef
Definition: ViscousTensorOp.H:480