35class DriverSolid :
public Driver<dim, Number>
38 using VectorType =
typename dealii::LinearAlgebra::distributed::Vector<Number>;
41 DriverSolid(std::string
const & input_file,
42 MPI_Comm
const & comm,
45 : Driver<dim, Number>(input_file, comm, app, is_test)
47 structure = std::make_shared<SolverStructure<dim, Number>>();
54 dealii::Timer timer_local;
55 timer_local.restart();
57 structure->setup(this->application->structure, this->mpi_comm, this->is_test);
59 this->timer_tree.insert({
"FSI",
"Setup",
"Structure"}, timer_local.wall_time());
65 setup_interface_coupling()
68 std::make_shared<ExaDG::preCICE::Adapter<dim, dim, VectorType>>(this->precice_parameters,
74 this->precice->add_write_surface(
75 *this->application->structure->get_boundary_descriptor()->neumann_cached_bc.begin(),
76 this->precice_parameters.write_mesh_name,
77 {this->precice_parameters.displacement_data_name,
78 this->precice_parameters.velocity_data_name},
79 this->precice_parameters.write_data_type,
80 *structure->pde_operator->get_matrix_free(),
81 structure->pde_operator->get_dof_index(),
82 dealii::numbers::invalid_unsigned_int);
87 this->precice->add_read_surface(
88 *structure->pde_operator->get_matrix_free(),
89 structure->pde_operator->get_container_interface_data_neumann(),
90 this->precice_parameters.read_mesh_name,
91 {this->precice_parameters.stress_data_name});
95 VectorType displacement_structure;
96 structure->pde_operator->initialize_dof_vector(displacement_structure);
97 this->precice->initialize_precice(displacement_structure);
108 this->pcout << std::endl <<
"Setting up fluid-structure interaction solver:" << std::endl;
112 setup_interface_coupling();
114 this->timer_tree.insert({
"FSI",
"Setup"}, timer.wall_time());
122 bool is_new_time_window =
true;
124 while(this->precice->is_coupling_ongoing())
126 structure->time_integrator->advance_one_timestep_pre_solve(is_new_time_window);
128 this->precice->save_current_state_if_required([&]() {});
131 coupling_fluid_to_structure();
135 structure->time_integrator->advance_one_timestep_partitioned_solve(is_new_time_window);
137 coupling_structure_to_ale(structure->time_integrator->get_displacement_np(),
138 structure->time_integrator->get_time_step_size());
141 coupling_structure_to_fluid(structure->time_integrator->get_velocity_np(),
142 structure->time_integrator->get_time_step_size());
146 dealii::Timer precice_timer;
147 this->precice->advance(structure->time_integrator->get_time_step_size());
148 is_new_time_window = this->precice->is_time_window_complete();
149 this->timer_tree.insert({
"FSI",
"preCICE"}, precice_timer.wall_time());
152 this->precice->reload_old_state_if_required([&]() {});
154 if(is_new_time_window)
155 structure->time_integrator->advance_one_timestep_post_solve();
160 print_performance_results(
double const total_time)
const override
164 <<
"_________________________________________________________________________________"
168 this->pcout <<
"Performance results for fluid-structure interaction solver:" << std::endl;
170 this->pcout << std::endl <<
"Structure:" << std::endl;
171 structure->time_integrator->print_iterations();
174 this->pcout << std::endl <<
"Wall times:" << std::endl;
176 this->timer_tree.insert({
"FSI"}, total_time);
178 this->timer_tree.insert({
"FSI"}, structure->time_integrator->get_timings(),
"Structure");
180 this->pcout << std::endl <<
"Timings for level 1:" << std::endl;
181 this->timer_tree.print_level(this->pcout, 1);
183 this->pcout << std::endl <<
"Timings for level 2:" << std::endl;
184 this->timer_tree.print_level(this->pcout, 2);
187 dealii::types::global_dof_index DoFs = structure->pde_operator->get_number_of_dofs();
189 unsigned int const N_mpi_processes = dealii::Utilities::MPI::n_mpi_processes(this->mpi_comm);
191 dealii::Utilities::MPI::MinMaxAvg total_time_data =
192 dealii::Utilities::MPI::min_max_avg(total_time, this->mpi_comm);
193 double const total_time_avg = total_time_data.avg;
195 unsigned int N_time_steps = structure->time_integrator->get_number_of_time_steps();
197 print_throughput_unsteady(this->pcout, DoFs, total_time_avg, N_time_steps, N_mpi_processes);
200 print_costs(this->pcout, total_time_avg, N_mpi_processes);
203 <<
"_________________________________________________________________________________"
210 coupling_structure_to_ale(VectorType
const & displacement_structure,
211 double const time_step_size)
const
213 this->precice->write_data(this->precice_parameters.write_mesh_name,
214 this->precice_parameters.displacement_data_name,
215 displacement_structure,
220 coupling_structure_to_fluid(VectorType
const & velocity_structure,
221 double const time_step_size)
const
223 this->precice->write_data(this->precice_parameters.write_mesh_name,
224 this->precice_parameters.velocity_data_name,
230 coupling_fluid_to_structure()
const
232 this->precice->read_block_data(this->precice_parameters.read_mesh_name,
233 this->precice_parameters.stress_data_name);
237 std::shared_ptr<SolverStructure<dim, Number>> structure;