PISM, A Parallel Ice Sheet Model stable 0.4.1779

src/base/stressbalance/SSAFEM_Forward.hh

Go to the documentation of this file.
00001 // Copyright (C) 2009--2011 Jed Brown and Ed Bueler and Constantine Khroulev and David Maxwell
00002 //
00003 // This file is part of PISM.
00004 //
00005 // PISM is free software; you can redistribute it and/or modify it under the
00006 // terms of the GNU General Public License as published by the Free Software
00007 // Foundation; either version 2 of the License, or (at your option) any later
00008 // version.
00009 //
00010 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00012 // FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00013 // details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with PISM; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef _SSAFEM_FORWARD_H_
00020 #define _SSAFEM_FORWARD_H_
00021 
00022 #include "SSAFEM.hh"
00023 
00025 class SSAFEM_Forward : public SSAFEM
00026 {
00027 
00028 public:
00029 
00030   SSAFEM_Forward(IceGrid &g, IceBasalResistancePlasticLaw &b, IceFlowLaw &i, 
00031                  EnthalpyConverter &e,
00032                  const NCConfigVariable &c) 
00033            : SSAFEM(g,b,i,e,c), 
00034              m_KSP(0), m_KSP_B(0), m_MatA(0), m_MatB(0),
00035              m_VecU(0), m_VecZ2(0),
00036              m_VecZ(0), m_VecRHS2(0),
00037              m_VecV(0), m_VecRHS(0),
00038              m_reassemble_T_matrix_needed(true),
00039              m_forward_F_needed(true)
00040   {
00041     allocate_ksp();
00042   };
00043 
00044   virtual ~SSAFEM_Forward()
00045   {
00046     deallocate_ksp();
00047   }
00048 
00049   PetscErrorCode allocate_ksp();  
00050   PetscErrorCode deallocate_ksp();
00051 
00052   PetscErrorCode set_initial_velocity_guess(IceModelVec2V &v);
00053 
00054   PetscErrorCode set_tauc(IceModelVec2S &tauc );
00055 
00056   PetscErrorCode setup_vars();
00057 
00058   PetscErrorCode solveF(IceModelVec2V &result);
00059 
00060   PetscErrorCode solveT( IceModelVec2S &d, IceModelVec2V &result);
00061 
00062   PetscErrorCode solveTStar( IceModelVec2V &r, IceModelVec2S &result);
00063 
00064   PetscErrorCode domainIP(IceModelVec2S &a, IceModelVec2S &b, PetscScalar *OUTPUT);
00065 
00066   PetscErrorCode rangeIP(IceModelVec2V &a, IceModelVec2V &b, PetscScalar *OUTPUT);
00067 
00068   PetscErrorCode domainIP(Vec a, Vec b, PetscScalar *OUTPUT);
00069 
00070   PetscErrorCode rangeIP(Vec a, Vec b, PetscScalar *OUTPUT);
00071 
00072 protected:
00073 
00074   PetscErrorCode domainIP_core(PetscReal **A, PetscReal**B, PetscScalar *OUTPUT);
00075 
00076   PetscErrorCode rangeIP_core(PISMVector2 **A, PISMVector2**B, PetscScalar *OUTPUT);
00077   
00078   PetscErrorCode solveF_core();
00079 
00080   PetscErrorCode assemble_T_matrix();
00081 
00082   PetscErrorCode assemble_DomainNorm_matrix();
00083 
00084   PetscErrorCode assemble_T_rhs( PISMVector2 **gvel, PetscReal **gdtau, PISMVector2 **grhs);
00085 
00086   PetscErrorCode assemble_TStarA_rhs( PISMVector2 **R, PISMVector2 **RHS);
00087 
00088   PetscErrorCode assemble_TStarB_rhs( PISMVector2 **Z, PISMVector2 **U, PetscScalar **RHS );
00089   
00090   // PetscErrorCode assemble_TStar_rhs();
00091 
00092   KSP m_KSP, m_KSP_B;
00094   Mat m_MatA, m_MatB;
00095   Vec m_VecU;
00097   Vec m_VecZ2, m_VecZ, m_VecRHS2;
00099   Vec m_VecV, m_VecRHS;
00100 
00101   bool m_reassemble_T_matrix_needed, m_forward_F_needed;
00102 };
00103 
00104 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines