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 
00062 
00064 
00068   void scaleHelmCoeff(Real a_scale);
00069 
00071 
00074   LevelOp* new_levelop() const;
00075 
00077 
00081   void define(
00082               const DisjointBoxLayout& Ba,
00083               const DisjointBoxLayout* base_ba,
00084               Real  DxLevel, 
00085               int refratio,
00086               const Box& domf,
00087               bool a_homogeneousOnly= false,
00088               int a_ncomp = 1);
00089 
00090 
00092 
00096   void define(
00097               const DisjointBoxLayout& Ba,
00098               const DisjointBoxLayout* base_ba,
00099               Real  DxLevel, 
00100               int refratio,
00101               const ProblemDomain& domf,
00102               bool a_homogeneousOnly= false,
00103               int a_ncomp = 1);
00104 
00106 
00110   void define(
00111               const LevelOp* opfine,
00112               int refratio);
00113 
00115   HelmholtzOp();
00116 
00118   ~HelmholtzOp();
00119 
00121 
00127   void smooth(
00128               LevelData<FArrayBox>& phi,
00129               const LevelData<FArrayBox>& rhs
00130               );
00131 
00132 
00134 
00137   virtual void levelPreconditioner(
00138                                    LevelData<FArrayBox>& a_phihat,
00139                                    const LevelData<FArrayBox>& a_rhshat
00140                                    );
00141 
00142 
00144 
00148   void applyOpI(
00149                 LevelData<FArrayBox>& phi,
00150                 const LevelData<FArrayBox>* phiCoarse,
00151                 LevelData<FArrayBox>& LOfPhi
00152                 );
00153 
00155 
00158   void applyOpIcfHphys(
00159                        LevelData<FArrayBox>& phi,
00160                        const LevelData<FArrayBox>* phiCoarse,
00161                        LevelData<FArrayBox>& LOfPhi
00162                        );
00163 
00165 
00169   void applyOpH(
00170                 LevelData<FArrayBox>& phi,
00171                 LevelData<FArrayBox>& LOfPhi
00172                 );
00173 
00175 
00179   void applyOpHcfIphys(
00180                        LevelData<FArrayBox>& phi,
00181                        LevelData<FArrayBox>& LOfPhi
00182                        );
00183 
00185 
00189   void CFInterp(
00190                 LevelData<FArrayBox>& phi,
00191                 const LevelData<FArrayBox>& phiCoarse
00192                 );
00193 
00194 
00196 
00198   void homogeneousCFInterp(LevelData<FArrayBox>& phi);
00199 
00201   void setDomainGhostBC(const DomainGhostBC& a_dombcin);
00202 
00204   void setBottomSmoother(const BaseBottomSmoother& a_bottomSmoother);
00205 
00206 
00208 
00211   void
00212   homogeneousCFInterp(LevelData<FArrayBox>& phif, 
00213                       const DataIndex& a_datIndex, 
00214                       int idir, 
00215                       Side::LoHiSide hiorlo);
00216 
00218 
00222   void bottomSmoother(LevelData<FArrayBox>& phi,
00223                       const LevelData<FArrayBox>& rhs);
00224 
00226   bool isDefined() const;
00227 
00229 
00235   void getFlux(
00236                FArrayBox& flux, 
00237                const FArrayBox& data, 
00238                const DataIndex& a_datInd,
00239                int dir);
00240 
00241 
00242 protected:
00243   // boundary conditons
00244   DomainGhostBC m_domghostbc;
00245 
00246   //domain of fine grid
00247   ProblemDomain m_domain;
00248 
00249   //the grids at the current level
00250   DisjointBoxLayout m_grids;
00251 
00252   // Copier object that knows how to perform exchange operations on 
00253   // LevelData objects defined on m_grids
00254   Copier m_exchangeCopier;
00255 
00256   /* DisjointBoxLayout for next coarser level
00257      this is == NULL if there is no coarser level */
00258   DisjointBoxLayout m_baseBA;
00259 
00260 
00261   // refinement ratio between this and the next coarser level
00262   int m_refRatio;
00263 
00264   //mesh spacing at this level
00265   Real m_dxLevel;
00266 
00267   //mesh spacing at the next coarser level
00268   Real m_dxCrse;
00269 
00270   // number of components
00271   int m_ncomp;
00272 
00273   /*
00274     coarse-fine information between this level
00275     and the next coarser level
00276   */
00277   QuadCFInterp m_quadCFI;
00278 
00280   /* bottom smoother object
00281    */
00282   BaseBottomSmoother* m_bottom_smoother_ptr;
00283 
00284 
00285   //has full define function been called?
00286   bool m_isDefined;
00287 
00288   //has full define function been called?
00289   bool m_isBCDefined;
00290 
00291   //is inhomogeneous CF interpolation possible?
00292   bool m_ihcfiEnabled;
00293 
00294   //is the helmholtz coefficient defined?
00295   bool m_hcoeffDefined;
00296 
00297   //intvectsets for coarse-fine interpolation
00298 
00299   LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00300   LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00301 
00302   //the alpha in (I+alpha*laplacian)phi = rho
00303   Real m_helmCoeff;
00304 
00305 private:
00306   //internally useful 
00307   void
00308   levelGSRB(
00309             LevelData<FArrayBox>& a_phi, 
00310             const LevelData<FArrayBox>& a_rhs);
00311 
00312 
00313   void
00314   interpOnIVS(
00315               LevelData<FArrayBox>& a_phif, 
00316               const FArrayBox& a_phistar, 
00317               const DataIndex& dFine,
00318               const int a_idir,
00319               const Side::LoHiSide a_hiorlo,
00320               const IntVectSet& a_interpIVS);
00321 
00322   void clearMemory();
00323 
00324   void setDefaultValues();
00325 
00326 };
00327 
00328 #endif

Generated on Thu Aug 29 11:05:45 2002 for Chombo&INS by doxygen1.2.16