ExaDG
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType > Class Template Reference

#include <precice_adapter.h>

Public Types

using value_type = typename CouplingBase<dim, data_dim, VectorizedArrayType>::value_type
 

Public Member Functions

template<typename ParameterClass >
 Adapter (ParameterClass const &parameters, MPI_Comm mpi_comm)
 Constructor, which sets up the precice Solverinterface.
 
void initialize_precice (VectorType const &dealii_to_precice)
 Initializes preCICE and passes all relevant data to preCICE.
 
void add_write_surface (dealii::types::boundary_id const surface_id, std::string const &mesh_name, std::vector< std::string > const &write_data_names, WriteDataType const write_data_type, dealii::MatrixFree< dim, double, VectorizedArrayType > const &data, unsigned int const dof_index, unsigned int const write_quad_index)
 
void add_read_surface (dealii::MatrixFree< dim, double, VectorizedArrayType > const &data, std::shared_ptr< ContainerInterfaceData< rank, dim, double > > interface_data, std::string const &mesh_name, std::vector< std::string > const &read_data_name)
 
void advance (double const computed_timestep_length)
 Advances preCICE after every timestep.
 
void save_current_state_if_required (std::function< void()> const &save_state)
 Saves current state of time dependent variables in case of an implicit coupling.
 
void reload_old_state_if_required (std::function< void()> const &reload_old_state)
 Reloads the previously stored variables in case of an implicit coupling. The current implementation supports subcycling, i.e. previously refers o the last time save_current_state_if_required() has been called.
 
void write_data (std::string const &write_mesh_name, std::string const &write_data_name, VectorType const &write_data, double const computed_timestep_length)
 
void read_block_data (std::string const &mesh_name, const std::string &data_name) const
 
bool is_coupling_ongoing () const
 is_coupling_ongoing Calls the preCICE API function isCouplingOnGoing
 
bool is_time_window_complete () const
 is_time_window_complete Calls the preCICE API function isTimeWindowComplete
 

Static Public Attributes

static unsigned int const rank = n_components_to_rank<data_dim, dim>()
 

Detailed Description

template<int dim, int data_dim, typename VectorType, typename VectorizedArrayType = dealii::VectorizedArray<double>>
class ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >

The Adapter class keeps together with the CouplingInterfaes all functionalities to couple deal.II to other solvers with preCICE i.e. data structures are set up, necessary information is passed to preCICE etc.

Constructor & Destructor Documentation

◆ Adapter()

template<int dim, int data_dim, typename VectorType , typename VectorizedArrayType >
template<typename ParameterClass >
ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >::Adapter ( ParameterClass const & parameters,
MPI_Comm mpi_comm )

Constructor, which sets up the precice Solverinterface.

Template Parameters
data_dimDimension of the coupling data. Equivalent to n_components in the deal.II documentation
Parameters
[in]parametersParameter class, which hold the data specified in the parameters.prm file
[in]dealii_boundary_surface_idBoundary ID of the triangulation, which is associated with the coupling surface.
[in]dataThe applied matrix-free object
[in]dof_indexIndex of the relevant dof_handler in the corresponding MatrixFree object
[in]read_quad_indexIndex of the quadrature formula in the corresponding MatrixFree object which should be used for data reading
[in]is_dirichletBoolean to distinguish between Dirichlet type solver (using the DoFs for data reading) and Neumann type solver (using quadrature points for reading)

Member Function Documentation

◆ initialize_precice()

template<int dim, int data_dim, typename VectorType , typename VectorizedArrayType >
void ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >::initialize_precice ( VectorType const & dealii_to_precice)

Initializes preCICE and passes all relevant data to preCICE.

Parameters
[in]dealii_to_preciceData, which should be given to preCICE and exchanged with other participants. Wether this data is required already in the beginning depends on your individual configuration and preCICE determines it automatically. In many cases, this data will just represent your initial condition.

◆ is_coupling_ongoing()

template<int dim, int data_dim, typename VectorType , typename VectorizedArrayType >
bool ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >::is_coupling_ongoing ( ) const
inline

is_coupling_ongoing Calls the preCICE API function isCouplingOnGoing

Returns
returns true if the coupling has not yet been finished

◆ is_time_window_complete()

template<int dim, int data_dim, typename VectorType , typename VectorizedArrayType >
bool ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >::is_time_window_complete ( ) const
inline

is_time_window_complete Calls the preCICE API function isTimeWindowComplete

Returns
returns true if the coupling time window has been completed in the current iteration

◆ reload_old_state_if_required()

template<int dim, int data_dim, typename VectorType , typename VectorizedArrayType >
void ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >::reload_old_state_if_required ( std::function< void()> const & reload_old_state)
inline

Reloads the previously stored variables in case of an implicit coupling. The current implementation supports subcycling, i.e. previously refers o the last time save_current_state_if_required() has been called.

Parameters
[out]state_variablesVector containing all variables to reload as reference
Note
This function only makes sense, if the state variables have been stored by calling save_current_state_if_required. Therefore, the order, in which the variables are passed into the vector must be the same for both functions.

◆ save_current_state_if_required()

template<int dim, int data_dim, typename VectorType , typename VectorizedArrayType >
void ExaDG::preCICE::Adapter< dim, data_dim, VectorType, VectorizedArrayType >::save_current_state_if_required ( std::function< void()> const & save_state)
inline

Saves current state of time dependent variables in case of an implicit coupling.

Parameters
[in]state_variablesVector containing all variables to store as reference
Note
This function only makes sense, if it is used with reload_old_state_if_required. Therefore, the order, in which the variables are passed into the vector must be the same for both functions.

The documentation for this class was generated from the following file: