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

stokes.hpp

Go to the documentation of this file.
00001 //************************************************************************************//
00002 // Module       : stokes_solver.hpp
00003 // Date         : 8/4/02 (DLR)
00004 // Copyright    : 2002-2006 Copyright University Corporation for Atmospheric
00005 //                Research
00006 // Description  : Encapsulates the methods and data associated with
00007 //                the solver for the Stokes problem. The problem solved is
00008 //                  H _v - G p = f,
00009 //                subject to the constraint that
00010 //                  Div _v = 0;
00011 //                Here, H is the Helmholtz operator,
00012 //                  H =  p L  + q M
00013 //                where p=nu and q=c0/dt are constants, L is the discrete (weak)
00014 //                Laplacian operator, and M is the mass matrix. _v is the
00015 //                velocity vector, and p is the pressure field and G is the
00016 //                weak Stokes gradient operator; updated  values of _v and p are 
00017 //                the result. 
00018 //
00019 //                This class assumes that the pressure and velocity reside on 
00020 //                different grids within the same element, using the P_N-P_(n-2)
00021 //                formalism, in which the pressure grid lies on Gaussian nodes.
00022 // Derived From : none.
00023 // Modifications:
00024 //************************************************************************************//
00025 #if !defined(STOKES_SOLVER_HPP)
00026 #define STOKES_SOLVER_HPP 
00027 
00028 #include "gs.hpp"
00029 #include "cg.hpp"
00030 #include "gttlist.hpp"
00031 #include "gfieldlist.hpp"
00032 #include "stokesop.hpp"
00033 #include "schurlapop.hpp"
00034 #include "uzawalapop.hpp"
00035 #include "helmholtzop.hpp"
00036 #include "pcblockjac_helm.hpp"
00037 #include "ntree_adapt.hpp"
00038 
00039 enum STOKES_TYPE {STOKES_SCHUR_DELP, STOKES_STEADY_UZAWA};
00040 extern char *sStokesType[];
00041 class StokesSolver
00042 {
00043 public:
00044                             StokesSolver(GFieldList *ulist[], GINT nf, GElemList *uelems, GElemList *pelems, STOKES_TYPE t);
00045                            ~StokesSolver();
00046 
00047          void               SetComm(GS *ggs);                                                // Set global gather scatter operator
00048          GCHandle           SetCommHandle(GCHandle hIn) ;                                    // Sets active gather/scatter handle 
00049          GBOOL              SetPreconditioner(GINT  iwhich, GPC itype);                      // Set v-solve preconditioners
00050          void               SetVBdyData(GINT  idir, GVecList *bdy_vals);                     // Set bdy condition data
00051          void               SetDen(const GDOUBLE rho);                                       // Set const. density, rho
00052          void               SetVisc(const GDOUBLE nu);                                       // Set kinemtaic viscosity, nu
00053          void               SetVisc(const GDOUBLE nu, GINT idir);                            // Set kinemtaic viscosity, nu
00054          void               Setc0  (const GDOUBLE c0);                                       // Helmholtz op st H = nuL + c0/dt M 
00055          void               SetFilter(GLinOpList *filter);                                   // Set filter object
00056          void               InitPress(GBOOL bInit);                                          // Set flag to initialize P
00057          CG                 *GetSolver(GINT iwhich);                                         // Get Vel. solver for component idir
00058          GINT                GetNumIterations(GINT iwhich);                                  // Get num U_idir iterations
00059          GINT                GetErrorType(GINT  iwhich);                                     // Get U_idir error condition
00060          GDOUBLE             GetError(GINT iwhich);                                          // Get U_idir error magnitude
00061          GDOUBLE             GetMinError(GINT iwhich);                                       // Get min U_idir error
00062          GDOUBLE             GetMaxError(GINT iwhich);                                       // Get max U_idir error
00063          GDOUBLE             GetDivMax(GINT  iLevel);                                        // Get max(divergence V ) for tim
00064 
00065          GLinOpList         *GetPreconditioner(GINT  iwhich);                                // Get u-solve precond for comp. idir
00066          GDOUBLE             GetDivMax(GVector *vn[], GINT nv, GINT  ie);                    // Get extremal(Div vn) on element ie
00067          GDOUBLE             GetVisc(GINT  idir);                                            // Get viscosity in direction idir
00068 
00069          GLinOpList         *GetStokesOp(GINT idir, GBOOL btranspose=FALSE);                 // Get Stokes operators
00070          GLinOpList         *GetPseudoLap();                                                 // Get pseudo Laplacian operator
00071 
00072 
00073          void                DivV(GFieldList *divv, GFieldList *v[], GINT nv );              // Compute Div.V 
00074          GBOOL               Solve(GDOUBLE dt, 
00075                                    const GINT  itmpRHS, const GINT  iLevelFinal);            // Solve with RHS itmpRHS within var_list
00076          GBOOL               ResetExpandables();                                             // Reset expandable data after mesh change
00077          void                UpdateSolver();                                                 // Update solvers, if any due to mesh change
00078 
00079 private:
00080          // Methods:
00081          void              Init();
00082          GBOOL             InitPrecond(const GINT  iwhich);
00083          GBOOL             Classical(const GINT  iStoreLevel);
00084          GBOOL             Uzawa(const GINT  iStoreLevel);
00085          GBOOL             SchurDelP(const GINT  iStoreLevel);
00086          GBOOL             ComputeBdyVectors();
00087          GBOOL             DoFilter();
00088          void              UpdatePrecond(GDOUBLE dt);
00089          void              DeleteDynamic();
00090          void              ResetErrors();
00091 
00092          // Field and other data:
00093          STOKES_TYPE       itype_;
00094          GPC               pc_type_   [GDIM+1];
00095          GINT              irank_;
00096          GINT              nelems_;
00097          GBOOL             bInitReqd_;
00098          GBOOL             bPrecond_   [GDIM+1];
00099          GBOOL             bPInit_;
00100          GDOUBLE           dt_;
00101          GDOUBLE           dtlast_;
00102          GDOUBLE           c0_;
00103          GDOUBLE           nu_         [GDIM];
00104          GDOUBLE           rho_;
00105          GDOUBLE           irho_;
00106          GFieldList        *var_list_  [GDIM+1];
00107          GVecList          pu_         [GDIM];
00108          GVecList          Hdiag_;
00109          GVecList          utmp_       [GDIM];
00110          GVecList          ptmp_       [GDIM];
00111          GVecList          g_          [GDIM];
00112          GVecList          pu_rhs_    [GDIM];
00113          GVecList          pp_;
00114          GVecList          *ubdyvals_  [GDIM];
00115          CG                *cg_        [GDIM+1];
00116          GCHandle          hDSOp;
00117          GElemList         *uelems_;
00118          GElemList         *pelems_;
00119 
00120          // Math operators
00121          GLinOpList      H_       ;   // Helmholtz operator acting on v_
00122          GLinOpList      D_ [GDIM];   // i-derivative operator
00123          GLinOpList      DT_[GDIM];   // (i-derivative operator) ^T
00124          GLinOpList      E_;          // Laplacian op. arising from Uzawa or Schur decomposition 
00125          GLinOpList      pc_[GDIM+1]; // p, and v-preconditioners
00126          GLinOpList      *filter_;    // filter operator
00127  
00128          // Solver return vals:
00129          GINT            niter_    [GDIM+1];
00130          GINT            ierror_   [GDIM+1];
00131          GDOUBLE         error_    [GDIM+1];
00132          GDOUBLE         min_error_[GDIM+1];
00133          GDOUBLE         max_error_[GDIM+1];
00134 
00135          // Communication:
00136          GS              *gsop;       // communication operator
00137 
00138 };
00139 
00140 #endif

Generated on Wed Dec 21 16:00:48 2005 for Geophysics & Astrophysics Spectral Element Adaptive Refinement (GASpAR) 2D Code by  doxygen 1.4.4