Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

GradDivOp.H

Go to the documentation of this file.
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 #ifndef _GRADDIVOP_H_
00053 #define _GRADDIVOP_H_
00054 
00055 #include <iostream>
00056 #include <cmath>
00057 #include "SPACE.H"
00058 #include <cstdlib>
00059 #include <REAL.H>
00060 #include <IntVect.H>
00061 #include <Box.H>
00062 #include <DisjointBoxLayout.H>
00063 #include <LevelData.H>
00064 #include <BaseFab.H>
00065 #include "FArrayBox.H"
00066 #include "FluxBox.H"
00067 #include "GhostBC.H"
00068 #include "TensorCFInterp.H"
00069 #include "CFIVS.H"
00070 #include "Copier.H"
00071 
00073 
00077 class GradDivOp
00078 {
00079 public:
00080 
00082    bool isDefined() const;
00083 
00085 
00089   void define(
00090               const DisjointBoxLayout& Ba,
00091               const DisjointBoxLayout* base_ba,
00092               Real  DxLevel, 
00093               int refratio,
00094               const Box& domf,
00095               bool a_homogeneousOnly=false,
00096               int ncomp = 1);
00097 
00099 
00103   void define(
00104               const DisjointBoxLayout& Ba,
00105               const DisjointBoxLayout* base_ba,
00106               Real  DxLevel, 
00107               int refratio,
00108               const ProblemDomain& domf,
00109               bool a_homogeneousOnly=false,
00110               int ncomp = 1);
00111 
00113 
00117   void define(
00118               const GradDivOp* opfine,
00119               int refratio);
00120   
00122   GradDivOp();
00123 
00125   ~GradDivOp();
00126 
00127 
00129 
00133   void applyOpI(LevelData<FArrayBox>& a_LOfU,
00134                 LevelData<FArrayBox>& a_U,
00135                 const LevelData<FArrayBox>* a_UCoarse);
00136 
00138 
00142   void applyOpIcfHphys(LevelData<FArrayBox>& a_LOfU,
00143                        LevelData<FArrayBox>& a_U,
00144                        const LevelData<FArrayBox>* a_UCoarse);
00145                        
00146 
00148 
00152   void applyOpH(LevelData<FArrayBox>& a_LOfU,
00153                 LevelData<FArrayBox>& a_U);
00154                 
00155 
00157 
00160   void CFInterp(LevelData<FArrayBox>& a_U,
00161                 const LevelData<FArrayBox>& a_UCoarse
00162                 );
00163 
00165 
00169   void applyOpHcfIphys(LevelData<FArrayBox>& a_LofU,
00170                        LevelData<FArrayBox>& a_U);
00171   
00172 
00173 
00175 
00177   void computeFaceDiv(LevelData<FluxBox>& a_divU,
00178                       LevelData<FArrayBox>& a_U,
00179                       const LevelData<FArrayBox>* a_UCoarse);
00180 
00181 
00183 
00185   void computeFaceDivH(LevelData<FluxBox>& a_divU,
00186                        LevelData<FArrayBox>& a_U);
00187                       
00188 
00190 
00193   void homogeneousCFInterp(LevelData<FArrayBox>& a_U);
00194 
00196   void setDomainGhostBC(const DomainGhostBC& a_dombcin);
00197 
00199 
00205   void setTanGradBC(const DomainGhostBC& a_dombcIn);
00206 
00208 
00211   void
00212   homogeneousCFInterpU(LevelData<FArrayBox>& a_Uf, 
00213                          const DataIndex& a_datInd, 
00214                          int a_idir, 
00215                          Side::LoHiSide a_hiorlo);
00216 
00218 
00222   void homogeneousCFInterpTanGrad(LevelData<FArrayBox>& a_tanGrad,
00223                                   const LevelData<FArrayBox>& a_U,
00224                                   const DataIndex& a_datInd,
00225                                   int a_idir,
00226                                   Side::LoHiSide a_hiorlo);
00227 
00229 
00235   void getFlux(
00236                FArrayBox& flux, 
00237                const FArrayBox& a_data, 
00238                const DataIndex& a_datInd,
00239                int a_dir);
00240 
00242   const LevelData<FArrayBox>& getTanGrad() const;
00243 
00244 protected:
00245 
00246   // boundary conditons
00247   DomainGhostBC m_domghostbc;
00248 
00249   // boundary conditions for tangential component of gradient
00250   DomainGhostBC m_tangradbc;
00251 
00252   //domain of fine grid
00253   ProblemDomain m_domain;
00254 
00255   //the grids at the current level
00256   DisjointBoxLayout m_grids;
00257 
00258   // Copier object that knows how to perform exchange operations on 
00259   // LevelData objects defined on m_grids
00260   Copier m_exchangeCopier;
00261 
00262   /* DisjointBoxLayout for next coarser level
00263      this is == NULL if there is no coarser level */
00264   DisjointBoxLayout m_baseBA;
00265 
00266   // number of components
00267   int m_ncomp;
00268 
00269   // refinement ratio between this and the next coarser level
00270   int m_refRatio;
00271 
00272   //mesh spacing at this level
00273   Real m_dxLevel;
00274 
00275   //mesh spacing at next coarser level
00276   Real m_dxCrse;
00277 
00278   /*
00279     coarse-fine information between this level
00280     and the next coarser level
00281   */
00282   TensorCFInterp m_quadCFI;
00283 
00284   //contains tangential gradient info
00285   LevelData<FArrayBox> m_tanGrad;
00286 
00287   //has full define function been called?
00288   bool m_isDefined;
00289 
00290   //has bc been defined?
00291   bool m_isBCDefined;
00292 
00293   // has bc for tangential gradients been defined?
00294   bool m_isGradBCDefined;
00295 
00296   //is inhomogeneous CF interpolation possible?
00297   bool m_ihcfiEnabled;
00298 
00299   LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00300   LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00301 
00302   // will need these to do tangential gradient computations
00303   LayoutData<TensorFineStencilSet> m_hiTanStencilSets[SpaceDim];
00304   LayoutData<TensorFineStencilSet> m_loTanStencilSets[SpaceDim];
00305 
00306 private:
00307   //internally useful functions
00308 
00309   void
00310   interpUOnIVS(
00311                  LevelData<FArrayBox>& a_Uf, 
00312                  const FArrayBox& a_Ustar, 
00313                  const DataIndex& dFine,
00314                  const int a_idir,
00315                  const Side::LoHiSide a_hiorlo,
00316                  const IntVectSet& a_interpIVS);
00317   
00318 
00319   void
00320   computeFaceDiv(LevelData<FluxBox>& a_div,
00321                  const LevelData<FArrayBox>& a_vel,
00322                  const LevelData<FArrayBox>& a_tanGrad);
00323 
00324 
00325   void
00326   computeFaceDiv(FArrayBox& a_div,
00327                  const FArrayBox& a_vel,
00328                  const FArrayBox& a_tanGrad,
00329                  const DataIndex& a_dataInd,
00330                  int faceDir);
00331 
00332   // computes tangential gradients of a_vel and stores in m_tanGrad
00333   void
00334   computeTanGradInterior(const LevelData<FArrayBox>& a_vel);
00335 
00336   // computes tangential gradients of a_vel and stores in m_tanGrad
00337   void
00338   computeTanGradInterior(const FArrayBox& a_vel,
00339                          const DataIndex& a_dataInd);
00340 
00341 
00342   // computes gradient of a_vel in a_gradDir and stores in m_tanGrad
00343   void
00344   computeTanGradInterior(const FArrayBox& a_vel,
00345                          const DataIndex& a_dataInd,
00346                          int a_gradDir);
00347 
00348   void clearMemory();
00349 
00350   void setDefaultValues();
00351 
00352 };
00353 
00354 #endif

Generated on Wed Oct 5 12:08:14 2005 for Chombo&AMRIdealMHD by  doxygen 1.4.1