9#include <deal.II/base/exceptions.h>
10#include <deal.II/base/quadrature_lib.h>
12#include <deal.II/dofs/dof_renumbering.h>
13#include <deal.II/dofs/dof_tools.h>
15#include <deal.II/fe/fe_q.h>
16#include <deal.II/fe/fe_system.h>
17#include <deal.II/fe/mapping_q.h>
19#include <deal.II/grid/grid_tools.h>
21#include <deal.II/lac/dynamic_sparsity_pattern.h>
22#include <deal.II/lac/sparsity_tools.h>
24#include <deal.II/numerics/data_component_interpretation.h>
36 const std::shared_ptr<parallel::DistributedTriangulationBase<dim>>
38 const std::shared_ptr<SimulationControl> &p_simulation_control)
46 TimerOutput::wall_times)
55 ExcMessage(
"The solid phase physics does not support simplex "
61 const unsigned int velocity_degree =
63 const unsigned int volume_fraction_degree =
67 fe = std::make_shared<FESystem<dim>>(FE_Q<dim>(velocity_degree),
69 FE_Q<dim>(volume_fraction_degree),
72 mapping = std::make_shared<MappingQ<dim>>(
fe->degree);
78 std::make_shared<SolutionTransfer<dim, GlobalVectorType>>(*dof_handler);
85 SolutionTransfer<dim, GlobalVectorType>(*
dof_handler));
89std::vector<OutputStruct<dim, GlobalVectorType>>
92 std::vector<OutputStruct<dim, GlobalVectorType>> solution_output_structs;
94 std::vector<std::string> solution_names(dim,
"solid_velocity");
95 solution_names.emplace_back(
"solid_volume_fraction");
97 std::vector<DataComponentInterpretation::DataComponentInterpretation>
98 component_interpretation(
99 dim, DataComponentInterpretation::component_is_part_of_vector);
100 component_interpretation.push_back(
101 DataComponentInterpretation::component_is_scalar);
103 solution_output_structs.emplace_back(
108 component_interpretation);
109 return solution_output_structs;
119 this->
pcout << std::defaultfloat;
121 this->
pcout << std::scientific;
130 (*previous_solutions)[i] = (*previous_solutions)[i - 1];
144 this->
pcout << std::defaultfloat;
146 this->
pcout << std::scientific;
164 const auto mpi_communicator =
triangulation->get_mpi_communicator();
177 (*previous_solutions)[i] = tmp_previous_solution;
184 [[maybe_unused]]
const std::pair<
const Variable,
187 [[maybe_unused]] dealii::Vector<float> &estimated_error_per_cell)
190 ExcMessage(
"Mesh adaptation based on solid phase variables is "
191 "not implemented yet."));
198 std::vector<const GlobalVectorType *> sol_set_transfer;
201 std::make_shared<SolutionTransfer<dim, GlobalVectorType>>(*dof_handler);
205 sol_set_transfer.emplace_back(&previous_solution);
214 const auto mpi_communicator =
triangulation->get_mpi_communicator();
215 this->
pcout <<
"Reading solid phase checkpoint" << std::endl;
219 input_vectors[0] = &distributed_system;
221 std::vector<GlobalVectorType> distributed_previous_solutions;
225 distributed_previous_solutions.emplace_back(
227 input_vectors[i + 1] = &distributed_previous_solutions[i];
238std::vector<OutputStructTableHandler>
241 return std::vector<OutputStructTableHandler>();
266 const auto mpi_communicator =
triangulation->get_mpi_communicator();
293 SparsityTools::distribute_sparsity_pattern(dsp,
302 this->
pcout <<
" Number of solid phase degrees of freedom: "
329 ExcMessage(
"The solid phase linear solver is not implemented "
338 ExcMessage(
"The solid phase system matrix assembly is not "
339 "implemented yet."));
347 ExcMessage(
"The solid phase right-hand side assembly is not "
348 "implemented yet."));
367 .rescale_residual_by_volume ?
unsigned int maximum_number_of_previous_solutions()
Get the maximum number of previous time steps supposed by the BDF schemes implemented in Lethe.
AuxiliaryPhysics(const Parameters::NonLinearSolver non_linear_solver_parameters)
Solid phase of the Euler-Euler model, solved as an auxiliary physics coupled to the VANS fluid dynami...
std::shared_ptr< SimulationControl > simulation_control
Simulation control.
std::shared_ptr< SolutionTransfer< dim, GlobalVectorType > > solution_transfer
Solution transfer for mesh adaptation and checkpointing.
std::shared_ptr< DoFHandler< dim > > dof_handler
DoFHandler of the solid phase.
std::vector< SolutionTransfer< dim, GlobalVectorType > > previous_solutions_transfer
GlobalVectorType system_rhs
void compute_error_estimate(const std::pair< const Variable, Parameters::MultipleAdaptationParameters > &ivar, dealii::Vector< float > &estimated_error_per_cell) override
Compute the error estimate used for mesh adaptation. Not supported yet for the solid phase.
TimerOutput computing_timer
Timer of the solid phase physics.
void solve_linear_system() override
Solve the linear system. Not implemented yet.
void assemble_system_rhs() override
Assemble the system right-hand side. Not implemented yet.
const SimulationParameters< dim > & simulation_parameters
Simulation parameters.
std::shared_ptr< FiniteElement< dim > > fe
FESystem: dim velocity components + 1 volume fraction component.
TrilinosWrappers::SparseMatrix system_matrix
std::vector< OutputStructTableHandler > gather_tables() override
Gather the post-processing tables to serialize. None yet.
void pre_mesh_adaptation() override
Prepare the solution vectors for mesh refinement/coarsening.
std::vector< OutputStruct< dim, GlobalVectorType > > gather_output_hook() override
Gather the solid velocity and solid volume fraction for output.
ContinuumSolidDynamics(MultiphysicsInterface< dim > *multiphysics_interface, const SimulationParameters< dim > &p_simulation_parameters, const std::shared_ptr< parallel::DistributedTriangulationBase< dim > > &p_triangulation, const std::shared_ptr< SimulationControl > &p_simulation_control)
Constructor of the solid phase physics.
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
Triangulation shared by all physics.
void set_initial_conditions() override
Set the initial conditions. Fields are set to zero for now.
std::shared_ptr< std::vector< GlobalVectorType > > previous_solutions
Previous solutions for the BDF time-stepping schemes.
double get_residual_rescale_metric() const override
Get the metric used to rescale the residual.
void write_checkpoint() override
Serialize the present and previous solutions for restart.
void percolate_time_vectors() override
Shift the solution history for the BDF time-stepping schemes.
IndexSet locally_relevant_dofs
std::shared_ptr< Quadrature< dim - 1 > > face_quadrature
AffineConstraints< double > zero_constraints
GlobalVectorType local_evaluation_point
void setup_dofs() override
Distribute the DoFs, allocate the vectors and matrix, and register the solid phase fields in the mult...
const FEValuesExtractors::Scalar solid_volume_fraction_extractor
void post_mesh_adaptation() override
Interpolate the solution vectors onto the adapted mesh.
std::shared_ptr< GlobalVectorType > present_solution
void read_checkpoint() override
Deserialize the present and previous solutions for restart.
IndexSet locally_owned_dofs
Locally owned and locally relevant DoFs.
std::shared_ptr< Quadrature< dim > > cell_quadrature
void finish_simulation() override
Finish the simulation (print timers).
const FEValuesExtractors::Vector solid_velocity_extractor
Extractors of the solid velocity and solid volume fraction.
GlobalVectorType evaluation_point
Solution and solver vectors.
AffineConstraints< double > nonzero_constraints
void define_constraints()
Define the constraints (hanging nodes only for now).
std::shared_ptr< Mapping< dim > > mapping
Mapping, cell and face quadratures.
GlobalVectorType newton_update
void postprocess(bool first_iteration) override
Post-process the solid phase solution. Nothing is computed yet.
void output_per_iteration_timer() override
Print the timer summary at each iteration.
void output_newton_update_norms() override
Print the norms of the Newton update.
MultiphysicsInterface< dim > * multiphysics
Multiphysics interface used to exchange fields with other physics.
void assemble_system_matrix() override
Assemble the system matrix. Not implemented yet.
PhysicsSolverStrategy< GlobalVectorType > * physics_solving_strategy
Auxiliary physics for the solid phase of the Euler-Euler (two-fluid) model.
void announce_string(const ConditionalOStream &pcout, const std::string &expression, const char delimiter='-')
Prints a string and then adds a line above and below made with dashes containing as many dashes as th...
Variable
Solution fields of the different physics that are used as an indicator for multiple purposes (e....
PhysicsID
Unique identifiers for each physics module in Lethe.
@ continuum_solid_dynamics
Euler-Euler solid phase (solid velocity, solid volume fraction).
Struct containing information about the solution output. It is used to pass all the information requi...
Mesh Adaptation Parameters that can differ for each refinement variable.
dealii::TrilinosWrappers::MPI::Vector GlobalVectorType