Chombo + EB  3.0
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 
229  virtual void assign( LevelData<FArrayBox>& a_lhs,
230  const LevelData<FArrayBox>& a_rhs) ;
231  virtual Real dotProduct(const LevelData<FArrayBox>& a_1,
232  const LevelData<FArrayBox>& a_2) ;
233  virtual void incr( LevelData<FArrayBox>& a_lhs,
234  const LevelData<FArrayBox>& a_x,
235  Real a_scale) ;
236  virtual void axby( LevelData<FArrayBox>& a_lhs,
237  const LevelData<FArrayBox>& a_x,
238  const LevelData<FArrayBox>& a_y,
239  Real a, Real b) ;
240 
241  virtual void scale(LevelData<FArrayBox>& a_lhs, const Real& a_scale) ;
242 
243  virtual Real norm(const LevelData<FArrayBox>& a_x, int a_ord);
244 
245  virtual Real dx() const
246  {
247  return m_dx;
248  }
249 
250  virtual Real dxCrse() const
251  {
252  return m_dxCrse;
253  }
254 
255  virtual void setToZero( LevelData<FArrayBox>& a_x);
256  /*@}*/
257 
258  /**
259  \name MGLevelOp functions */
260  /*@{*/
261 
262  virtual void relax(LevelData<FArrayBox>& a_e,
263  const LevelData<FArrayBox>& a_residual,
264  int iterations);
265 
266  virtual void createCoarser(LevelData<FArrayBox>& a_coarse,
267  const LevelData<FArrayBox>& a_fine,
268  bool ghosted);
269  /**
270  calculate restricted residual
271  a_resCoarse[2h] = I[h->2h] (rhsFine[h] - L[h](phiFine[h])
272  */
273  virtual void restrictResidual(LevelData<FArrayBox>& a_resCoarse,
274  LevelData<FArrayBox>& a_phiFine,
275  const LevelData<FArrayBox>& a_rhsFine);
276 
277  /**
278  correct the fine solution based on coarse correction
279  a_phiThisLevel += I[2h->h](a_correctCoarse)
280  */
281  virtual void prolongIncrement(LevelData<FArrayBox>& a_phiThisLevel,
282  const LevelData<FArrayBox>& a_correctCoarse);
283 
284  /*@}*/
285 
286  /**
287  \name AMRLevelOp functions */
288  /*@{*/
289 
290  /** returns 1 when there are no coarser AMRLevelOp objects */
291  virtual int refToCoarser()
292  {
293  return m_refToCoar;
294  }
295 
296  /** a_residual = a_rhs - L(a_phi, a_phiFine, a_phiCoarse) */
297  virtual void AMRResidual(LevelData<FArrayBox>& a_residual,
298  const LevelData<FArrayBox>& a_phiFine,
299  const LevelData<FArrayBox>& a_phi,
300  const LevelData<FArrayBox>& a_phiCoarse,
301  const LevelData<FArrayBox>& a_rhs,
302  bool a_homogeneousPhysBC,
303  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
304 
305  /** residual assuming no more coarser AMR levels */
306 
307  virtual void AMRResidualNC(LevelData<FArrayBox>& a_residual,
308  const LevelData<FArrayBox>& a_phiFine,
309  const LevelData<FArrayBox>& a_phi,
310  const LevelData<FArrayBox>& a_rhs,
311  bool a_homogeneousPhysBC,
312  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
313 
314  /** a_residual = a_rhs - L(a_phi, a_phiCoarse) */
315  virtual void AMRResidualNF(LevelData<FArrayBox>& a_residual,
316  const LevelData<FArrayBox>& a_phi,
317  const LevelData<FArrayBox>& a_phiCoarse,
318  const LevelData<FArrayBox>& a_rhs,
319  bool a_homogeneousPhysBC);
320 
321  /** a_resCoarse = I[h-2h]( a_residual - L(a_correction, a_coarseCorrection))
322  it is assumed that a_resCoarse has already been filled in with the coarse
323  version of AMRResidualNF and that this operation is free to overwrite
324  in the overlap regions.
325  */
326 
327  virtual void AMRRestrict(LevelData<FArrayBox>& a_resCoarse,
328  const LevelData<FArrayBox>& a_residual,
329  const LevelData<FArrayBox>& a_correction,
330  const LevelData<FArrayBox>& a_coarseCorrection);
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 
367 
369  ///
370  /**
371  does homogeneous coarse/fine interpolation for phi
372  */
373  void
375  const DataIndex& a_datInd,
376  int a_idir,
377  Side::LoHiSide a_hiorlo);
378 
379  ///
380  /** does homogeneous coarse/fine interpolation for tangential gradient
381  (needs phi ghost cells to be filled in first, so should call
382  homogeneousCFInterpPhi first)
383  */
385  const LevelData<FArrayBox>& a_phi,
386  const DataIndex& a_datInd,
387  int a_idir,
388  Side::LoHiSide a_hiorlo);
389 
391  const DataIndex& a_datInd,
392  const int a_idir,
393  const Side::LoHiSide a_hiorlo,
394  const IntVectSet& a_interpIVS);
395  ///
396  /**
397  Apply the AMR operator, including coarse-fine matching
398  */
399  void AMROperator( LevelData<FArrayBox>& a_LofPhi,
400  const LevelData<FArrayBox>& a_phiFine,
401  const LevelData<FArrayBox>& a_phi,
402  const LevelData<FArrayBox>& a_phiCoarse,
403  bool a_homogeneousDomBC,
404  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
405 
406  void AMROperatorNF( LevelData<FArrayBox>& a_LofPhi,
407  const LevelData<FArrayBox>& a_phi,
408  const LevelData<FArrayBox>& a_phiCoarse,
409  bool a_homogeneousBC);
410 
411  virtual void AMROperatorNC( LevelData<FArrayBox>& a_LofPhi,
412  const LevelData<FArrayBox>& a_phiFine,
413  const LevelData<FArrayBox>& a_phi,
414  bool a_homogeneousBC,
415  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
416 
417  void cellGrad(FArrayBox& a_gradPhi,
418  const FArrayBox& a_phi,
419  const Box& a_grid);
420 
421  void cfinterp(const LevelData<FArrayBox>& a_phiFine,
422  const LevelData<FArrayBox>& a_phiCoarse);
423 
424  void fillGrad(const LevelData<FArrayBox>& a_phiFine);
425 
426  static void loHiCenterFace(Box& a_loBox,
427  int& a_hasLo,
428  Box& a_hiBox,
429  int& a_hasHi,
430  Box& a_centerBox,
431  const ProblemDomain& a_eblg,
432  const Box& a_inBox,
433  const int& a_dir);
434 
435  static void getFaceDivAndGrad(FArrayBox& a_faceDiv,
436  FArrayBox& a_faceGrad,
437  const FArrayBox& a_data,
438  const FArrayBox& a_gradData,
439  const ProblemDomain& a_domain,
440  const Box& a_faceBox,
441  const int& a_faceDir,
442  const Real a_dx);
443 
444  static void getFluxFromDivAndGrad(FArrayBox& a_flux,
445  const FArrayBox& a_faceDiv,
446  const FArrayBox& a_faceGrad,
447  const FArrayBox& a_etaFace,
448  const FArrayBox& a_lambdaFace,
449  const Box& a_faceBox,
450  int a_dir);
451 
452  ///take cell centered divergence of the inputs.
453  /**
454  not part of the operator evaluation. this is to
455  test whether the divergence of b converges at h^2
456  as b does if b is analytically divergence-free.
457  */
459  const LevelData<FArrayBox>& a_phi,
460  const LevelData<FArrayBox>* a_phiC);
461 
462 
463  /// prolongation type
464  /** make this public/static to make it easy to change, while
465  also ensuring that it remains constent across all instances
466  */
467  static int s_prolongType;
468 
469 
470 
471 protected:
472  void defineRelCoef();
481 
482  //b is a scalar in 2d, vector in 3d
483  int m_ncomp;
487  //relaxation coef
489  // underrelaxation parameter
491  // stopping tolerance for relaxation
493  // minimum number of smooths before tolerance check
495 
500 
503  // will need these to do tangential gradient computations
507 
508 private:
509  ///weak construction is bad
511  {
512  MayDay::Error("invalid operator");
513  }
514  //copy constructor and operator= disallowed for all the usual reasons
516  {
517  MayDay::Error("invalid operator");
518  }
519  void operator=(const ViscousTensorOp& a_opin)
520  {
521  MayDay::Error("invalid operator");
522  }
523 
524 };
525 
526 ///
527 /**
528  Factory to create ViscousTensorOps
529 */
530 class ViscousTensorOpFactory: public AMRLevelOpFactory<LevelData<FArrayBox> >
531 {
532 public:
534  {
535 #if 0
536  for (int ivec = 0; ivec < m_eta.size(); ivec++)
537  {
541  }
542 #endif
543 
544  }
545 
547  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
548  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
549  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
550  Real a_alpha,
551  Real a_beta,
552  const Vector<int>& a_refRatios,
553  const ProblemDomain& a_domainCoar,
554  const Real& a_dxCoar,
555  BCFunc a_bc,
556  Real a_safety = VTOP_DEFAULT_SAFETY,
557  Real a_relaxTolerance = 0.0,
558  int a_relaxMinIter = 1000
559  );
560 
562  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
563  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
564  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
565  Real a_alpha,
566  Real a_beta,
567  const Vector<int>& a_refRatios,
568  const ProblemDomain& a_domainCoar,
569  const Real& a_dxCoar,
570  BCHolder& a_bc,
571  Real a_safety = VTOP_DEFAULT_SAFETY,
572  Real a_relaxTolerance = 0.0,
573  int a_relaxMinIter = 1000
574  );
575 
576 
577  virtual void define(const Vector<DisjointBoxLayout>& a_grids,
578  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
579  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
580  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
581  Real a_alpha,
582  Real a_beta,
583  const Vector<int>& a_refRatios,
584  const ProblemDomain& a_domainCoar,
585  const Real& a_dxCoar,
586  BCHolder& a_bc,
587  Real a_safety = VTOP_DEFAULT_SAFETY,
588  Real a_relaxTolerance = 0.0,
589  int a_relaxMinIter = 1000
590  );
591 
592  ///
593  virtual ViscousTensorOp*
594  MGnewOp(const ProblemDomain& a_FineindexSpace,
595  int depth,
596  bool homoOnly = true);
597 
598  ///
599  virtual ViscousTensorOp* AMRnewOp(const ProblemDomain& a_indexSpace);
600 
601  ///
602  virtual int refToFiner(const ProblemDomain&) const;
603 
604  /// set any relevant default values
605  void setDefaults();
606 
607  // 0 = arithmetic, 1 = harmonic
609 
610 
611 private:
619  // refinement to next coarser level
627 
628  ///weak construction is bad
630  {
631  MayDay::Error("invalid operator");
632  }
633  //copy constructor and operator= disallowed for all the usual reasons
635  {
636  MayDay::Error("invalid operator");
637  }
638 
639  void operator=(const ViscousTensorOpFactory& a_opin)
640  {
641  MayDay::Error("invalid operator");
642  }
643 };
644 
645 extern void
646 coarsenStuff(LevelData<FluxBox> & a_etaCoar,
647  LevelData<FluxBox> & a_lambdaCoar,
648  const LevelData<FluxBox> & a_etaFine,
649  const LevelData<FluxBox> & a_lambdaFine,
650  const int & a_refToDepth);
651 
652 #include "NamespaceFooter.H"
653 #endif
int m_ncomp
Definition: ViscousTensorOp.H:483
virtual void create(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs)
ProblemDomain m_domain
Definition: ViscousTensorOp.H:486
Real m_alpha
Definition: ViscousTensorOp.H:476
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:485
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
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)
A reference-counting handle class.
Definition: RefCountedPtr.H:66
LevelData< FArrayBox > m_relaxCoef
Definition: ViscousTensorOp.H:488
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:138
ViscousTensorOp()
weak construction is bad
Definition: ViscousTensorOp.H:510
Real m_beta
Definition: ViscousTensorOp.H:477
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:130
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:504
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:496
one dimensional dynamic array
Definition: Vector.H:52
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:480
Vector< DisjointBoxLayout > m_boxes
Definition: ViscousTensorOp.H:617
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:137
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:608
RefCountedPtr< LevelData< FluxBox > > m_lambda
Definition: ViscousTensorOp.H:474
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:140
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:501
LevelDataOps< FArrayBox > m_levelOps
Definition: ViscousTensorOp.H:497
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:623
BCHolder m_bc
Definition: ViscousTensorOp.H:621
void divergenceCC(LevelData< FArrayBox > &a_div, const LevelData< FArrayBox > &a_phi, const LevelData< FArrayBox > *a_phiC)
take cell centered divergence of the inputs.
const int SpaceDim
Definition: SPACE.H:39
Definition: AMRMultiGrid.H:35
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:519
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:614
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:616
#define VTOP_DEFAULT_SAFETY
Definition: ViscousTensorOp.H:29
virtual Real dxCrse() const
Definition: ViscousTensorOp.H:250
virtual void diagonalScale(LevelData< FArrayBox > &a_rhs)
Definition: ViscousTensorOp.H:59
virtual Real dx() const
Definition: ViscousTensorOp.H:245
Real m_alpha
Definition: ViscousTensorOp.H:622
prolongationType
Definition: ViscousTensorOp.H:39
virtual int refToCoarser()
Definition: ViscousTensorOp.H:291
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:478
Real m_dx
Definition: ViscousTensorOp.H:484
double Real
Definition: REAL.H:33
Box surroundingNodes(const Box &b, int dir)
Definition: Box.H:2166
LayoutData< TensorFineStencilSet > m_loTanStencilSets[SpaceDim]
Definition: ViscousTensorOp.H:505
Definition: ViscousTensorOp.H:530
Real m_relaxTolerance
Definition: ViscousTensorOp.H:625
ViscousTensorOp(const ViscousTensorOp &a_opin)
Definition: ViscousTensorOp.H:515
virtual void setAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
Definition: ViscousTensorOp.H:51
const DisjointBoxLayout & disjointBoxLayout() const
Definition: LevelData.H:196
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:31
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:868
Copier m_exchangeCopier
Definition: ViscousTensorOp.H:498
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
virtual void AMRRestrict(LevelData< FArrayBox > &a_resCoarse, const LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_coarseCorrection)
void cfinterp(const LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_phiCoarse)
DataIterator dataIterator() const
Parallel iterator.
LayoutData< CFIVS > m_hiCFIVS[SpaceDim]
Definition: ViscousTensorOp.H:502
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
int m_relaxMinIter
Definition: ViscousTensorOp.H:626
Vector< Real > m_dx
Definition: ViscousTensorOp.H:618
int m_relaxMinIter
Definition: ViscousTensorOp.H:494
void operator=(const ViscousTensorOpFactory &a_opin)
Definition: ViscousTensorOp.H:639
Definition: DataIndex.H:112
Vector< RefCountedPtr< LevelData< FluxBox > > > m_eta
Definition: ViscousTensorOp.H:612
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:44
Definition: AMRTGA.H:159
size_t size() const
Definition: Vector.H:177
virtual void preCond(LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_residual)
ViscousTensorOpFactory()
weak construction is bad
Definition: ViscousTensorOp.H:629
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:490
virtual bool ok() const
return true if this iterator is still in its Layout
Definition: LayoutIterator.H:110
const Box & box() const
Returns cell-centered box which defines fluxBox.
RefCountedPtr< LevelData< FluxBox > > m_eta
Definition: ViscousTensorOp.H:473
virtual Real norm(const LevelData< FArrayBox > &a_x, int a_ord)
Real m_relaxTolerance
Definition: ViscousTensorOp.H:492
Vector< int > m_refRatios
Definition: ViscousTensorOp.H:620
Real m_safety
Definition: ViscousTensorOp.H:624
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)
Define function.
static int s_prolongType
prolongation type
Definition: ViscousTensorOp.H:467
virtual Real AMRNorm(const LevelData< FArrayBox > &a_coarseResid, const LevelData< FArrayBox > &a_fineResid, const int &a_refRat, const int &a_ord)
Definition: AMRMultiGrid.H:231
virtual void scale(LevelData< FArrayBox > &a_lhs, const Real &a_scale)
virtual ~ViscousTensorOpFactory()
Definition: ViscousTensorOp.H:533
virtual Real dotProduct(const LevelData< FArrayBox > &a_1, const LevelData< FArrayBox > &a_2)
Vector< IntVect > m_colors
Definition: ViscousTensorOp.H:506
LevelData< FArrayBox > m_phic
Definition: ViscousTensorOp.H:615
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:499
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:479
ViscousTensorOpFactory(const ViscousTensorOpFactory &a_opin)
Definition: ViscousTensorOp.H:634
Vector< RefCountedPtr< LevelData< FluxBox > > > m_lambda
Definition: ViscousTensorOp.H:613
Definition: ViscousTensorOp.H:43
RefCountedPtr< LevelData< FArrayBox > > m_acoef
Definition: ViscousTensorOp.H:475