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