13#include <yaml-cpp/yaml.h>
42 const YAML::Node &node,
49 virtual PetscErrorCode
destroy();
104 virtual PetscErrorCode
init(
const MPI_Comm &
comm,
105 const YAML::Node &node,
119 const PetscReal &t) = 0;
134 const YAML::Node &node,
178 PetscErrorCode
init(
const MPI_Comm &
comm,
179 const YAML::Node &node,
212 PetscErrorCode
writeGrid(
const std::string &filePath);
235 PetscErrorCode
writeIS(
const std::string &filePath);
242 PetscErrorCode
writeIS_HDF5(
const std::string &filePath);
265 PetscErrorCode
writeVec(
const Vec &vec,
const PetscReal &t);
273 PetscErrorCode
writeVec_ASCII(
const Vec &vec,
const PetscReal &t);
281 PetscErrorCode
writeVec_HDF5(
const Vec &vec,
const PetscReal &t);
296 const YAML::Node &node,
322 PetscErrorCode
init(
const MPI_Comm &
comm,
323 const YAML::Node &node,
357typedef std::shared_ptr<misc::ProbeBase>
Probe;
376 const YAML::Node &node,
Abstract Base Class of a probe.
ProbeBase()=default
Default constructor.
virtual PetscErrorCode destroy()
Manually destroy data in the object.
PetscReal t_end
Monitoring ending time.
std::string path
Path of the file to output the solution.
PetscErrorCode monitor(const type::Solution &solution, const type::Mesh &mesh, const PetscInt &n, const PetscReal &t)
Monitor the field solution and output data to file.
PetscReal t_start
Monitoring starting time.
PetscMPIInt commRank
Rank of the local process in the MPI communicator.
type::Field field
Type of the field to monitor.
virtual PetscErrorCode init(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh)=0
Initialize the probe.
PetscViewerType viewerType
Type of the PETSc viewer to use.
PetscMPIInt commSize
Number of processes in the MPI communicator.
PetscViewer viewer
PETSc viewer to output the solution.
virtual ~ProbeBase()
Destructor.
PetscInt n_monitor
Frequency of monitoring the solution (number of time steps).
virtual PetscErrorCode monitorVec(const DM &da, const Vec &fvec, const PetscInt &n, const PetscReal &t)=0
Monitor a sub-region of a vector and possibly output data to file.
ProbeBase(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh)
Constructor. Initialize the probe.
MPI_Comm comm
MPI communicator.
std::string name
Name of the probe as a string.
Probe class to monitor the solution at a single point.
PetscReal value
Interpolated value.
PetscErrorCode destroy()
Manually destroy the data.
Vec svec
Local (ghosted) PETSc Vec object with neighboring values.
type::LinInterp interp
Interpolating object to monitor at a single point.
PetscErrorCode monitorVec(const DM &da, const Vec &fvec, const PetscInt &n, const PetscReal &t)
Monitor a sub-region of a vector and possibly output data to file.
virtual ~ProbePoint()=default
Default destructor.
PetscErrorCode init(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh)
Initialize the probe.
ProbePoint(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh)
Default constructor.
type::RealVec1D loc
Coordinates of the point to monitor around.
PetscBool pointOnLocalProc
True if target point located on local sub-domain.
Probe class to monitor a volume region of the domain.
PetscErrorCode init(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh)
Initialize the probe.
PetscErrorCode writeGrid_HDF5(const std::string &filePath)
Write the sub mesh into a HDF5 file.
type::RealVec2D coord
Grid point coordinates in the volume.
ProbeVolume(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh)
Default constructor.
PetscErrorCode writeIS_ASCII(const std::string &filePath)
Write index set (natural ordering) into a HDF5 file.
PetscErrorCode writeGrid(const std::string &filePath)
Write the sub mesh grid points into a file.
PetscErrorCode getInfo(const type::Mesh &mesh, const type::RealVec2D &box)
Get information about the sub-mesh area to monitor.
type::IntVec1D nPtsDir
Number of grid points along each direction in the volume.
PetscInt n_sum
Frequency of saving the data to file.
PetscErrorCode writeIS_HDF5(const std::string &filePath)
Write index set (natural ordering) into a HDF5 file.
PetscErrorCode monitorVec(const DM &da, const Vec &fvec, const PetscInt &n, const PetscReal &t)
Monitor a sub-region of a vector and possibly output data to file.
Vec dvec
Sub-vector of the region to monitor.
PetscErrorCode destroy()
Manually destroy the data.
PetscErrorCode writeGrid_ASCII(const std::string &filePath)
Write the sub mesh into an ASCII file.
PetscInt nPts
Number of grid points in the volume.
PetscErrorCode createIS(const type::Mesh &mesh)
Create the index set for the points to monitor.
PetscErrorCode writeIS(const std::string &filePath)
Write index set (natural ordering) into a file.
IS isPetsc
Index set for the grid points to monitor (PETSc ordering).
PetscErrorCode writeVec_ASCII(const Vec &vec, const PetscReal &t)
Output a PETSc Vec object to an ASCII file.
type::RealVec2D box
Limits of the volume.
PetscReal atol
Absolute tolerance criterion when comparing values.
PetscErrorCode createGrid(const type::Mesh &mesh)
Get the sub-mesh area to monitor.
PetscInt count
Counter to know when to flush to the data to file.
PetscErrorCode writeVec(const Vec &vec, const PetscReal &t)
Output a PETSc Vec object to file.
type::IntVec1D startIdxDir
Index of the first point in the volume in each direction.
virtual ~ProbeVolume()=default
Default destructor.
PetscErrorCode writeVec_HDF5(const Vec &vec, const PetscReal &t)
Output a PETSc Vec object to a HDF5 file.
IS isNatural
Index set for the grid points to monitor (Natural ordering).
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
std::shared_ptr< misc::LinInterpBase > LinInterp
Type definition of LinInterp.
std::shared_ptr< misc::ProbeBase > Probe
Type definition of Probe.
PetscErrorCode createProbe(const MPI_Comm &comm, const YAML::Node &node, const type::Mesh &mesh, type::Probe &probe)
Factory function to create a probe to monitor the solution.
std::shared_ptr< solution::SolutionBase > Solution
Type definition of solution object.
std::vector< RealVec1D > RealVec2D
2D std::vector holding PetscReal.
std::vector< PetscInt > IntVec1D
1D std::vector holding PetscInt.
std::vector< PetscReal > RealVec1D
1D std::vector holding PetscReal.
Prototype of the linear interpolation classes, definition of type::LinInterp, and factory function.
Prototype of mesh::MeshBase, type::Mesh, and factory function.
A toolbox for building flow solvers.
Definition of the class petibm::solution::SolutionBase, the type definition petibm::type::Solution,...
Definition of user-defined types for convenience.