Chombo + EB + MF  3.2
newViscousTensorOp.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 _NEWVISCOUSTENSOROP_H_
12 #define _NEWVISCOUSTENSOROP_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 "FourthOrderFillPatch.H"
25 #include "CoarseAverage.H"
26 #include "LevelFluxRegister.H"
27 #include "AMRIO.H"
28 #include "NamespaceHeader.H"
29 
30 #define VTOP_DEFAULT_SAFETY 0.9
31 ///
32 /**
33  operator is alpha a I + (divF) = alpha*acoef I + beta*div(eta(grad B + grad BT) + lambda I div B )
34  beta, lambda, and eta are incorporated into the flux F
35 */
36 class ViscousTensorOp : public LevelTGAHelmOp<LevelData<FArrayBox>, FluxBox>
37 {
38 public:
39 
41  {
45  };
46 
47  virtual void diagonalScale(LevelData<FArrayBox>& a_rhs, bool a_kappaWeighted)
48  {
49  diagonalScale(a_rhs);
50  }
51 
52  virtual void setAlphaAndBeta(const Real& a_alpha,
53  const Real& a_beta)
54  {
55  m_alpha = a_alpha;
56  m_beta = a_beta;
57  defineRelCoef();
58  }
59 
60  virtual void diagonalScale(LevelData<FArrayBox>& a_rhs)
61  {
62  DisjointBoxLayout grids = a_rhs.disjointBoxLayout();
63  for (DataIterator dit = grids.dataIterator(); dit.ok(); ++dit)
64  {
65  for (int idir = 0; idir < SpaceDim; idir++)
66  {
67  int isrc = 0; int idst = idir; int inco = 1;
68  a_rhs[dit()].mult((*m_acoef)[dit()], isrc, idst, inco);
69  }
70  }
71  }
72 
74  {
75  DisjointBoxLayout grids = a_rhs.disjointBoxLayout();
76  for (DataIterator dit = grids.dataIterator(); dit.ok(); ++dit)
77  {
78  for (int idir = 0; idir < SpaceDim; idir++)
79  {
80  int isrc = 0; int idst = idir; int inco = 1;
81  a_rhs[dit()].divide((*m_acoef)[dit()], isrc, idst, inco);
82  }
83  }
84  }
85 
86  ///
87  /**
88  */
89  virtual ~ViscousTensorOp()
90  {
91 #if 0
92  // these explicitly de-reference the storage
97 #endif
98  }
99 
100  ///
101  /**
102  */
103  ViscousTensorOp(const DisjointBoxLayout& a_grids,
104  const DisjointBoxLayout& a_gridsFine,
105  const DisjointBoxLayout& a_gridsCoar,
106  const RefCountedPtr<LevelData<FluxBox> >& a_eta,
107  const RefCountedPtr<LevelData<FluxBox> >& a_lambda,
108  const RefCountedPtr<LevelData<FArrayBox> >& a_acoef,
109  Real a_alpha,
110  Real a_beta,
111  int a_refToFine,
112  int a_refToCoar,
113  const ProblemDomain& a_domain,
114  const Real& a_dxLevel,
115  const Real& a_dxCoar,
116  BCFunc a_bc,
117  Real a_safety = VTOP_DEFAULT_SAFETY,
118  Real a_relaxTolerance = 0.0,
119  int a_relaxMinIter = 1000
120  );
121 
122  ///
123  /**
124  */
125  ViscousTensorOp(const DisjointBoxLayout& a_grids,
126  const DisjointBoxLayout& a_gridsFine,
127  const DisjointBoxLayout& a_gridsCoar,
128  const RefCountedPtr<LevelData<FluxBox> >& a_eta,
129  const RefCountedPtr<LevelData<FluxBox> >& a_lambda,
130  const RefCountedPtr<LevelData<FArrayBox> >& a_acoef,
131  Real a_alpha,
132  Real a_beta,
133  int a_refToFine,
134  int a_refToCoar,
135  const ProblemDomain& a_domain,
136  const Real& a_dxLevel,
137  const Real& a_dxCoar,
138  BCHolder& a_bc,
139  Real a_safety = VTOP_DEFAULT_SAFETY,
140  Real a_relaxTolerance = 0.0,
141  int a_relaxMinIter = 1000
142  );
143 
144  ///
145  /**
146  */
147  void define(const DisjointBoxLayout& a_grids,
148  const DisjointBoxLayout& a_gridsFine,
149  const DisjointBoxLayout& a_gridsCoar,
150  const RefCountedPtr<LevelData<FluxBox> >& a_eta,
151  const RefCountedPtr<LevelData<FluxBox> >& a_lambda,
152  const RefCountedPtr<LevelData<FArrayBox> >& a_acoef,
153  Real a_alpha,
154  Real a_beta,
155  int a_refToFine,
156  int a_refToCoar,
157  const ProblemDomain& a_domain,
158  const Real& a_dxLevel,
159  const Real& a_dxCoar,
160  BCHolder& a_bc,
161  Real a_safety = VTOP_DEFAULT_SAFETY,
162  Real a_relaxTolerance = 0.0,
163  int a_relaxMinIter = 1000
164  );
165 
166  virtual void residual( LevelData<FArrayBox>& a_lhs,
167  const LevelData<FArrayBox>& a_phi,
168  const LevelData<FArrayBox>& a_rhs,
169  bool a_homogeneous = false);
170 
171  virtual void preCond( LevelData<FArrayBox>& a_correction,
172  const LevelData<FArrayBox>& a_residual);
173 
174  virtual void applyOp( LevelData<FArrayBox>& a_lhs,
175  const LevelData<FArrayBox>& a_phi,
176  bool a_homogeneous = false);
177  virtual void create( LevelData<FArrayBox>& a_lhs,
178  const LevelData<FArrayBox>& a_rhs);
179  virtual void createCoarsened( LevelData<FArrayBox>& a_lhs,
180  const LevelData<FArrayBox>& a_rhs,
181  const int& a_refRat);
182 
183  void reflux(const LevelData<FArrayBox>& a_phiFine,
184  const LevelData<FArrayBox>& a_phi,
186  AMRLevelOp<LevelData<FArrayBox> >* a_finerOp);
187 
188  //use at thy peril
189  virtual void getFlux(FluxBox& a_flux,
190  const LevelData<FArrayBox>& a_data,
191  const Box& a_grid,
192  const DataIndex& a_dit,
193  Real a_scale)
194  {
195  const FArrayBox& data = a_data[a_dit];
196  a_flux.define(a_grid, SpaceDim);
197  for (int idir = 0; idir < SpaceDim; idir++)
198  {
199  const FArrayBox& etaFace = (*m_eta)[a_dit][idir];
200  const FArrayBox& lambdaFace = (*m_lambda)[a_dit][idir];
201  const FArrayBox& gradData = m_grad[a_dit];
202  Box faceBox = a_flux[idir].box();
203  Box domFaceBox = surroundingNodes(m_domain.domainBox(), idir);
204  faceBox &= domFaceBox;
205  getFlux(a_flux[idir], data, gradData, etaFace, lambdaFace, faceBox, idir, 1);
206  a_flux[idir] *= a_scale;
207  }
208  }
210  const LevelData<FArrayBox>& a_phi)
211  {
212  this->fillGrad(a_phi);
213  computeOperatorNoBCs(a_lhs, a_phi);
214  }
215 
216  void getFlux(FArrayBox& a_flux,
217  const FArrayBox& a_data,
218  const FArrayBox& a_gradData,
219  const FArrayBox& a_etaFace,
220  const FArrayBox& a_lambdaFace,
221  const Box& a_facebox,
222  int a_dir,
223  int ref = 1);
224 
225  /// utility function which computes operator after all bc's have been set
227  const LevelData<FArrayBox>& a_phi);
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  bool a_skip_res = false );
332 
333  /** a_correction += I[h->h](a_coarseCorrection) */
334  virtual void AMRProlong(LevelData<FArrayBox>& a_correction,
335  const LevelData<FArrayBox>& a_coarseCorrection);
336 
337  /** a_residual = a_residual - L(a_correction, a_coarseCorrection) */
338  virtual void AMRUpdateResidual(LevelData<FArrayBox>& a_residual,
339  const LevelData<FArrayBox>& a_correction,
340  const LevelData<FArrayBox>& a_coarseCorrection);
341 
342  ///
343  /**
344  compute norm over all cells on coarse not covered by finer
345  */
346  virtual Real AMRNorm(const LevelData<FArrayBox>& a_coarseResid,
347  const LevelData<FArrayBox>& a_fineResid,
348  const int& a_refRat,
349  const int& a_ord);
350 
351  virtual void outputLevel(LevelData<FArrayBox>& a_rhs,
352  string& a_name)
353  {
354  string fname(a_name);
355  fname.append(".hdf5");
356 #ifdef CH_HDF5
357  writeLevelname(&a_rhs, fname.c_str());
358 #endif
359  }
360 
361  //debugging hook
362  virtual void outputAMR(Vector<LevelData<FArrayBox>* >& a_rhs, string& a_name)
363  {
364  // for now, klugs is to use outputLevel on level 0
365  outputLevel(*a_rhs[0], a_name);
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  /// prolongation type
463  /** make this public/static to make it easy to change, while
464  also ensuring that it remains constent across all instances
465  */
466  static int s_prolongType;
467 
468  /// access function
469 
473  Real getAlpha() const {return m_alpha;}
474  Real getBeta() const {return m_beta;}
475 
476 
477 protected:
478  void defineRelCoef();
487 
488  //b is a scalar in 2d, vector in 3d
489  int m_ncomp;
493  //relaxation coef
494 public: // I want to get this from an owner of this -mfa
496 protected:
497  // underrelaxation parameter
499  // stopping tolerance for relaxation
501  // minimum number of smooths before tolerance check
503 
508 
511  // will need these to do tangential gradient computations
515 
516 private:
517  ///weak construction is bad
519  {
520  MayDay::Error("invalid operator");
521  }
522  //copy constructor and operator= disallowed for all the usual reasons
524  {
525  MayDay::Error("invalid operator");
526  }
527  void operator=(const ViscousTensorOp& a_opin)
528  {
529  MayDay::Error("invalid operator");
530  }
531 
532 };
533 
534 ///
535 /**
536  Factory to create ViscousTensorOps
537 */
538 class ViscousTensorOpFactory: public AMRLevelOpFactory<LevelData<FArrayBox> >
539 {
540 public:
542  {
543 #if 0
544  for (int ivec = 0; ivec < m_eta.size(); ivec++)
545  {
549  }
550 #endif
551 
552  }
553 
555  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
556  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
557  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
558  Real a_alpha,
559  Real a_beta,
560  const Vector<int>& a_refRatios,
561  const ProblemDomain& a_domainCoar,
562  const Real& a_dxCoar,
563  BCFunc a_bc,
564  Real a_safety = VTOP_DEFAULT_SAFETY,
565  Real a_relaxTolerance = 0.0,
566  int a_relaxMinIter = 1000
567  );
568 
570  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
571  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
572  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
573  Real a_alpha,
574  Real a_beta,
575  const Vector<int>& a_refRatios,
576  const ProblemDomain& a_domainCoar,
577  const Real& a_dxCoar,
578  BCHolder a_bc,
579  Real a_safety = VTOP_DEFAULT_SAFETY,
580  Real a_relaxTolerance = 0.0,
581  int a_relaxMinIter = 1000
582  );
583 
584  virtual void define(const Vector<DisjointBoxLayout>& a_grids,
585  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_eta,
586  const Vector<RefCountedPtr<LevelData<FluxBox> > >& a_lambda,
587  const Vector<RefCountedPtr<LevelData<FArrayBox> > >& a_acoef,
588  Real a_alpha,
589  Real a_beta,
590  const Vector<int>& a_refRatios,
591  const ProblemDomain& a_domainCoar,
592  const Real& a_dxCoar,
593  BCHolder a_bc,
594  Real a_safety = VTOP_DEFAULT_SAFETY,
595  Real a_relaxTolerance = 0.0,
596  int a_relaxMinIter = 1000
597  );
598 
599  ///
600  virtual ViscousTensorOp*
601  MGnewOp(const ProblemDomain& a_FineindexSpace,
602  int depth,
603  bool homoOnly = true);
604 
605  ///
606  virtual ViscousTensorOp* AMRnewOp(const ProblemDomain& a_indexSpace);
607 
608  ///
609  virtual int refToFiner(const ProblemDomain&) const;
610 
611  /// set any relevant default values
612  void setDefaults();
613 
614  // 0 = arithmetic, 1 = harmonic
616 
617 
618 private:
626  // refinement to next coarser level
634 
635  ///weak construction is bad
637  {
638  MayDay::Error("invalid operator");
639  }
640  //copy constructor and operator= disallowed for all the usual reasons
642  {
643  MayDay::Error("invalid operator");
644  }
645 
646  void operator=(const ViscousTensorOpFactory& a_opin)
647  {
648  MayDay::Error("invalid operator");
649  }
650 };
651 
652 extern void
653 coarsenStuff(LevelData<FluxBox> & a_etaCoar,
654  LevelData<FluxBox> & a_lambdaCoar,
655  const LevelData<FluxBox> & a_etaFine,
656  const LevelData<FluxBox> & a_lambdaFine,
657  const int & a_refToDepth);
658 
659 #include "NamespaceFooter.H"
660 #endif
int m_ncomp
Definition: newViscousTensorOp.H:489
virtual void create(LevelData< FArrayBox > &a_lhs, const LevelData< FArrayBox > &a_rhs)
LevelData< FArrayBox > m_phic
Definition: newViscousTensorOp.H:622
ProblemDomain m_domain
Definition: newViscousTensorOp.H:492
Real m_alpha
Definition: newViscousTensorOp.H:482
Real getAlpha() const
Definition: newViscousTensorOp.H:473
static int s_coefficientAverageType
Definition: newViscousTensorOp.H:615
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: newViscousTensorOp.H:491
RefCountedPtr< LevelData< FluxBox > > m_eta
Definition: newViscousTensorOp.H:479
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
virtual int refToFiner(const ProblemDomain &) const
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
virtual ~ViscousTensorOp()
Definition: newViscousTensorOp.H:89
Definition: BCFunc.H:136
ViscousTensorOp()
weak construction is bad
Definition: newViscousTensorOp.H:518
Real m_beta
Definition: newViscousTensorOp.H:483
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
#define VTOP_DEFAULT_SAFETY
Definition: newViscousTensorOp.H:30
void homogeneousCFInterpTanGrad(LevelData< FArrayBox > &a_tanGrad, const LevelData< FArrayBox > &a_phi, const DataIndex &a_datInd, int a_idir, Side::LoHiSide a_hiorlo)
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)
Definition: newViscousTensorOp.H:44
virtual void relax(LevelData< FArrayBox > &a_e, const LevelData< FArrayBox > &a_residual, int iterations)
Vector< int > m_refRatios
Definition: newViscousTensorOp.H:627
Vector< Real > m_dx
Definition: newViscousTensorOp.H:625
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
BCHolder m_bc
Definition: newViscousTensorOp.H:486
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
LevelDataOps< FArrayBox > m_levelOps
Definition: newViscousTensorOp.H:505
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)
FourthOrderFillPatch m_interpWithCoarser
Definition: newViscousTensorOp.H:507
Definition: newViscousTensorOp.H:36
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)
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
Definition: newViscousTensorOp.H:43
virtual void getFlux(FluxBox &a_flux, const LevelData< FArrayBox > &a_data, const Box &a_grid, const DataIndex &a_dit, Real a_scale)
Definition: newViscousTensorOp.H:189
void fillGrad(const LevelData< FArrayBox > &a_phiFine)
These functions are part of the LevelTGA interface......
virtual void diagonalScale(LevelData< FArrayBox > &a_rhs, bool a_kappaWeighted)
Definition: newViscousTensorOp.H:47
virtual ViscousTensorOp * MGnewOp(const ProblemDomain &a_FineindexSpace, int depth, bool homoOnly=true)
Real m_beta
Definition: newViscousTensorOp.H:630
BCHolder m_bc
Definition: newViscousTensorOp.H:628
Vector< RefCountedPtr< LevelData< FArrayBox > > > m_acoef
Definition: newViscousTensorOp.H:621
LayoutData< CFIVS > m_loCFIVS[SpaceDim]
Definition: newViscousTensorOp.H:509
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: newViscousTensorOp.H:471
const int SpaceDim
Definition: SPACE.H:38
Definition: AMRMultiGrid.H:39
virtual void outputLevel(LevelData< FArrayBox > &a_rhs, string &a_name)
Definition: newViscousTensorOp.H:351
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: newViscousTensorOp.H:527
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)
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
Vector< ProblemDomain > m_domains
Definition: newViscousTensorOp.H:623
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: newViscousTensorOp.H:209
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)
LayoutData< TensorFineStencilSet > m_loTanStencilSets[SpaceDim]
Definition: newViscousTensorOp.H:513
virtual void restrictResidual(LevelData< FArrayBox > &a_resCoarse, LevelData< FArrayBox > &a_phiFine, const LevelData< FArrayBox > &a_rhsFine)
virtual Real dxCrse() const
Definition: newViscousTensorOp.H:250
virtual void diagonalScale(LevelData< FArrayBox > &a_rhs)
Definition: newViscousTensorOp.H:60
virtual Real dx() const
Definition: newViscousTensorOp.H:245
Real m_alpha
Definition: newViscousTensorOp.H:629
static int s_prolongType
prolongation type
Definition: newViscousTensorOp.H:466
prolongationType
Definition: newViscousTensorOp.H:40
virtual int refToCoarser()
Definition: newViscousTensorOp.H:291
virtual void divideByIdentityCoef(LevelData< FArrayBox > &a_rhs)
Definition: newViscousTensorOp.H:73
void setDefaults()
set any relevant default values
virtual void outputAMR(Vector< LevelData< FArrayBox > * > &a_rhs, string &a_name)
Definition: newViscousTensorOp.H:362
int m_refToCoar
Definition: newViscousTensorOp.H:484
Real m_dx
Definition: newViscousTensorOp.H:490
LayoutData< TensorFineStencilSet > m_hiTanStencilSets[SpaceDim]
Definition: newViscousTensorOp.H:512
double Real
Definition: REAL.H:33
LevelData< FArrayBox > m_grad
Definition: newViscousTensorOp.H:504
Box surroundingNodes(const Box &b, int dir)
Definition: Box.H:2161
Vector< IntVect > m_colors
Definition: newViscousTensorOp.H:514
Definition: newViscousTensorOp.H:538
Real m_relaxTolerance
Definition: newViscousTensorOp.H:632
ViscousTensorOp(const ViscousTensorOp &a_opin)
Definition: newViscousTensorOp.H:523
virtual void setAlphaAndBeta(const Real &a_alpha, const Real &a_beta)
Definition: newViscousTensorOp.H:52
LayoutData< CFIVS > m_hiCFIVS[SpaceDim]
Definition: newViscousTensorOp.H:510
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
Vector< RefCountedPtr< LevelData< FluxBox > > > m_eta
Definition: newViscousTensorOp.H:619
Copier m_exchangeCopier
Definition: newViscousTensorOp.H:506
RefCountedPtr< LevelData< FArrayBox > > getACoef() const
Definition: newViscousTensorOp.H:472
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
Vector< DisjointBoxLayout > m_boxes
Definition: newViscousTensorOp.H:624
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)
Real getBeta() const
Definition: newViscousTensorOp.H:474
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
int m_relaxMinIter
Definition: newViscousTensorOp.H:633
int m_relaxMinIter
Definition: newViscousTensorOp.H:502
RefCountedPtr< LevelData< FluxBox > > m_lambda
Definition: newViscousTensorOp.H:480
void operator=(const ViscousTensorOpFactory &a_opin)
Definition: newViscousTensorOp.H:646
Definition: DataIndex.H:114
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: newViscousTensorOp.H:636
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)
RefCountedPtr< LevelData< FArrayBox > > m_acoef
Definition: newViscousTensorOp.H:481
Real m_safety
Definition: newViscousTensorOp.H:498
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.
virtual Real norm(const LevelData< FArrayBox > &a_x, int a_ord)
Real m_relaxTolerance
Definition: newViscousTensorOp.H:500
Real m_safety
Definition: newViscousTensorOp.H:631
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()
virtual Real AMRNorm(const LevelData< FArrayBox > &a_coarseResid, const LevelData< FArrayBox > &a_fineResid, const int &a_refRat, const int &a_ord)
LevelData< FArrayBox > m_relaxCoef
Definition: newViscousTensorOp.H:495
Definition: AMRMultiGrid.H:233
Fourth-order interpolation in time and space to ghost cells.
Definition: FourthOrderFillPatch.H:27
void coarsenStuff(LevelData< FluxBox > &a_etaCoar, LevelData< FluxBox > &a_lambdaCoar, const LevelData< FluxBox > &a_etaFine, const LevelData< FluxBox > &a_lambdaFine, const int &a_refToDepth)
virtual void scale(LevelData< FArrayBox > &a_lhs, const Real &a_scale)
virtual ~ViscousTensorOpFactory()
Definition: newViscousTensorOp.H:541
Definition: newViscousTensorOp.H:42
virtual Real dotProduct(const LevelData< FArrayBox > &a_1, const LevelData< FArrayBox > &a_2)
RefCountedPtr< LevelData< FluxBox > > getEta() const
access function
Definition: newViscousTensorOp.H:470
virtual void AMRUpdateResidual(LevelData< FArrayBox > &a_residual, const LevelData< FArrayBox > &a_correction, const LevelData< FArrayBox > &a_coarseCorrection)
Vector< RefCountedPtr< LevelData< FluxBox > > > m_lambda
Definition: newViscousTensorOp.H:620
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)
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: newViscousTensorOp.H:485
ViscousTensorOpFactory(const ViscousTensorOpFactory &a_opin)
Definition: newViscousTensorOp.H:641