00001 /* _______ __
00002 / ___/ / ___ __ _ / / ___
00003 / /__/ _ \/ _ \/ V \/ _ \/ _ \
00004 \___/_//_/\___/_/_/_/_.__/\___/
00005 */
00006 // CHOMBO Copyright (c) 2000-2004, The Regents of the University of
00007 // California, through Lawrence Berkeley National Laboratory (subject to
00008 // receipt of any required approvals from U.S. Dept. of Energy). All
00009 // rights reserved.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 //
00014 // (1) Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 // (2) Redistributions in binary form must reproduce the above copyright
00017 // notice, this list of conditions and the following disclaimer in the
00018 // documentation and/or other materials provided with the distribution.
00019 // (3) Neither the name of Lawrence Berkeley National Laboratory, U.S.
00020 // Dept. of Energy nor the names of its contributors may be used to endorse
00021 // or promote products derived from this software without specific prior
00022 // written permission.
00023 //
00024 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00026 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00027 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00028 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00029 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00030 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 //
00036 // You are under no obligation whatsoever to provide any bug fixes,
00037 // patches, or upgrades to the features, functionality or performance of
00038 // the source code ("Enhancements") to anyone; however, if you choose to
00039 // make your Enhancements available either publicly, or directly to
00040 // Lawrence Berkeley National Laboratory, without imposing a separate
00041 // written license agreement for such Enhancements, then you hereby grant
00042 // the following license: a non-exclusive, royalty-free perpetual license
00043 // to install, use, modify, prepare derivative works, incorporate into
00044 // other computer software, distribute, and sublicense such Enhancements or
00045 // derivative works thereof, in binary and source code form.
00046 //
00047 // TRADEMARKS. Product and company names mentioned herein may be the
00048 // trademarks of their respective owners. Any rights not expressly granted
00049 // herein are reserved.
00050 //
00051
00052 // DTGraves, Weds, July 21, 1999
00053
00054 #ifndef _POISSONOP_H_
00055 #define _POISSONOP_H_
00056
00057 #include <iostream>
00058 #include <cmath>
00059 #include <cassert>
00060 #include <cstdlib>
00061
00062 #include "REAL.H"
00063 #include "IntVect.H"
00064 #include "Box.H"
00065 #include "DisjointBoxLayout.H"
00066 #include "LevelData.H"
00067 #include "BaseFab.H"
00068 #include "FArrayBox.H"
00069 #include "QuadCFInterp.H"
00070 #include "Copier.H"
00071
00072 #include "GhostBC.H"
00073 #include "LevelOp.H"
00074 #include "CFIVS.H"
00075 #include "BaseBottomSmoother.H"
00076
00078
00080 class PoissonOp: public LevelOp
00081 {
00082 public:
00084 PoissonOp();
00085
00087 ~PoissonOp();
00088
00090
00092 virtual LevelOp* new_levelop() const;
00093
00095
00097 void levelGSMC(LevelData<FArrayBox>& a_phi,
00098 const LevelData<FArrayBox>& a_rhs);
00099
00101 virtual bool isDefined() const;
00102
00104
00107 void define(const DisjointBoxLayout& a_grids,
00108 const DisjointBoxLayout* a_baseBAPtr,
00109 Real a_dxLevel,
00110 int a_refRatio,
00111 const ProblemDomain& a_domain,
00112 bool a_homogeneousOnly=false,
00113 int a_ncomp = 1);
00114
00116
00118 void define(const LevelOp* a_opfine,
00119 int a_reftoFine);
00120
00122
00126 void define(const DisjointBoxLayout& a_grids,
00127 const DisjointBoxLayout* a_baseBAPtr,
00128 Real a_dxLevel,
00129 int a_refRatio,
00130 const Box& a_domain,
00131 bool a_homogeneousOnly=false,
00132 int a_ncomp = 1);
00133
00135
00139 void smooth(LevelData<FArrayBox>& a_phi,
00140 const LevelData<FArrayBox>& a_rhs);
00141
00143
00146 virtual void levelPreconditioner(LevelData<FArrayBox>& a_phihat,
00147 const LevelData<FArrayBox>& a_rhshat);
00148
00150
00154 void applyOpI(LevelData<FArrayBox>& a_phi,
00155 const LevelData<FArrayBox>* a_phicPtr,
00156 LevelData<FArrayBox>& a_lofPhi);
00157
00159
00163 void applyOpIcfHphys(LevelData<FArrayBox>& a_phi,
00164 const LevelData<FArrayBox>* a_phicPtr,
00165 LevelData<FArrayBox>& a_lofPhi);
00166
00168
00172 void applyOpH(LevelData<FArrayBox>& a_phi,
00173 LevelData<FArrayBox>& a_lofPhi);
00174
00176
00178 void CFInterp(LevelData<FArrayBox>& a_phif,
00179 const LevelData<FArrayBox>& a_phic);
00180
00182
00186 void applyOpHcfIphys(LevelData<FArrayBox>& a_phi,
00187 LevelData<FArrayBox>& a_lOfPhi);
00188
00190
00192 void homogeneousCFInterp(LevelData<FArrayBox>& a_phif);
00193
00195 void setDomainGhostBC(const DomainGhostBC& a_dombcin);
00196
00198 void setBottomSmoother(const BaseBottomSmoother& a_bottomSmoother);
00199
00201
00203 void
00204 homogeneousCFInterp(LevelData<FArrayBox>& a_phif,
00205 const DataIndex& a_datInd,
00206 int a_idir,
00207 Side::LoHiSide a_hiorlo);
00208
00210
00212 void bottomSmoother(LevelData<FArrayBox>& a_phi,
00213 const LevelData<FArrayBox>& a_rhs);
00214
00216
00221 void getFlux(FArrayBox& a_fineFlux,
00222 const FArrayBox& a_data,
00223 const DataIndex& a_datInd,
00224 int a_dir);
00225
00227 virtual void setConvergenceMetric(Real a_metric, int a_comp);
00228
00229 protected:
00233 DomainGhostBC m_domghostbc;
00234
00238 ProblemDomain m_domain;
00239
00243 DisjointBoxLayout m_grids;
00244
00249 Copier m_exchangeCopier;
00250
00255 DisjointBoxLayout m_baseBA;
00256
00260 int m_ncomp;
00261
00265 int m_refRatio;
00266
00270 Real m_dxLevel;
00271
00275 Real m_dxCrse;
00276
00277 /*
00278 Object which performs Coarse-fine interpolation between this level
00279 and the next coarser level
00280 */
00281 QuadCFInterp m_quadCFI;
00282
00286 BaseBottomSmoother* m_bottomSmootherPtr;
00287
00291 bool m_isDefined;
00292
00296 bool m_isBCDefined;
00297
00301 bool m_ihcfiEnabled;
00302
00306 LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00310 LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00311
00312 private:
00313 // Internally useful functions
00314 void levelGSRB(LevelData<FArrayBox>& a_phi,
00315 const LevelData<FArrayBox>& a_rhs);
00316
00317 // void interpOnIVS(LevelData<FArrayBox>& a_phif,
00318 // const FArrayBox& a_phistar,
00319 // const DataIndex& a_datInd,
00320 // const int a_idir,
00321 // const Side::LoHiSide a_hiorlo,
00322 // const IntVectSet& a_interpIVS);
00323
00324 void interpOnIVSHomo(LevelData<FArrayBox>& a_phif,
00325 const DataIndex& a_datInd,
00326 const int a_idir,
00327 const Side::LoHiSide a_hiorlo,
00328 const IntVectSet& a_interpIVS);
00329
00330 void clearMemory();
00331
00332 void setDefaultValues();
00333 };
00334
00335 #endif
1.2.16