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 #include "BaseHelmholtzOp.H"
00048 
00050 
00052 class HelmholtzOp: public BaseHelmholtzOp
00053 {
00054 
00055 public:
00057 
00060   void setHelmCoeff(Real helmcoeff_a);
00061 
00062 
00064 
00069   void scaleHelmCoeff(Real a_scale);
00070 
00071 
00073 
00076   void setAlpha(Real a_alpha);
00077 
00078 
00079 
00081 
00084   void scaleAlpha(Real a_scale);
00085 
00087 
00089   void scaleBeta(Real a_scale);
00090   
00092 
00095   LevelOp* new_levelop() const;
00096 
00098 
00102   void define(
00103               const DisjointBoxLayout& Ba,
00104               const DisjointBoxLayout* base_ba,
00105               Real  DxLevel, 
00106               int refratio,
00107               const Box& domf,
00108               bool a_homogeneousOnly= false,
00109               int a_ncomp = 1);
00110 
00111 
00113 
00117   void define(
00118               const DisjointBoxLayout& Ba,
00119               const DisjointBoxLayout* base_ba,
00120               Real  DxLevel, 
00121               int refratio,
00122               const ProblemDomain& domf,
00123               bool a_homogeneousOnly= false,
00124               int a_ncomp = 1);
00125 
00127 
00131   void define(
00132               const LevelOp* opfine,
00133               int refratio);
00134 
00136   HelmholtzOp();
00137 
00139   ~HelmholtzOp();
00140 
00142 
00148   void smooth(
00149               LevelData<FArrayBox>& phi,
00150               const LevelData<FArrayBox>& rhs
00151               );
00152 
00153 
00155 
00158   virtual void levelPreconditioner(
00159                                    LevelData<FArrayBox>& a_phihat,
00160                                    const LevelData<FArrayBox>& a_rhshat
00161                                    );
00162 
00163 
00165 
00169   void applyOpI(
00170                 LevelData<FArrayBox>& phi,
00171                 const LevelData<FArrayBox>* phiCoarse,
00172                 LevelData<FArrayBox>& LOfPhi
00173                 );
00174 
00176 
00179   void applyOpIcfHphys(
00180                        LevelData<FArrayBox>& phi,
00181                        const LevelData<FArrayBox>* phiCoarse,
00182                        LevelData<FArrayBox>& LOfPhi
00183                        );
00184 
00186 
00190   void applyOpH(
00191                 LevelData<FArrayBox>& phi,
00192                 LevelData<FArrayBox>& LOfPhi
00193                 );
00194 
00196 
00200   void applyOpHcfIphys(
00201                        LevelData<FArrayBox>& phi,
00202                        LevelData<FArrayBox>& LOfPhi
00203                        );
00204 
00206 
00210   void CFInterp(
00211                 LevelData<FArrayBox>& phi,
00212                 const LevelData<FArrayBox>& phiCoarse
00213                 );
00214 
00215 
00217 
00219   void homogeneousCFInterp(LevelData<FArrayBox>& phi);
00220 
00222   void setDomainGhostBC(const DomainGhostBC& a_dombcin);
00223 
00225   void setBottomSmoother(const BaseBottomSmoother& a_bottomSmoother);
00226 
00227 
00229 
00232   void
00233   homogeneousCFInterp(LevelData<FArrayBox>& phif, 
00234                       const DataIndex& a_datIndex, 
00235                       int idir, 
00236                       Side::LoHiSide hiorlo);
00237 
00239 
00243   void bottomSmoother(LevelData<FArrayBox>& phi,
00244                       const LevelData<FArrayBox>& rhs);
00245 
00247   bool isDefined() const;
00248 
00250 
00256   void getFlux(
00257                FArrayBox& flux, 
00258                const FArrayBox& data, 
00259                const DataIndex& a_datInd,
00260                int dir);
00261 
00262 
00263 protected:
00264   // boundary conditons
00265   DomainGhostBC m_domghostbc;
00266 
00267   //domain of fine grid
00268   ProblemDomain m_domain;
00269 
00270   //the grids at the current level
00271   DisjointBoxLayout m_grids;
00272 
00273   // Copier object that knows how to perform exchange operations on 
00274   // LevelData objects defined on m_grids
00275   Copier m_exchangeCopier;
00276 
00277   /* DisjointBoxLayout for next coarser level
00278      this is == NULL if there is no coarser level */
00279   DisjointBoxLayout m_baseBA;
00280 
00281 
00282   // refinement ratio between this and the next coarser level
00283   int m_refRatio;
00284 
00285   //mesh spacing at this level
00286   Real m_dxLevel;
00287 
00288   //mesh spacing at the next coarser level
00289   Real m_dxCrse;
00290 
00291   // number of components
00292   int m_ncomp;
00293 
00294   /*
00295     coarse-fine information between this level
00296     and the next coarser level
00297   */
00298   QuadCFInterp m_quadCFI;
00299 
00301   /* bottom smoother object
00302    */
00303   BaseBottomSmoother* m_bottom_smoother_ptr;
00304 
00305 
00306   //has full define function been called?
00307   bool m_isDefined;
00308 
00309   //has full define function been called?
00310   bool m_isBCDefined;
00311 
00312   //is inhomogeneous CF interpolation possible?
00313   bool m_ihcfiEnabled;
00314 
00315   //is the helmholtz coefficient defined?
00316   bool m_hcoeffDefined;
00317 
00318   //intvectsets for coarse-fine interpolation
00319 
00320   LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00321   LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00322 
00323   //the beta in (alpha*I+beta*laplacian)phi = rho
00324   Real m_helmCoeff;
00325 
00326   // the alpha in (alpha*I +beta*laplacian)phi = rho
00327   Real m_alphaCoeff;
00328 
00329 private:
00330   //internally useful 
00331   void
00332   levelGSRB(
00333             LevelData<FArrayBox>& a_phi, 
00334             const LevelData<FArrayBox>& a_rhs);
00335 
00336 
00337  //  void
00338 //   interpOnIVS(
00339 //               LevelData<FArrayBox>& a_phif, 
00340 //               const FArrayBox& a_phistar, 
00341 //               const DataIndex& dFine,
00342 //               const int a_idir,
00343 //               const Side::LoHiSide a_hiorlo,
00344 //               const IntVectSet& a_interpIVS);
00345   void
00346   interpOnIVSHomo(
00347               LevelData<FArrayBox>& a_phif, 
00348               const DataIndex& dFine,
00349               const int a_idir,
00350               const Side::LoHiSide a_hiorlo,
00351               const IntVectSet& a_interpIVS);
00352 
00353   void clearMemory();
00354 
00355   void setDefaultValues();
00356 
00357 };
00358 
00359 #endif

Generated on Wed Apr 16 14:26:49 2003 for Chombo by doxygen1.2.16