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

burgers.hpp

Go to the documentation of this file.
00001 //************************************************************************************//
00002 // Module       : burgers.hpp
00003 // Date         : 8/4/03 (DLR)
00004 // Copyright    : 2003-2006 Copyright University Corporation for Atmospheric
00005 //                Research
00006 // Description  : Encapsulates the methods and data associated with
00007 //                the solver for the multi-d Burgers equation. The problem solved is
00008 //                du/dt + u.Del u + -  nu_x  Del_x^2 u -nu_y Del_y^2 u = f(x,y;t)
00009 // Derived From : none.
00010 // Modifications: 7/21/03: converted to linked-list-based data structures
00011 //************************************************************************************//
00012 #if !defined(BURGERS_SOLVER_HPP)
00013 #define BURGERS_SOLVER_HPP 
00014 
00015 #include "gstepper.hpp"
00016 #include "cg.hpp"
00017 #include "gtlist.hpp"
00018 #include "gttlist.hpp"
00019 #include "glinoplist.hpp"
00020 #include "gobjlist.hpp"
00021 #include "gelemlist.hpp"
00022 #include "gfieldlist.hpp"
00023 #include "helmholtzop.hpp"
00024 #include "gadvect.hpp"
00025 #include "massop.hpp"
00026 #include "vectorop.hpp"
00027 #include "ntree_adapt.hpp"
00028 #include "ab.hpp"
00029 #include "ext.hpp"
00030 #include "evforce.hpp"
00031 
00032 
00033 class BurgersSolver : public GStepper
00034 {
00035 public:
00036   enum TIME_EVOLTYPE {TE_OIFS=0, TE_ABBDF, TE_EXBDF, TE_EXBDF_Weak};
00037 
00038 
00039                            BurgersSolver(GElemList *elems);
00040                            BurgersSolver(GElemList *elems, GFieldList *ulist[], GINT  nlist, 
00041                                          GFieldList **cadv, GINT  *iadv, GINT  nadv);
00042                           ~BurgersSolver();
00043 
00044          GBOOL             Step(GDOUBLE dt);                                                // Take one time step
00045          GDOUBLE           GetIntegTime();                                                // Get total integration time
00046          CG                *GetSolver(GINT  idir);                                        // Get pointer to iterative solver
00047          LinOp             *GetPreconditioner(GINT  idir, GINT  eid);                     // Get preconditioner for component idir, element eid
00048          GINT              GetNumIterations(GINT  idir);                                  // Get no. solver iterations
00049          GINT              GetErrorType(GINT  idir);                                      // Get solver error type
00050          GDOUBLE           GetError(GINT  idir);                                          // Get solver error
00051          GDOUBLE           GetMinError(GINT  idir);                                       // Get solver min error
00052          GDOUBLE           GetMaxError(GINT  idir);                                       // Get solver max error
00053 
00054 
00055          void              SetFilter(GLinOpList *filter);                                 // Set filter
00056          void              SetElemList(GElemList *elems);                                 // Set element list
00057          void              SetEvolType(TIME_EVOLTYPE itype);                              // Set time stepping scheme
00058          void              SetTime(GDOUBLE time);                                         // Set integration start time
00059          void              SetNSubcycles(GINT nsub);                                      // Set number of OIFS subcycles
00060 
00061          GBOOL             SetFields(GFieldList *ulist[], GINT  nfields, 
00062                                      GFieldList **cadv, GINT  ncadv, 
00063                                      GINT  *iadv, GINT  nadv);                            // Set field list
00064          void              SetPreconditioner(GPC itype);                                  // Set preconditioners for all fields
00065          void              SetAdvectDim(GINT  nto);                                       // Set advection direction(s)
00066          void              SetComm(GS *ggs);                                              // Set global gather scatter operator
00067          GCHandle          SetCommHandle(GCHandle hIn) ;                                  // Initializes comm with existing handle 
00068          void              SetVisc(const GDOUBLE nu, const GINT  idir=0);                 // Set kinematic viscosity, nu_idir
00069          void              SetAdvOrder(GINT  iorder);                                     // Sets order of adv. term
00070          void              SetAMOrder(GINT  iorder_ab);                                   // Sets order of Adams-Moulton diff. approx. 
00071          void              SetBDFOrder(GINT  iorder);                                     // Sets order of BDF time approx.
00072          void              SetVBdyData (GINT  idir, GVecList *bdy_vals);                  // Set bcs for component idir
00073          void              SetDoAdvection(GBOOL bDoAdv);                                  // Set advection flag
00074          void              SetTimestepHistory(GDBuffer *dthist);                          // Set timestep hist. buffer
00075 
00076 private:
00077          // Methods:
00078          GBOOL             DoNormalStep(GDOUBLE dt);                                      // Step with GAdvect oprator
00079 //       GBOOL             StepABBDFAM(GDOUBLE dt);                                       // Adams-Bashforth, backward time diff, + Adams-Moulton form
00080          GBOOL             DoDiffusion(GDOUBLE dt, const GINT  tmpLevel);                 // Do diffusion terms
00081 //       GBOOL             StepTimeIndepRKK(GDOUBLE dt);                                  // Use RK2 to step advection part
00082 //       GBOOL             StepLeapfrog(GDOUBLE dt);                                      // Use leapfrog to step 
00083          GBOOL             ResetExpandables(GFieldList *u1[], GINT  nf);                  // Reset lists
00084          GBOOL             CreateCompDynamic(GINT  ncomps);                               // Create dynamically-allocated list-dependent quantities
00085          GBOOL             CreateAdvDynamic(GINT  nadv);                                  // Create dynamically-allocated list-dependent quantities
00086          void              DeleteDynamic();
00087          GBOOL             Advect(GDOUBLE dt, GINT  &iLevel);                             // Do advection term using AB/BDF; store in temp level iLevel
00088 //       GBOOL             AdvectAMFE(GDOUBLE dt, GINT  &iLevel);                         // Do advection term using AM+Forward Euler ; store in temp level iLevel
00089 
00090          GBOOL             DoForcing  (GDOUBLE dt, GSHORT   iLevel);                      // Do state-indep. forcing: update tmp iLevel field
00091 
00092          GBOOL             InitPrecond();                                                 // Create/initialize preconditioners 
00093          void              UpdatePrecond(GDOUBLE dt);                                     // Update preconditioners for time step
00094          void              UpdateSolver();                                                // Update solver for time step
00095          void              ResetErrors();                                                 // Resets solver errors
00096          void              BuildCoeffs();                                                 // Builds coefficients
00097          GBOOL             ElemListChange();                                              // Checks if elemlist has changed
00098          GBOOL             DoFilter();                                                    // Carries out filter operation, if any
00099 
00100          // Field and other data:
00101          GCHandle          hDSOp;
00102          TIME_EVOLTYPE     itime_type_;
00103          SI_FORCE_TYPE     isiforce_type_;
00104          GPC               *upc_type_;
00105          GBOOL             bConstAdvVel_;
00106          GBOOL             bPrecond_;
00107          GBOOL             bDoAdvection_;
00108          GBOOL             bInitReqd_;
00109          GBOOL             bDoDiffusion_;
00110          GINT              nfields_;
00111          GINT              nadv_;
00112          GINT              *iadv_;
00113          GINT              nelems_;
00114          GINT              iorderadv_;
00115          GINT              iorderbdf_;
00116          GINT              ntimelevels_;
00117          GINT              iorderam_;
00118          GINT              icycle_;
00119          GDOUBLE           maxCFL_;
00120          GDOUBLE           dtlast_;
00121          GDOUBLE           time_;
00122          GDOUBLE           *nu_ ;
00123          GDOUBLE           Lcoeff_[GDIM];
00124          GDOUBLE           Mcoeff_;
00125          GDOUBLE           *mu_;
00126          GDOUBLE           gamma0_;
00127          GDOUBLE           c_am [4][4];
00128          GFieldList        **u_list_;    // entry pointers to fields
00129          GVecList          **ubdyvals_;
00130          GVecList          *up_;           // GVector          ***up_;
00131          GVecList          *up_rhs_;       // GVector          **up_rhs_;
00132          GVecList          *Nj_;           // GVector          ***Nj_;
00133          GVecList          Hdiag_;         // GVector          **Hdiag_;
00134          GVecList          uadv_[3];
00135          GFieldList        *cadv_[3];
00136          GElemList         *gelems_;
00137          GAdvect           *advect_;
00138 
00139          // Solver return vals:
00140          GINT              *niter_    ;
00141          GINT              *ierror_   ;
00142          GDOUBLE           *error_    ;
00143          GDOUBLE           *min_error_;
00144          GDOUBLE           *max_error_;
00145 
00146          // Linear solvers:
00147          CG                **cgu_;
00148 
00149          // Math operators
00150          GLinOpList        M_;             // HelmholtzOp       **H_;
00151          GLinOpList        H_;             // HelmholtzOp       **H_;
00152          GLinOpList        *upc_;          // GVector         ***upc_;
00153          GVecOpList        vecop_;         // VectorOp         **vecop_;    // Vector collocation operator -- gives advection
00154          GLinOpList        *filter_;
00155 
00156          // Communication:
00157          GS               *gsop;       // communication (gather-scatter) operator
00158 };
00159 
00160 #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