BISICLES AMR ice sheet model  0.9
PetscAMRSolver.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _PETSCAMRSOLVERSOLVER_H_
12 #define _PETSCAMRSOLVERSOLVER_H_
13 
14 #include "PetscCompGridVTO.H"
15 #ifdef CH_USE_PETSC
16 #include "petsc.h"
17 #include "petscmat.h"
18 #include "petscksp.h"
19 #include "petscviewer.h"
20 #endif
21 
22 #include "NamespaceHeader.H"
23 
24 class LinearizedVTOp;
25 // solver class for VTO operators
27 {
28  static PetscErrorCode ksp_monitor_pout(KSP ksp, PetscInt it, PetscReal rnorm ,void *ctx)
29  {
30  pout() << " KSP:: iteration = " << it << " residual norm = " << rnorm << std::endl;
31  return 0;
32  }
33 
34 public:
35  PetscAMRSolver(int a_verb=0);
36 
37  virtual ~PetscAMRSolver() {;}
39 
44  virtual PetscErrorCode solve_mfree( Vector<LevelData<FArrayBox>*>& a_phi,
45  const Vector<LevelData<FArrayBox>*>& a_rhs,
46  LinearizedVTOp *a_op );
47 
48  virtual PetscErrorCode solve( Vector<LevelData<FArrayBox>*>& a_phi,
49  const Vector<LevelData<FArrayBox>*>& a_rhs );
50 
51  static PetscErrorCode apply_mfree(Mat A, Vec x, Vec f);
52 
53  void plot(const string, const Vector<LevelData<FArrayBox>*>& a_phi);
54  PetscErrorCode setCoords(KSP, const Vector<LevelData<FArrayBox>*>& a_phi);
55 
57  Vector<LevelData<FArrayBox>*> m_phi_mfree;
58  Vector<LevelData<FArrayBox>*> m_Lphi_mfree;
60  PetscCompGridVTO m_petscCompMat; // this is specific for VTO for now, should make PetscCompGrid*
61  int m_verbose;
62 };
63 
64 #include "NamespaceFooter.H"
65 #endif
void plot(const string, const Vector< LevelData< FArrayBox > *> &a_phi)
Definition: PetscAMRSolver.cpp:189
virtual PetscErrorCode solve(Vector< LevelData< FArrayBox > *> &a_phi, const Vector< LevelData< FArrayBox > *> &a_rhs)
Definition: PetscAMRSolver.cpp:127
PetscCompGridVTO m_petscCompMat
Definition: PetscAMRSolver.H:60
LinearizedVTOp * m_op_mfree
Definition: PetscAMRSolver.H:56
PetscAMRSolver(int a_verb=0)
Definition: PetscAMRSolver.cpp:18
Definition: JFNKSolver.H:43
Vector< LevelData< FArrayBox > * > m_Lphi_mfree
Definition: PetscAMRSolver.H:58
bool m_mfree_homogeneous
Definition: PetscAMRSolver.H:59
Definition: PetscAMRSolver.H:26
virtual ~PetscAMRSolver()
Definition: PetscAMRSolver.H:37
virtual PetscErrorCode solve_mfree(Vector< LevelData< FArrayBox > *> &a_phi, const Vector< LevelData< FArrayBox > *> &a_rhs, LinearizedVTOp *a_op)
Definition: PetscAMRSolver.cpp:41
PetscErrorCode setCoords(KSP, const Vector< LevelData< FArrayBox > *> &a_phi)
Definition: PetscAMRSolver.cpp:221
static PetscErrorCode apply_mfree(Mat A, Vec x, Vec f)
Definition: PetscAMRSolver.cpp:24
int m_verbose
Definition: PetscAMRSolver.H:61
Vector< LevelData< FArrayBox > * > m_phi_mfree
Definition: PetscAMRSolver.H:57