22#ifndef INCLUDE_EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_SOLVER_H_
23#define INCLUDE_EXADG_FLUID_STRUCTURE_INTERACTION_PRECICE_SOLVER_H_
26#include <deal.II/base/parameter_handler.h>
29#include <exadg/fluid_structure_interaction/precice/driver.h>
30#include <exadg/fluid_structure_interaction/precice/driver_fluid.h>
31#include <exadg/fluid_structure_interaction/precice/driver_solid.h>
32#include <exadg/fluid_structure_interaction/user_interface/declare_get_application.h>
33#include <exadg/utilities/enum_patterns.h>
34#include <exadg/utilities/general_parameters.h>
39create_input_file(std::string
const & input_file)
41 dealii::ParameterHandler prm;
44 general.add_parameters(prm);
47 precice_parameters.add_parameters(prm);
51 constexpr int Dim = 2;
52 using Number = double;
54 FSI::get_application<Dim, Number>(input_file, MPI_COMM_WORLD)->add_parameters(prm);
56 prm.print_parameters(input_file,
57 dealii::ParameterHandler::Short |
58 dealii::ParameterHandler::KeepDeclarationOrder);
62template<
int dim,
typename Number>
64run(std::string
const & input_file, MPI_Comm
const & mpi_comm,
bool const is_test)
69 std::shared_ptr<FSI::ApplicationBase<dim, Number>> application =
70 FSI::get_application<dim, Number>(input_file, mpi_comm);
74 std::shared_ptr<FSI::preCICE::Driver<dim, Number>> driver;
80 if(precice_param.physics ==
"Structure")
82 driver = std::make_shared<FSI::preCICE::DriverSolid<dim, Number>>(input_file,
87 else if(precice_param.physics ==
"Fluid")
89 driver = std::make_shared<FSI::preCICE::DriverFluid<dim, Number>>(input_file,
97 dealii::ExcMessage(
"precice_param.physics has to be \"Structure\" or \"Fluid\""));
104 driver->print_performance_results(timer.wall_time());
112main(
int argc,
char ** argv)
114 dealii::Utilities::MPI::MPI_InitFinalize mpi(argc, argv, 1);
116 MPI_Comm mpi_comm(MPI_COMM_WORLD);
118 std::string input_file;
122 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
125 std::cout <<
"To run the program, use: ./solver input_file" << std::endl
126 <<
"To setup the input file, use: ./solver input_file --help" << std::endl;
134 input_file = std::string(argv[1]);
136 if(argc == 3 and std::string(argv[2]) ==
"--help")
138 if(dealii::Utilities::MPI::this_mpi_process(mpi_comm) == 0)
139 ExaDG::create_input_file(input_file);
148 if(general.dim == 2 and general.precision ==
"double")
149 ExaDG::run<2, double>(input_file, mpi_comm, general.is_test);
150 else if(general.dim == 3 and general.precision ==
"double")
151 ExaDG::run<3, double>(input_file, mpi_comm, general.is_test);
153 AssertThrow(
false, dealii::ExcMessage(
"Only dim = 2|3 and precision=double implemented."));
Definition general_parameters.h:32
Definition precice_parameters.h:41