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 "decoupledibpm.h"
16
40int main(int argc, char **argv)
41{
42 PetscErrorCode ierr;
43 YAML::Node config;
45
46 ierr = PetscInitialize(&argc, &argv, nullptr, nullptr); CHKERRQ(ierr);
47 ierr = PetscLogDefaultBegin(); CHKERRQ(ierr);
48
49 // parse configuration files; store info in YAML node
50 ierr = petibm::parser::getSettings(config); CHKERRQ(ierr);
51
52 // initialize the decoupled IBPM solver
53 ierr = solver.init(PETSC_COMM_WORLD, config); CHKERRQ(ierr);
54 ierr = solver.ioInitialData(); CHKERRQ(ierr);
55 ierr = PetscPrintf(PETSC_COMM_WORLD,
56 "Completed initialization stage\n"); CHKERRQ(ierr);
57
58 // integrate the solution in time
59 while (!solver.finished())
60 {
61 // compute the solution at the next time step
62 ierr = solver.advance(); CHKERRQ(ierr);
63 // output data to files
64 ierr = solver.write(); CHKERRQ(ierr);
65 }
66
67 // destroy the decoupled IBPM solver
68 ierr = solver.destroy(); CHKERRQ(ierr);
69
70 ierr = PetscFinalize(); CHKERRQ(ierr);
71
72 return 0;
73} // main
int main(int argc, char **argv)
Definition: main.cpp:48
Immersed-boundary method proposed by Li et. al. (2016).
Definition: decoupledibpm.h:23
PetscErrorCode ioInitialData()
Read or write initial data.
bool finished()
Evaluate if the simulation is finished.
PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)
Initialize the decoupled IBPM solver.
PetscErrorCode destroy()
Manually destroy data.
PetscErrorCode advance()
Advance the solution by one time step.
PetscErrorCode write()
Write solution and solver info to files.
Definition of the class DecoupledIBPMSolver.
PetscErrorCode getSettings(YAML::Node &node)
Get configuration settings.
Definition: parser.cpp:175
Prototypes of parser functions.