Canoe
Comprehensive Atmosphere N' Ocean Engine
stream_transport.hpp
Go to the documentation of this file.
1 #ifndef SRC_TRANSPORT_STREAM_TRANSPORT_HPP_
2 #define SRC_TRANSPORT_STREAM_TRANSPORT_HPP_
3 
4 // canoe
5 #include <configure.hpp>
6 
7 // dealii headers
8 #include <deal.II/lac/solver_gmres.h>
9 #include <deal.II/lac/sparse_matrix.h>
10 #include <deal.II/lac/vector.h>
11 
12 // forward declaration
13 template <typename>
14 class AthenaArray;
15 
17  public:
18  StreamTransport(int rows, int cols, bool fourth_order = true);
20 
21  void setDiffusionMatrix(Real kdiff, Real dx);
22 
24 
25  void setAdvectionMatrix(AthenaArray<Real> const& streamf, Real dx);
26 
27  void assembleSystem(Real dt, Real theta);
28 
29  // theta = 1: Backward Euler
30  void evolve(AthenaArray<Real>* q, Real dt, Real theta = 1.);
31 
32  int64_t global(int i, int j) const { return i * cols_ + j; }
33 
34  int64_t globalh(int i, int j) const {
35  return (i + GhostZoneSize) * colsh_ + (j + GhostZoneSize);
36  }
37 
38  protected:
39  // fourth order diffusion
41  // without ghost zones (halo)
42  int rows_, cols_;
43  int rank_;
44 
45  // with ghost zones (halo)
46  int rowsh_, colsh_;
47  int rankh_;
48 
49  // sparsity patterns
50  dealii::SparsityPattern skh_, skk_, shk_;
51 
52  // diffusion matrix
53  dealii::SparseMatrix<Real> diffusion_;
54 
55  // advection matrix
56  dealii::SparseMatrix<Real> advection_;
57 
58  // stratch matrices, K-J, (K-J)*N
59  dealii::SparseMatrix<Real> KmJ_, KmJmN_;
60 
61  // boundary conditions
62  dealii::SparseMatrix<Real> bneumann_;
63 
64  // equation matrix and vectors
65  dealii::Vector<Real> qvec_, dqvec_, rhs_;
66  dealii::SparseMatrix<Real> mass_;
67 
68  // solver
69  dealii::SolverControl control_;
70  dealii::SolverGMRES<> solver_;
71 };
72 
73 #endif // SRC_TRANSPORT_STREAM_TRANSPORT_HPP_
dealii::Vector< Real > dqvec_
void evolve(AthenaArray< Real > *q, Real dt, Real theta=1.)
void setAdvectionMatrix(AthenaArray< Real > const &streamf, Real dx)
dealii::SparseMatrix< Real > bneumann_
dealii::SparsityPattern skk_
dealii::Vector< Real > rhs_
dealii::SolverControl control_
void setDiffusionMatrix(Real kdiff, Real dx)
dealii::Vector< Real > qvec_
dealii::SparseMatrix< Real > KmJ_
dealii::SparseMatrix< Real > mass_
dealii::SparseMatrix< Real > KmJmN_
void setDiffusionMatrix(AthenaArray< Real > const &mkdiff)
dealii::SolverGMRES solver_
dealii::SparseMatrix< Real > diffusion_
int64_t globalh(int i, int j) const
dealii::SparsityPattern skh_
int64_t global(int i, int j) const
void assembleSystem(Real dt, Real theta)
StreamTransport(int rows, int cols, bool fourth_order=true)
dealii::SparsityPattern shk_
dealii::SparseMatrix< Real > advection_