PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
solution.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <memory>
13#include <string>
14
15#include <petscsys.h>
16
17#include <petibm/mesh.h>
18
43namespace petibm
44{
51namespace solution
52{
60{
61public:
63 PetscInt dim;
64
67
70
72 std::string info;
73
75 SolutionBase() = default;
76
83
85 virtual ~SolutionBase();
86
92 virtual PetscErrorCode destroy();
93
99 PetscErrorCode printInfo() const;
100
108 virtual PetscErrorCode setInitialConditions(const YAML::Node &node) = 0;
109
120 virtual PetscErrorCode convert2Velocity(const Mat &Rinv) = 0;
121
132 virtual PetscErrorCode convert2Flux(const Mat &R) = 0;
133
143 virtual PetscErrorCode write(const std::string &filePath) const = 0;
144
154 virtual PetscErrorCode read(const std::string &filePath) = 0;
155
156protected:
164 virtual PetscErrorCode init(const type::Mesh &mesh) = 0;
165
167 MPI_Comm comm;
168
170 PetscMPIInt mpiSize;
171
173 PetscMPIInt mpiRank;
174
177
178}; // SolutionBase
179} // end of namespace solution
180
181namespace type
182{
210typedef std::shared_ptr<solution::SolutionBase> Solution;
211} // end of namespace type
212
213namespace solution
214{
229PetscErrorCode createSolution(const type::Mesh &mesh, type::Solution &solution);
230} // end of namespace solution
231
232} // end of namespace petibm
Base (abstract) class for different solution holders.
Definition: solution.h:60
SolutionBase()=default
Default constructor.
PetscMPIInt mpiRank
Rank of the local process.
Definition: solution.h:173
virtual PetscErrorCode convert2Flux(const Mat &R)=0
Convert velocity components to velocity fluxes.
MPI_Comm comm
MPI communicator.
Definition: solution.h:167
PetscMPIInt mpiSize
Size of MPI communicator.
Definition: solution.h:170
std::string info
String containing information about the solution.
Definition: solution.h:72
virtual PetscErrorCode destroy()
Manually destroy data.
Definition: solution.cpp:34
virtual ~SolutionBase()
Default destructor.
Definition: solution.cpp:18
Vec UGlobal
Packed PETSc Vec object for the velocity vector field.
Definition: solution.h:66
virtual PetscErrorCode write(const std::string &filePath) const =0
Write flow field solutions to a file.
type::Mesh mesh
Shared pointer to the underlying Cartesian mesh object.
Definition: solution.h:176
PetscErrorCode printInfo() const
Print information about the solution to standard output.
Definition: solution.cpp:53
virtual PetscErrorCode setInitialConditions(const YAML::Node &node)=0
Set initial conditions of the flow fields.
SolutionBase(const type::Mesh &mesh)
Constructor using a Cartesian mesh.
Definition: solution.h:82
virtual PetscErrorCode read(const std::string &filePath)=0
Read the flow field solutions from a file.
virtual PetscErrorCode convert2Velocity(const Mat &Rinv)=0
Convert velocity fluxes to velocity components.
Vec pGlobal
PETSc Vec for the pressure scalar field.
Definition: solution.h:69
PetscInt dim
Number of dimensions.
Definition: solution.h:63
virtual PetscErrorCode init(const type::Mesh &mesh)=0
Initialize the flow field solutions.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
Definition: mesh.h:348
std::shared_ptr< solution::SolutionBase > Solution
Type definition of solution object.
Definition: solution.h:210
PetscErrorCode createSolution(const type::Mesh &mesh, type::Solution &solution)
Factory function to create a petibm::solution::Solution object.
Definition: solution.cpp:65
Prototype of mesh::MeshBase, type::Mesh, and factory function.
A toolbox for building flow solvers.
Definition: bodypack.h:52