00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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);
00048 GCHandle SetCommHandle(GCHandle hIn) ;
00049 GBOOL SetPreconditioner(GINT iwhich, GPC itype);
00050 void SetVBdyData(GINT idir, GVecList *bdy_vals);
00051 void SetDen(const GDOUBLE rho);
00052 void SetVisc(const GDOUBLE nu);
00053 void SetVisc(const GDOUBLE nu, GINT idir);
00054 void Setc0 (const GDOUBLE c0);
00055 void SetFilter(GLinOpList *filter);
00056 void InitPress(GBOOL bInit);
00057 CG *GetSolver(GINT iwhich);
00058 GINT GetNumIterations(GINT iwhich);
00059 GINT GetErrorType(GINT iwhich);
00060 GDOUBLE GetError(GINT iwhich);
00061 GDOUBLE GetMinError(GINT iwhich);
00062 GDOUBLE GetMaxError(GINT iwhich);
00063 GDOUBLE GetDivMax(GINT iLevel);
00064
00065 GLinOpList *GetPreconditioner(GINT iwhich);
00066 GDOUBLE GetDivMax(GVector *vn[], GINT nv, GINT ie);
00067 GDOUBLE GetVisc(GINT idir);
00068
00069 GLinOpList *GetStokesOp(GINT idir, GBOOL btranspose=FALSE);
00070 GLinOpList *GetPseudoLap();
00071
00072
00073 void DivV(GFieldList *divv, GFieldList *v[], GINT nv );
00074 GBOOL Solve(GDOUBLE dt,
00075 const GINT itmpRHS, const GINT iLevelFinal);
00076 GBOOL ResetExpandables();
00077 void UpdateSolver();
00078
00079 private:
00080
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
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
00121 GLinOpList H_ ;
00122 GLinOpList D_ [GDIM];
00123 GLinOpList DT_[GDIM];
00124 GLinOpList E_;
00125 GLinOpList pc_[GDIM+1];
00126 GLinOpList *filter_;
00127
00128
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
00136 GS *gsop;
00137
00138 };
00139
00140 #endif