15 const YAML::Node &node)
25 PetscFunctionBeginUser;
27 ierr = PetscFinalized(&finalized); CHKERRV(ierr);
28 if (finalized)
return;
30 ierr =
destroy(); CHKERRV(ierr);
38 PetscFunctionBeginUser;
41 ierr = VecDestroy(&
UB); CHKERRQ(ierr);
43 PetscFunctionReturn(0);
48 const YAML::Node &node)
52 PetscFunctionBeginUser;
58 ierr = PetscLogStageRegister(
"moveIB", &
stageMoveIB); CHKERRQ(ierr);
60 ierr = VecDuplicate(
f, &
UB); CHKERRQ(ierr);
61 ierr = VecSet(
UB, 0.0); CHKERRQ(ierr);
63 ierr = PetscLogStagePop(); CHKERRQ(ierr);
65 PetscFunctionReturn(0);
73 PetscFunctionBeginUser;
80 PetscFunctionReturn(0);
88 PetscFunctionBeginUser;
94 ierr = PetscLogStagePush(
stageWrite); CHKERRQ(ierr);
98 ierr = PetscLogStagePop(); CHKERRQ(ierr);
101 PetscFunctionReturn(0);
109 PetscFunctionBeginUser;
115 PetscFunctionReturn(0);
123 PetscFunctionBeginUser;
125 ierr = PetscLogStagePush(
stageMoveIB); CHKERRQ(ierr);
129 ierr =
bodies->updateMeshIdx(
mesh); CHKERRQ(ierr);
130 if (
E != PETSC_NULL) {ierr = MatDestroy(&
E); CHKERRQ(ierr);}
131 if (
H != PETSC_NULL) {ierr = MatDestroy(&
H); CHKERRQ(ierr);}
132 if (
BNH != PETSC_NULL) {ierr = MatDestroy(&
BNH); CHKERRQ(ierr);}
133 if (
EBNH != PETSC_NULL) {ierr = MatDestroy(&
EBNH); CHKERRQ(ierr);}
137 ierr = PetscLogStagePop(); CHKERRQ(ierr);
139 PetscFunctionReturn(0);
147 PetscFunctionBeginUser;
153 ierr = VecScale(
rhsf, -1.0); CHKERRQ(ierr);
154 ierr = VecAYPX(
rhsf, 1.0,
UB); CHKERRQ(ierr);
156 ierr = PetscLogStagePop(); CHKERRQ(ierr);
158 PetscFunctionReturn(0);
166 PetscFunctionBeginUser;
168 std::string directory =
config[
"output"].as<std::string>(
".");
169 std::stringstream ss_ite;
170 ss_ite << std::setfill(
'0') << std::setw(7) <<
ite;
171 std::string filepath;
172 for (PetscInt i = 0; i <
bodies->nBodies; ++i)
175 filepath = directory +
"/" + body->name +
"_" + ss_ite.str();
176 std::stringstream ss_suffix;
177 ss_suffix <<
"." << body->dim <<
"D";
178 filepath = filepath + ss_suffix.str();
179 ierr = body->writeBody(filepath); CHKERRQ(ierr);
182 PetscFunctionReturn(0);
Mat E
Regularization operator.
PetscLogStage stageRHSForces
Log stage for assembling the RHS of the forces system.
Mat BNH
Projection operator for the forces.
petibm::type::BodyPack bodies
Pack of immersed bodies.
PetscErrorCode ioInitialData()
Read or write initial data.
Vec f
Vector to hold the forces at time step n.
PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)
Initialize the decoupled IBPM solver.
virtual PetscErrorCode createExtraOperators()
Assemble additional operators.
PetscErrorCode destroy()
Manually destroy data.
Vec rhsf
Right-hand side of the forces system.
petibm::type::LinSolver fSolver
Linear solver for the Lagrangian forces.
PetscErrorCode advance()
Advance the solution by one time step.
PetscErrorCode write()
Write solution and solver info to files.
Mat EBNH
Left-hand side operator of the system for the forces.
petibm::type::Solution solution
Data object holding the velocity and pressure fields.
YAML::Node config
YAML configuration settings.
PetscInt nsave
Frequency at which the solution fields are written to files.
PetscLogStage stageInitialize
Log stage for the initialization phase.
PetscReal dt
Time-step size.
PetscLogStage stageWrite
Log stage when write the solution fields.
PetscInt ite
Time-step index.
petibm::type::Mesh mesh
Structured Cartesian mesh object.
PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)
Initialize the decoupled IBPM solver with moving rigid bodies.
PetscErrorCode ioInitialData()
Read or write initial data.
Vec UB
Prescribed boundary velocity vector.
PetscLogStage stageMoveIB
Log stage for moving the bodies.
virtual PetscErrorCode setVelocityBodies(const PetscReal &ti)
Update the velocity of the Lagrangian points.
virtual PetscErrorCode writeBodies()
Write the coordinates of the Lagrangian points for each body.
~RigidKinematicsSolver()
Default destructor.
RigidKinematicsSolver()=default
Default constructor.
PetscErrorCode write()
Write solution, solver info, and body points to files.
PetscErrorCode destroy()
Manually destroy data.
PetscErrorCode advance()
Advance the solution by one time step.
virtual PetscErrorCode assembleRHSForces()
Assemble the right-hand side of the system for the forces.
virtual PetscErrorCode setCoordinatesBodies(const PetscReal &ti)
Update the position of the Lagrangian points.
virtual PetscErrorCode moveBodies(const PetscReal &ti)
Move the bodies and update the solver state.
std::shared_ptr< body::SingleBodyBase > SingleBody
Definition of type::SingleBody.
Definition of the class RigidKinematicsSolver.