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