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

TensorOp.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 _TENSOROP_H_
00053 #define _TENSOROP_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 "LevelOp.H"
00069 #include "TensorCFInterp.H"
00070 #include "CFIVS.H"
00071 #include "Copier.H"
00072 #include "BaseBottomSmoother.H"
00073 
00075 
00077 class TensorOp: public LevelOp
00078 {
00079 public:
00080 
00082 
00085   virtual LevelOp* new_levelop() const;
00086 
00088   virtual bool isDefined() const;
00089 
00091 
00095   void define(
00096               const DisjointBoxLayout& Ba,
00097               const DisjointBoxLayout* base_ba,
00098               Real  DxLevel, 
00099               int refratio,
00100               const Box& domf,
00101               bool a_homogeneousOnly=false,
00102               int ncomp = 1);
00103 
00105 
00109   void define(
00110               const DisjointBoxLayout& Ba,
00111               const DisjointBoxLayout* base_ba,
00112               Real  DxLevel, 
00113               int refratio,
00114               const ProblemDomain& domf,
00115               bool a_homogeneousOnly=false,
00116               int ncomp = 1);
00117 
00119 
00123   void define(
00124               const LevelOp* opfine,
00125               int refratio);
00126 
00128   TensorOp();
00129 
00131   ~TensorOp();
00132 
00134 
00140   void smooth(
00141               LevelData<FArrayBox>& a_phi,
00142               const LevelData<FArrayBox>& a_rhs);
00143 
00144   
00145 
00147 
00150   virtual void levelPreconditioner(
00151                                    LevelData<FArrayBox>& a_phihat,
00152                                    const LevelData<FArrayBox>& a_rhshat
00153                                    );
00154 
00156 
00160   void applyOpI(
00161                 LevelData<FArrayBox>& a_phi,
00162                 const LevelData<FArrayBox>* a_phiCoarse,
00163                 LevelData<FArrayBox>& a_LOfPhi);
00164 
00166 
00170   void applyOpIcfHphys(
00171                        LevelData<FArrayBox>& a_phi,
00172                        const LevelData<FArrayBox>* a_phiCoarse,
00173                        LevelData<FArrayBox>& a_LOfPhi);
00174 
00176 
00180   void applyOpH(
00181                 LevelData<FArrayBox>& a_phi,
00182                 LevelData<FArrayBox>& a_LOfPhi);
00183 
00185 
00188   void CFInterp(LevelData<FArrayBox>& a_phi,
00189                 const LevelData<FArrayBox>& a_phiCoarse
00190                 );
00191 
00193 
00197   void applyOpHcfIphys(
00198                        LevelData<FArrayBox>& a_phi,
00199                        LevelData<FArrayBox>& a_lOfPhi);
00200 
00201 
00203 
00206   void homogeneousCFInterp(LevelData<FArrayBox>& a_phi);
00207 
00209   void setDomainGhostBC(const DomainGhostBC& a_dombcin);
00210 
00212   void setTanGradBC(const DomainGhostBC& a_dombcIn);
00213 
00215   void setBottomSmoother(const BaseBottomSmoother& a_bottomSmoother);
00216 
00218 
00221   void
00222   homogeneousCFInterpPhi(LevelData<FArrayBox>& a_phif, 
00223                          const DataIndex& a_datInd, 
00224                          int a_idir, 
00225                          Side::LoHiSide a_hiorlo);
00226 
00228 
00232   void homogeneousCFInterpTanGrad(LevelData<FArrayBox>& a_tanGrad,
00233                                   const LevelData<FArrayBox>& a_phi,
00234                                   const DataIndex& a_datInd,
00235                                   int a_idir,
00236                                   Side::LoHiSide a_hiorlo);
00237 
00239 
00243   void bottomSmoother(
00244                       LevelData<FArrayBox>& a_phi,
00245                       const LevelData<FArrayBox>& a_rhs);
00246 
00248 
00254   void getFlux(
00255                FArrayBox& flux, 
00256                const FArrayBox& a_data, 
00257                const DataIndex& a_datInd,
00258                int a_dir);
00259 
00261   virtual void setConvergenceMetric(Real a_metric, int a_comp);
00262 
00263 
00265   const LevelData<FArrayBox>& getTanGrad() const;
00266 
00267 protected:
00268 
00269   // boundary conditons
00270   DomainGhostBC m_domghostbc;
00271 
00272   // boundary conditions for tangential component of gradient
00273   DomainGhostBC m_tangradbc;
00274 
00275   //domain of fine grid
00276   ProblemDomain m_domain;
00277 
00278   //the grids at the current level
00279   DisjointBoxLayout m_grids;
00280 
00281   // Copier object that knows how to perform exchange operations on 
00282   // LevelData objects defined on m_grids
00283   Copier m_exchangeCopier;
00284 
00285   /* DisjointBoxLayout for next coarser level
00286      this is == NULL if there is no coarser level */
00287   DisjointBoxLayout m_baseBA;
00288 
00289   // number of components
00290   int m_ncomp;
00291 
00292   // refinement ratio between this and the next coarser level
00293   int m_refRatio;
00294 
00295   //mesh spacing at this level
00296   Real m_dxLevel;
00297 
00298   //mesh spacing at next coarser level
00299   Real m_dxCrse;
00300 
00301   /*
00302     coarse-fine information between this level
00303     and the next coarser level
00304   */
00305   TensorCFInterp m_quadCFI;
00306 
00307    
00309   /* bottom smoother object
00310    */
00311   BaseBottomSmoother* m_bottom_smoother_ptr;
00312 
00313   //contains tangential gradient info
00314   LevelData<FArrayBox> m_tanGrad;
00315 
00316   //has full define function been called?
00317   bool m_isDefined;
00318 
00319   //has bc been defined?
00320   bool m_isBCDefined;
00321 
00322   // has bc for tangential gradients been defined?
00323   bool m_isGradBCDefined;
00324 
00325   //is inhomogeneous CF interpolation possible?
00326   bool m_ihcfiEnabled;
00327 
00328   LayoutData<CFIVS> m_loCFIVS[SpaceDim];
00329   LayoutData<CFIVS> m_hiCFIVS[SpaceDim];
00330 
00331   // will need these to do tangential gradient computations
00332   LayoutData<TensorFineStencilSet> m_hiTanStencilSets[SpaceDim];
00333   LayoutData<TensorFineStencilSet> m_loTanStencilSets[SpaceDim];
00334 
00335 private:
00336   //internally useful functions
00337   void
00338   levelGSRB(
00339             LevelData<FArrayBox>& a_phi, 
00340             const LevelData<FArrayBox>& a_rhs);
00341   void
00342   interpPhiOnIVS(
00343                  LevelData<FArrayBox>& a_phif, 
00344                  const FArrayBox& a_phistar, 
00345                  const DataIndex& dFine,
00346                  const int a_idir,
00347                  const Side::LoHiSide a_hiorlo,
00348                  const IntVectSet& a_interpIVS);
00349   
00350   void
00351   computeFaceDiv(LevelData<FluxBox>& a_div,
00352                  const LevelData<FArrayBox>& a_vel,
00353                  const LevelData<FArrayBox>& a_tanGrad);
00354 
00355   void
00356   computeFaceDiv(FArrayBox& a_div,
00357                  const FArrayBox& a_vel,
00358                  const FArrayBox& a_tanGrad,
00359                  const DataIndex& a_dataInd,
00360                  int faceDir);
00361 
00362   // computes tangential gradients of a_vel and stores in m_tanGrad
00363   void
00364   computeTanGradInterior(const LevelData<FArrayBox>& a_vel);
00365 
00366   // computes tangential gradients of a_vel and stores in m_tanGrad
00367   void
00368   computeTanGradInterior(const FArrayBox& a_vel,
00369                          const DataIndex& a_dataInd);
00370 
00371 
00372   // computes gradient of a_vel in a_gradDir and stores in m_tanGrad
00373   void
00374   computeTanGradInterior(const FArrayBox& a_vel,
00375                          const DataIndex& a_dataInd,
00376                          int a_gradDir);
00377 
00378   void clearMemory();
00379 
00380   void setDefaultValues();
00381 
00382 };
00383 
00384 #endif

Generated on Wed Oct 5 13:52:09 2005 for Chombo&AMRSelfGravity by  doxygen 1.4.1