|
PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
|
Class of composite staggered Cartesian mesh. More...
#include <cartesianmesh.h>
Public Member Functions | |
| CartesianMesh (const MPI_Comm &world, const YAML::Node &node) | |
| Constructor. More... | |
| virtual | ~CartesianMesh () |
| Default destructor. More... | |
| virtual PetscErrorCode | destroy () |
| Manually destroy data. More... | |
| virtual PetscBool | isPointOnLocalProc (const type::RealVec1D &point, const type::Field &field) |
| virtual PetscErrorCode | write (const std::string &filePath) const |
| Write the mesh object into a HDF5 file. More... | |
| virtual PetscErrorCode | getLocalIndex (const PetscInt &f, const MatStencil &s, PetscInt &idx) const |
| Get the local index of a point by providing MatStencil. More... | |
| virtual PetscErrorCode | getLocalIndex (const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const |
| Get the local index of a point by providing i, j, and k. More... | |
| virtual PetscErrorCode | getNaturalIndex (const PetscInt &f, const MatStencil &s, PetscInt &idx) const |
| Get the natural index of a point by providing MatStencil. More... | |
| virtual PetscErrorCode | getNaturalIndex (const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const |
| Get the natural index of a point by providing i, j, and k. More... | |
| virtual PetscErrorCode | getGlobalIndex (const PetscInt &f, const MatStencil &s, PetscInt &idx) const |
| Get the global index of a point in unpacked DM by providing MatStencil. More... | |
| virtual PetscErrorCode | getGlobalIndex (const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const |
| Get the global index of a point in unpacked DM by providing i, j, and k. More... | |
| virtual PetscErrorCode | getPackedGlobalIndex (const PetscInt &f, const MatStencil &s, PetscInt &idx) const |
| Get the global index of a point in packed DM by providing MatStencil. More... | |
| virtual PetscErrorCode | getPackedGlobalIndex (const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const |
| Get the global index of a point in packed DM by providing i, j, and k. More... | |
| PetscErrorCode | printInfo () const |
| Print information to standard output. More... | |
Public Attributes | |
| PetscInt | dim = -1 |
| Dimension. More... | |
| type::RealVec1D | min |
| Minimum coordinates of boundaries in all directions. More... | |
| type::RealVec1D | max |
| Maximum coordinates of boundaries in all directions. More... | |
| type::IntVec2D | n |
| Total number of points of all fields and in all directions. More... | |
| type::BoolVec2D | periodic |
| Bools indicating if any direction is periodic. More... | |
| type::GhostedVec3D | coord |
| Coordinates of mesh points of all fields and in all directions. More... | |
| type::GhostedVec3D | dL |
| Spacings of mesh points of all fields and in all directions. More... | |
| PetscInt | UN |
| Total number of velocity points. More... | |
| PetscInt | pN |
| Total number of pressure points. More... | |
| std::string | info |
| A string for printing information. More... | |
| std::vector< DM > | da |
| A vector of DMs of all fields. More... | |
| type::IntVec1D | nProc |
| Number of processes in all directions. More... | |
| type::IntVec2D | bg |
| The beginning index of all fields in all directions of this process. More... | |
| type::IntVec2D | ed |
| The ending index of all fields in all directions of this process. More... | |
| type::IntVec2D | m |
| The number of points of all fields in all directions of this process. More... | |
| PetscInt | UNLocal |
| Total number of velocity points local to this process. More... | |
| PetscInt | pNLocal |
| Total number of pressure points local to this process. More... | |
| DM | UPack |
| DMComposte of velocity DMs. More... | |
| MPI_Comm | comm |
| Communicator. More... | |
| PetscMPIInt | mpiSize |
| Total number of processes. More... | |
| PetscMPIInt | mpiRank |
| Rank of this process. More... | |
Protected Member Functions | |
| PetscErrorCode | init (const MPI_Comm &world, const YAML::Node &node) |
| Initialization. More... | |
| PetscErrorCode | createVertexMesh () |
| Create vertex information. More... | |
| PetscErrorCode | createPressureMesh () |
| Create pressure mesh information. More... | |
| PetscErrorCode | createVelocityMesh () |
| Create velocity mesh information. More... | |
| PetscErrorCode | createInfoString () |
| Create a string of information. More... | |
| PetscErrorCode | addLocalInfoString (std::stringstream &ss) |
| Gather info of parallel distribution and add to info string. More... | |
| PetscErrorCode | initDMDA () |
| Initialize DMDAs. More... | |
| PetscErrorCode | createSingleDMDA (const PetscInt &i) |
| Function for creating a single DMDA. More... | |
| PetscErrorCode | createPressureDMDA () |
| Create DMDA for pressure. More... | |
| PetscErrorCode | createVelocityPack () |
| Create DMDAs for velocity fields and make a DMComposite. More... | |
Protected Attributes | |
| type::RealVec3D | dLTrue |
| Underlying data for mesh point spacing. More... | |
| type::RealVec3D | coordTrue |
| Underlying data for mesh point coordinates. More... | |
| std::vector< AO > | ao |
| References to underlying AO objects of velocity DMs. More... | |
| type::IntVec2D | UNLocalAllProcs |
| Number of local velocity points (without ghost points) for all processes and all velocity fields. More... | |
| type::IntVec1D | UPackNLocalAllProcs |
| Number of local packed velocity points (without ghost points) for all processes. More... | |
| type::IntVec2D | offsetsAllProcs |
| Offsets of velocity points in unpacked DMs for all processes and all velocity field. More... | |
| type::IntVec1D | offsetsPackAllProcs |
| Offsets of packed velocity points in packed DM. More... | |
Class of composite staggered Cartesian mesh.
Definition at line 31 of file cartesianmesh.h.
| petibm::mesh::CartesianMesh::CartesianMesh | ( | const MPI_Comm & | world, |
| const YAML::Node & | node | ||
| ) |
Constructor.
| world | [in] MPI communicator. |
| node | [in] YAML configuration node. |
Users are not encouraged to use constructor to initialize instances directly. Please use the factory function.
Definition at line 30 of file cartesianmesh.cpp.
|
virtual |
Default destructor.
Definition at line 36 of file cartesianmesh.cpp.
|
protected |
Gather info of parallel distribution and add to info string.
Definition at line 412 of file cartesianmesh.cpp.
|
protected |
Create a string of information.
Definition at line 358 of file cartesianmesh.cpp.
|
protected |
Create DMDA for pressure.
Definition at line 541 of file cartesianmesh.cpp.
|
protected |
Create pressure mesh information.
Definition at line 136 of file cartesianmesh.cpp.
|
protected |
Function for creating a single DMDA.
| i | [in] The index of the targeting field (0 ~ 4 represents u, v, w, pressure, and vertex respectively). |
Definition at line 492 of file cartesianmesh.cpp.
|
protected |
Create velocity mesh information.
Definition at line 209 of file cartesianmesh.cpp.
|
protected |
Create DMDAs for velocity fields and make a DMComposite.
Definition at line 559 of file cartesianmesh.cpp.
|
protected |
Create vertex information.
Definition at line 177 of file cartesianmesh.cpp.
|
virtual |
Manually destroy data.
Reimplemented from petibm::mesh::MeshBase.
Definition at line 50 of file cartesianmesh.cpp.
|
virtual |
Get the global index of a point in unpacked DM by providing MatStencil.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| s | [in] MatStencil object of target point. |
| idx | [out] Global index in unpacked DM object. |
If the provided MatStencil is not valid or is a ghost point, the idx will be -1.
Implements petibm::mesh::MeshBase.
Definition at line 709 of file cartesianmesh.cpp.
|
virtual |
Get the global index of a point in unpacked DM by providing i, j, and k.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| i | [in] i-index. |
| j | [in] j-index. |
| k | [in] k-index. |
| idx | [out] Global index in unpacked DM. |
For 2D mesh, the value of k-index will be ignored.
If the provided (i, j, k) is not valid or is a ghost point, the idx will be -1.
Implements petibm::mesh::MeshBase.
Definition at line 724 of file cartesianmesh.cpp.
|
virtual |
Get the local index of a point by providing MatStencil.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| s | [in] MatStencil object of target point. |
| idx | [out] Local index. |
Note that the stencil must belong to this process.
Implements petibm::mesh::MeshBase.
Definition at line 679 of file cartesianmesh.cpp.
|
virtual |
Get the local index of a point by providing i, j, and k.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| i | [in] i-index. |
| j | [in] j-index. |
| k | [in] k-index. |
| idx | [out] Local index. |
Note that the stencil must belong to this process. For 2D mesh, the value of k-index will be ignored.
Implements petibm::mesh::MeshBase.
Definition at line 693 of file cartesianmesh.cpp.
|
virtual |
Get the natural index of a point by providing MatStencil.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| s | [in] MatStencil object of target point. |
| idx | [out] Natural index. |
If the provided MatStencil is not valid or is a ghost point, the idx will be -1.
Implements petibm::mesh::MeshBase.
Definition at line 578 of file cartesianmesh.cpp.
|
virtual |
Get the natural index of a point by providing i, j, and k.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| i | [in] i-index. |
| j | [in] j-index. |
| k | [in] k-index. |
| idx | [out] Natural index. |
For 2D mesh, the value of k-index will be ignored.
If the provided (i, j, k) is not valid or is a ghost point, the idx will be -1.
Implements petibm::mesh::MeshBase.
Definition at line 592 of file cartesianmesh.cpp.
|
virtual |
Get the global index of a point in packed DM by providing MatStencil.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| s | [in] MatStencil object of target point. |
| idx | [out] Global index in packed DM. |
For pressure field (f=3), packed ID will be equal to unpacked ID.
If the provided MatStencil is not valid or is a ghost point, the idx will be -1.
Implements petibm::mesh::MeshBase.
Definition at line 740 of file cartesianmesh.cpp.
|
virtual |
Get the global index of a point in packed DM by providing i, j, and k.
| f | [in] Target field (u=0, v=1, w=2, p=3). |
| i | [in] i-index. |
| j | [in] j-index. |
| k | [in] k-index. |
| idx | [out] Global index in packed DM. |
For 2D mesh, the value of k-index will be ignored. For pressure field (f=3), packed ID will be equal to unpacked ID.
If the provided (i, j, k) is not valid or is a ghost point, the idx will be -1.
Implements petibm::mesh::MeshBase.
Definition at line 782 of file cartesianmesh.cpp.
|
protectedvirtual |
Initialization.
| world | [in] MPI communicator. |
| node | [in] YAML configuration node. |
Given the design of PetIBM is to use factory function to create shared pointers of instances, it seems not necessary to make this function public.
Implements petibm::mesh::MeshBase.
Definition at line 69 of file cartesianmesh.cpp.
|
protected |
Initialize DMDAs.
Definition at line 438 of file cartesianmesh.cpp.
|
virtual |
Implements petibm::mesh::MeshBase.
Definition at line 825 of file cartesianmesh.cpp.
|
inherited |
|
virtual |
Write the mesh object into a HDF5 file.
| filePath | [in] Path of the file to write in. |
Implements petibm::mesh::MeshBase.
Definition at line 798 of file cartesianmesh.cpp.
|
protected |
References to underlying AO objects of velocity DMs.
Definition at line 101 of file cartesianmesh.h.
|
inherited |
|
inherited |
|
inherited |
|
protected |
Underlying data for mesh point coordinates.
Definition at line 98 of file cartesianmesh.h.
|
inherited |
|
inherited |
|
inherited |
|
protected |
Underlying data for mesh point spacing.
Definition at line 95 of file cartesianmesh.h.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protected |
Offsets of velocity points in unpacked DMs for all processes and all velocity field.
Definition at line 113 of file cartesianmesh.h.
|
protected |
Offsets of packed velocity points in packed DM.
Definition at line 116 of file cartesianmesh.h.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protected |
Number of local velocity points (without ghost points) for all processes and all velocity fields.
Definition at line 105 of file cartesianmesh.h.
|
inherited |
|
protected |
Number of local packed velocity points (without ghost points) for all processes.
Definition at line 109 of file cartesianmesh.h.