PetIBM
0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
main.cpp
Go to the documentation of this file.
1
10
#include <petscsys.h>
11
#include <yaml-cpp/yaml.h>
12
13
#include <
petibm/parser.h
>
14
15
#include "
navierstokes.h
"
16
45
int
main
(
int
argc,
char
**argv)
46
{
47
PetscErrorCode ierr;
48
YAML::Node config;
49
NavierStokesSolver
solver;
50
51
ierr = PetscInitialize(&argc, &argv,
nullptr
,
nullptr
); CHKERRQ(ierr);
52
ierr = PetscLogDefaultBegin(); CHKERRQ(ierr);
53
54
// parse configuration files; store info in YAML node
55
ierr =
petibm::parser::getSettings
(config); CHKERRQ(ierr);
56
57
// initialize the Navier-Stokes solver
58
ierr = solver.
init
(PETSC_COMM_WORLD, config); CHKERRQ(ierr);
59
ierr = solver.
ioInitialData
(); CHKERRQ(ierr);
60
ierr = PetscPrintf(PETSC_COMM_WORLD,
61
"Completed initialization stage\n"
); CHKERRQ(ierr);
62
63
// integrate the solution in time
64
while
(!solver.
finished
())
65
{
66
// compute the solution at the next time step
67
ierr = solver.
advance
(); CHKERRQ(ierr);
68
// output data to files
69
ierr = solver.
write
(); CHKERRQ(ierr);
70
}
71
72
// destroy the Navier-Stokes solver
73
ierr = solver.
destroy
(); CHKERRQ(ierr);
74
75
ierr = PetscFinalize(); CHKERRQ(ierr);
76
77
return
0;
78
}
// main
main
int main(int argc, char **argv)
Definition:
main.cpp:48
NavierStokesSolver
Solve the incompressible Navier-Stokes equations with a projection method (Perot 1993).
Definition:
navierstokes.h:30
NavierStokesSolver::ioInitialData
PetscErrorCode ioInitialData()
Read or write initial data.
Definition:
navierstokes.cpp:207
NavierStokesSolver::advance
PetscErrorCode advance()
Advance the solution by one time step.
Definition:
navierstokes.cpp:240
NavierStokesSolver::finished
bool finished()
Evaluate if the simulation is finished.
Definition:
navierstokes.cpp:311
NavierStokesSolver::write
PetscErrorCode write()
Write solution and solver info to files.
Definition:
navierstokes.cpp:269
NavierStokesSolver::init
PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)
Initialize the Navier-Stokes solver.
Definition:
navierstokes.cpp:93
NavierStokesSolver::destroy
PetscErrorCode destroy()
Manually destroy data.
Definition:
navierstokes.cpp:38
petibm::parser::getSettings
PetscErrorCode getSettings(YAML::Node &node)
Get configuration settings.
Definition:
parser.cpp:175
navierstokes.h
Definition of the class NavierStokesSolver.
parser.h
Prototypes of parser functions.
applications
navierstokes
main.cpp
Generated on Mon May 30 2022 16:28:10 for PetIBM by
1.9.3