Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

HelmholtzOp.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 // DTGraves, Weds, July 21, 1999
00028 
00029 #ifndef _HELMHOLTZOP_H_
00030 #define _HELMHOLTZOP_H_
00031 
00032 #include <iostream>
00033 #include <cmath>
00034 #include <assert.h>
00035 #include <cstdlib>
00036 #include <REAL.H>
00037 #include <IntVect.H>
00038 #include <Box.H>
00039 #include <DisjointBoxLayout.H>
00040 #include <FArrayBox.H>
00041 #include "GhostBC.H"
00042 #include "LevelOp.H"
00043 #include "QuadCFInterp.H"
00044 #include "CFIVS.H"
00045 #include "Copier.H"
00046 #include "BaseBottomSmoother.H"
00047 
00048 
00050 
00052 class HelmholtzOp: public LevelOp
00053 {
00054 
00055 public:
00057 
00060   void setHelmCoeff(Real helmcoeff_a);
00061 
00063 
00066   LevelOp* new_levelop() const;
00067 
00069 
00073   void define(
00074               const DisjointBoxLayout& Ba,
00075               const DisjointBoxLayout* base_ba,
00076               Real  DxLevel, 
00077               int refratio,
00078               const Box& domf,
00079               bool a_homogeneousOnly= false,
00080               int a_ncomp = 1);
00081 
00082 
00084 
00088   void define(
00089               const DisjointBoxLayout& Ba,
00090               const DisjointBoxLayout* base_ba,
00091               Real  DxLevel, 
00092               int refratio,
00093               const ProblemDomain& domf,
00094               bool a_homogeneousOnly= false,
00095               int a_ncomp = 1);
00096 
00098 
00102   void define(
00103               const LevelOp* opfine,
00104               int refratio);
00105 
00107   HelmholtzOp();
00108 
00110   ~HelmholtzOp();
00111 
00113 
00119   void smooth(
00120               LevelData<FArrayBox>& phi,
00121               const LevelData<FArrayBox>& rhs
00122               );
00123 
00124 
00126 
00129   virtual void levelPreconditioner(
00130                                    LevelData<FArrayBox>& a_phihat,
00131                                    const LevelData<FArrayBox>& a_rhshat
00132                                    );
00133 
00134 
00136 
00140   void applyOpI(
00141                 LevelData<FArrayBox>& phi,
00142                 const LevelData<FArrayBox>* phiCoarse,
00143                 LevelData<FArrayBox>& LOfPhi
00144                 );
00145 
00147 
00150   void applyOpIcfHphys(
00151                        LevelData<FArrayBox>& phi,
00152                        const LevelData<FArrayBox>* phiCoarse,
00153                        LevelData<FArrayBox>& LOfPhi
00154                        );
00155 
00157 
00161   void applyOpH(
00162                 LevelData<FArrayBox>& phi,
00163                 LevelData<FArrayBox>& LOfPhi
00164                 );
00165 
00167 
00171   void applyOpHcfIphys(
00172                        LevelData<FArrayBox>& phi,
00173                        LevelData<FArrayBox>& LOfPhi
00174                        );
00175 
00177 
00181   void CFInterp(
00182                 LevelData<FArrayBox>& phi,
00183                 const LevelData<FArrayBox>& phiCoarse
00184                 );
00185 
00186 
00188 
00190   void homogeneousCFInterp(LevelData<FArrayBox>& phi);
00191 
00193   void setDomainGhostBC(const DomainGhostBC& a_dombcin);
00194 
00196   void setBottomSmoother(const BaseBottomSmoother& a_bottomSmoother);
00197 
00198 
00200 
00203   void
00204   homogeneousCFInterp(LevelData<FArrayBox>& phif, 
00205                       const DataIndex& a_datIndex, 
00206                       int idir, 
00207                       Side::LoHiSide hiorlo);
00208 
00210 
00214   void bottomSmoother(LevelData<FArrayBox>& phi,
00215                       const LevelData<FArrayBox>& rhs);
00216 
00218   bool isDefined() const;
00219 
00221 
00227   void getFlux(
00228                FArrayBox& flux, 
00229                const FArrayBox& data, 
00230                const DataIndex& a_datInd,
00231                int dir);
00232 
00233 
00234 protected:
00235   // boundary conditons
00236   DomainGhostBC m_domghostbc;
00237 
00238   //domain of fine grid
00239   ProblemDomain m_domain;
00240 
00241   //the grids at the current level
00242   DisjointBoxLayout m_grids;
00243 
00244   // Copier object that knows how to perform exchange operations on 
00245   // LevelData objects defined on m_grids
00246   Copier m_exchangeCopier;
00247 
00248   /* DisjointBoxLayout for next coarser level
00249      this is == NULL if there is no coarser level */
00250   DisjointBoxLayout m_baseBA;
00251 
00252 
00253   // refinement ratio between this and the next coarser level
00254   int m_refRatio;
00255 
00256   //mesh spacing at this level
00257   Real m_dxLevel;
00258 
00259   //mesh spacing at the next coarser level
00260   Real m_dxCrse;
00261 
00262   // number of components
00263   int m_ncomp;
00264 
00265   /*
00266     coarse-fine information between this level
00267     and the next coarser level
00268   */
00269   QuadCFInterp m_quadCFI;
00270 
00272   /* bottom smoother object
00273    */
00274   BaseBottomSmoother* m_bottom_smoother_ptr;
00275 
00276 
00277   //has full define function been called?
00278   bool m_isDefined;
00279 
00280   //has full define function been called?
00281   bool m_isBCDefined;
00282 
00283   //is inhomogeneous CF interpolation possible?
00284   bool m_ihcfiEnabled;
00285 
00286   //is the helmholtz coefficient defined?
00287   bool m_hcoeffDefined;
00288 
00289   //intvectsets for coarse-fine interpolation
00290 
00291   LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00292   LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00293 
00294   //the alpha in (I+alpha*laplacian)phi = rho
00295   Real m_helmCoeff;
00296 
00297 private:
00298   //internally useful 
00299   void
00300   levelGSRB(
00301             LevelData<FArrayBox>& a_phi, 
00302             const LevelData<FArrayBox>& a_rhs);
00303 
00304 
00305   void
00306   interpOnIVS(
00307               LevelData<FArrayBox>& a_phif, 
00308               const FArrayBox& a_phistar, 
00309               const DataIndex& dFine,
00310               const int a_idir,
00311               const Side::LoHiSide a_hiorlo,
00312               const IntVectSet& a_interpIVS);
00313 
00314   void clearMemory();
00315 
00316   void setDefaultValues();
00317 
00318 };
00319 
00320 #endif

Generated on Tue Jul 2 10:42:20 2002 for Chombo by doxygen1.2.16