Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
ConservativeLevelSet< dim > Class Template Reference

#include <cls.h>

Inheritance diagram for ConservativeLevelSet< dim >:
[legend]

Public Member Functions

 ConservativeLevelSet (MultiphysicsInterface< dim > *multiphysics_interface, const SimulationParameters< dim > &p_simulation_parameters, const std::shared_ptr< parallel::DistributedTriangulationBase< dim > > &p_triangulation, std::shared_ptr< SimulationControl > p_simulation_control)
 ~ConservativeLevelSet ()=default
void assemble_rhs ()
virtual std::vector< OutputStruct< dim, GlobalVectorType > > gather_output_hook () override
double calculate_L2_error ()
template<typename VectorType>
void calculate_volume_and_mass (const GlobalVectorType &solution, const VectorType &current_solution_fd, const Parameters::FluidIndicator monitored_fluid)
template<typename VectorType>
Tensor< 1, dim > calculate_momentum (const GlobalVectorType &solution, const VectorType &current_solution_fd, const Parameters::FluidIndicator monitored_fluid)
template<typename VectorType>
std::pair< Tensor< 1, dim >, Tensor< 1, dim > > calculate_barycenter (const GlobalVectorType &solution, const VectorType &current_solution_fd)
double compute_capillary_time_step_constraint (const bool pressure_dependent, const bool temperature_dependent)
void finish_simulation () override
void percolate_time_vectors () override
void modify_solution () override
void postprocess (bool first_iteration) override
void output_per_iteration_timer () override
void pre_mesh_adaptation () override
void post_mesh_adaptation () override
void compute_error_estimate (const std::pair< const Variable, Parameters::MultipleAdaptationParameters > &ivar, dealii::Vector< float > &estimated_error_per_cell) override
void compute_kelly (dealii::Vector< float > &estimated_error_per_cell, const ComponentMask &component_mask)
void write_checkpoint () override
void read_checkpoint () override
std::vector< OutputStructTableHandler > gather_tables () override
void setup_dofs () override
void define_zero_constraints ()
void define_non_zero_constraints ()
void set_initial_conditions () override
void update_boundary_conditions () override
void solve_linear_system () override
void setup_ilu ()
void setup_amg ()
const DoFHandler< dim > & get_dof_handler () override
GlobalVectorType & get_evaluation_point () override
GlobalVectorType & get_local_evaluation_point () override
GlobalVectorType & get_newton_update () override
GlobalVectorType & get_present_solution () override
GlobalVectorType & get_system_rhs () override
AffineConstraints< double > & get_nonzero_constraints () override
const DoFHandler< dim > & get_projected_phase_indicator_gradient_dof_handler ()
const DoFHandler< dim > & get_curvature_dof_handler ()
const GlobalVectorType & get_projected_phase_indicator_gradient_solution ()
const GlobalVectorType & get_curvature_solution ()
void output_newton_update_norms () override
double get_residual_rescale_metric () const override
Public Member Functions inherited from AuxiliaryPhysics< dim, GlobalVectorType >
 AuxiliaryPhysics (const Parameters::NonLinearSolver non_linear_solver_parameters)
virtual ~AuxiliaryPhysics ()=default
void setup_preconditioner () override
virtual bool should_solve_auxiliary_physics ()
Public Member Functions inherited from PhysicsSolver< GlobalVectorType >
 PhysicsSolver (const Parameters::NonLinearSolver non_linear_solver_parameters)
virtual ~PhysicsSolver ()
void solve_governing_system ()
virtual void apply_constraints ()
virtual double get_current_residual ()
virtual bool allow_skip_linear_solve_when_residual_is_below_tolerance () const
unsigned int get_current_newton_iteration () const

Private Member Functions

void verify_consistency_of_boundary_conditions ()
void assemble_system_matrix () override
void assemble_system_matrix_cg ()
void assemble_system_matrix_dg ()
void assemble_system_rhs () override
void assemble_system_rhs_cg ()
void assemble_system_rhs_dg ()
virtual void assemble_local_system_matrix (const typename DoFHandler< dim >::active_cell_iterator &cell, CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data)
virtual void assemble_local_system_rhs (const typename DoFHandler< dim >::active_cell_iterator &cell, CLSScratchData< dim > &scratch_data, StabilizedMethodsCopyData &copy_data)
virtual void setup_assemblers ()
virtual void copy_local_matrix_to_global_matrix (const StabilizedMethodsCopyData &copy_data)
virtual void copy_local_rhs_to_global_rhs (const StabilizedMethodsCopyData &copy_data)
void update_solution_and_constraints (GlobalVectorType &solution)
void assemble_L2_projection_interface_sharpening (GlobalVectorType &solution, const double sharpening_threshold)
void solve_interface_sharpening (GlobalVectorType &solution)
void assemble_mass_matrix (TrilinosWrappers::SparseMatrix &mass_matrix)
void handle_interface_sharpening ()
double find_sharpening_threshold ()
double calculate_mass_deviation (const Parameters::FluidIndicator monitored_fluid, const double sharpening_threshold)
void sharpen_interface (GlobalVectorType &solution, const double sharpening_threshold, const bool sharpen_previous_solutions)
void smooth_phase_indicator (GlobalVectorType &solution)
void assemble_projection_phase_indicator (GlobalVectorType &solution)
void solve_projection_phase_indicator (GlobalVectorType &solution)
void apply_phase_filter (const GlobalVectorType &original_solution, GlobalVectorType &filtered_solution)
void reinitialize_interface_with_pde_based_method ()
void compute_level_set_from_phase_indicator (const GlobalVectorType &solution, GlobalVectorType &level_set_solution)
void compute_phase_indicator_from_level_set (const GlobalVectorType &level_set_solution, GlobalVectorType &phase_indicator_solution)
void reinitialize_interface_with_geometric_method ()
void reinit_face_velocity_with_adequate_solution (const typename DoFHandler< dim >::active_cell_iterator &velocity_cell, const unsigned int &face_no, CLSScratchData< dim > &scratch_data)

Private Attributes

GlobalVectorType nodal_phase_indicator_owned
MultiphysicsInterface< dim > * multiphysics
TimerOutput computing_timer
const SimulationParameters< dim > & simulation_parameters
std::shared_ptr< parallel::DistributedTriangulationBase< dim > > triangulation
std::shared_ptr< SimulationControl > simulation_control
std::shared_ptr< DoFHandler< dim > > dof_handler
std::shared_ptr< FiniteElement< dim > > fe
ConvergenceTable error_table
std::shared_ptr< Mapping< dim > > mapping
std::shared_ptr< Quadrature< dim > > cell_quadrature
std::shared_ptr< Quadrature< dim - 1 > > face_quadrature
IndexSet locally_owned_dofs
IndexSet locally_relevant_dofs
GlobalVectorType evaluation_point
GlobalVectorType local_evaluation_point
GlobalVectorType newton_update
std::shared_ptr< GlobalVectorType > present_solution
GlobalVectorType system_rhs
AffineConstraints< double > nonzero_constraints
AffineConstraints< double > bounding_constraints
AffineConstraints< double > zero_constraints
TrilinosWrappers::SparseMatrix system_matrix
std::shared_ptr< GlobalVectorType > filtered_solution
GlobalVectorType level_set
std::shared_ptr< std::vector< GlobalVectorType > > previous_solutions
std::shared_ptr< SolutionTransfer< dim, GlobalVectorType > > solution_transfer
std::vector< SolutionTransfer< dim, GlobalVectorType > > previous_solutions_transfer
TrilinosWrappers::SparseMatrix system_matrix_phase_indicator
TrilinosWrappers::SparseMatrix complete_system_matrix_phase_indicator
GlobalVectorType system_rhs_phase_indicator
GlobalVectorType complete_system_rhs_phase_indicator
TrilinosWrappers::SparseMatrix mass_matrix_phase_indicator
std::shared_ptr< CLSSubequationsInterface< dim > > cls_subequations_interface
std::shared_ptr< TrilinosWrappers::PreconditionILU > ilu_preconditioner
std::shared_ptr< TrilinosWrappers::PreconditionAMG > amg_preconditioner
const double phase_upper_bound = 1.0
const double phase_lower_bound = 0.0
TableHandler table_monitoring_cls
double volume_monitored
double mass_monitored
double mass_first_iteration
double sharpening_threshold
TableHandler table_barycenter
std::vector< TableHandler > phase_indicator_isocontour_bounding_values_tables
std::vector< std::shared_ptr< CLSAssemblerBase< dim > > > assemblers
std::shared_ptr< CLSAssemblerSIPG< dim > > inner_face_assembler
std::shared_ptr< ConservativeLevelSetFilterBase > filter
std::shared_ptr< InterfaceTools::SignedDistanceSolver< dim, GlobalVectorType > > signed_distance_solver
std::shared_ptr< SignedDistanceTransformationBase > signed_distance_transformation

Additional Inherited Members

Public Attributes inherited from PhysicsSolver< GlobalVectorType >
ConditionalOStream pcout
Parameters::SimulationControl::TimeSteppingMethod time_stepping_method

Detailed Description

template<int dim>
class ConservativeLevelSet< dim >

Definition at line 61 of file cls.h.

Constructor & Destructor Documentation

◆ ConservativeLevelSet()

◆ ~ConservativeLevelSet()

template<int dim>
ConservativeLevelSet< dim >::~ConservativeLevelSet ( )
default

CLS - Base destructor. At the present moment this is an interface with nothing.

Member Function Documentation

◆ apply_phase_filter()

template<int dim>
void ConservativeLevelSet< dim >::apply_phase_filter ( const GlobalVectorType & original_solution,
GlobalVectorType & filtered_solution )
private

Apply filter on phase indicator values.

Parameters
[in]original_solutionCLS solution vector to which the filter is to be applied.
[out]filtered_solutionSolution vector with filtered phase indicator values.

Definition at line 3482 of file cls.cc.

References filter, filtered_solution, locally_owned_dofs, ConservativeLevelSetFilterBase::model_cast(), PhysicsSolver< GlobalVectorType >::pcout, simulation_parameters, triangulation, and Parameters::verbose.

◆ assemble_L2_projection_interface_sharpening()

template<int dim>
void ConservativeLevelSet< dim >::assemble_L2_projection_interface_sharpening ( GlobalVectorType & solution,
const double sharpening_threshold )
private

Assemble the system for interface sharpening.

Parameters
solutionCLS solution (phase indicator)
sharpening_thresholdInterface sharpening threshold that represents the mass conservation level

Definition at line 3286 of file cls.cc.

References cell_quadrature, dof_handler, fe, mapping, nonzero_constraints, sharpening_threshold, simulation_parameters, system_matrix_phase_indicator, and system_rhs_phase_indicator.

◆ assemble_local_system_matrix()

template<int dim>
void ConservativeLevelSet< dim >::assemble_local_system_matrix ( const typename DoFHandler< dim >::active_cell_iterator & cell,
CLSScratchData< dim > & scratch_data,
StabilizedMethodsCopyData & copy_data )
privatevirtual

Assemble the local matrix for a given cell.

This function is used by the WorkStream class to assemble the system matrix. It is a thread safe function.

Parameters
cellThe cell for which the local matrix is assembled.
scratch_dataThe scratch data which is used to store the calculated finite element information at the gauss point. See the documentation for CLSScratchData for more information
copy_dataThe copy data which is used to store the results of the assembly over a cell

Definition at line 378 of file cls.cc.

References assemblers, StabilizedMethodsCopyData::cell_is_local, evaluation_point, fluid_dynamics, StabilizedMethodsCopyData::local_dof_indices, multiphysics, previous_solutions, CLSScratchData< dim >::reinit(), CLSScratchData< dim >::reinit_velocity(), StabilizedMethodsCopyData::reset(), simulation_control, simulation_parameters, and triangulation.

◆ assemble_local_system_rhs()

template<int dim>
void ConservativeLevelSet< dim >::assemble_local_system_rhs ( const typename DoFHandler< dim >::active_cell_iterator & cell,
CLSScratchData< dim > & scratch_data,
StabilizedMethodsCopyData & copy_data )
privatevirtual

Assemble the local rhs for a given cell.

Parameters
cellThe cell for which the local matrix is assembled.
scratch_dataThe scratch data which is used to store the calculated finite element information at the gauss point. See the documentation for CLSScratchData for more information
copy_dataThe copy data which is used to store the results of the assembly over a cell

Definition at line 623 of file cls.cc.

References assemblers, StabilizedMethodsCopyData::cell_is_local, evaluation_point, fluid_dynamics, StabilizedMethodsCopyData::local_dof_indices, multiphysics, previous_solutions, CLSScratchData< dim >::reinit(), CLSScratchData< dim >::reinit_velocity(), StabilizedMethodsCopyData::reset(), simulation_control, simulation_parameters, and triangulation.

◆ assemble_mass_matrix()

template<int dim>
void ConservativeLevelSet< dim >::assemble_mass_matrix ( TrilinosWrappers::SparseMatrix & mass_matrix)
private

Assembles a mass_matrix which is used in update_solution_and_constraints function to limit the phase indicators of cells in the range of [0,1] before sharpening the interface. More information can be found in step_41 of deal.II tutorials: https://www.dealii.org/current/doxygen/deal.II/step_41.html.

Parameters
mass_matrix

Definition at line 3447 of file cls.cc.

References cell_quadrature, dof_handler, fe, and nonzero_constraints.

◆ assemble_projection_phase_indicator()

template<int dim>
void ConservativeLevelSet< dim >::assemble_projection_phase_indicator ( GlobalVectorType & solution)
private

Assembles the matrix and rhs for calculation of a smooth phase indicator using a projection.

Parameters
solutionCLS solution (phase indicator)

Definition at line 2307 of file cls.cc.

References cell_quadrature, compute_cell_diameter(), compute_cell_measure_with_JxW(), dof_handler, fe, mapping, nonzero_constraints, simulation_parameters, system_matrix_phase_indicator, and system_rhs_phase_indicator.

◆ assemble_rhs()

template<int dim>
void ConservativeLevelSet< dim >::assemble_rhs ( )

Call for the assembly of the right-hand side.

Deprecated
This function is to be deprecated when the new assembly mechanism is integrated to this solver

Definition at line 180 of file cls.cc.

References assemble_system_rhs().

◆ assemble_system_matrix()

template<int dim>
void ConservativeLevelSet< dim >::assemble_system_matrix ( )
overrideprivatevirtual

Assembles the matrix associated with the solver.

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 231 of file cls.cc.

References assemble_system_matrix_cg(), assemble_system_matrix_dg(), computing_timer, setup_assemblers(), simulation_parameters, and system_matrix.

◆ assemble_system_matrix_cg()

template<int dim>
void ConservativeLevelSet< dim >::assemble_system_matrix_cg ( )
private

Assemble the matrix associated with the solver when CG elements are used.

Definition at line 246 of file cls.cc.

References assemble_local_system_matrix(), copy_local_matrix_to_global_matrix(), dof_handler, fe, fluid_dynamics, multiphysics, simulation_control, simulation_parameters, and system_matrix.

◆ assemble_system_matrix_dg()

◆ assemble_system_rhs()

template<int dim>
void ConservativeLevelSet< dim >::assemble_system_rhs ( )
overrideprivatevirtual

Assemble the rhs associated with the solver.

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 479 of file cls.cc.

References assemble_system_rhs_cg(), assemble_system_rhs_dg(), computing_timer, setup_assemblers(), simulation_parameters, and system_rhs.

◆ assemble_system_rhs_cg()

template<int dim>
void ConservativeLevelSet< dim >::assemble_system_rhs_cg ( )
private

Assemble the rhs associated with the solver when CG elements are used.

Definition at line 496 of file cls.cc.

References assemble_local_system_rhs(), copy_local_rhs_to_global_rhs(), dof_handler, fe, fluid_dynamics, multiphysics, simulation_control, simulation_parameters, and system_rhs.

◆ assemble_system_rhs_dg()

◆ calculate_barycenter()

template<int dim>
template<typename VectorType>
template std::pair< Tensor< 1, 3 >, Tensor< 1, 3 > > ConservativeLevelSet< dim >::calculate_barycenter< GlobalBlockVectorType > ( const GlobalVectorType & solution,
const VectorType & current_solution_fd )

Calculates the barycenter of the fluid and its velocity.

Parameters
[in]solutionCLS solution
[in]current_solution_fdFluid dynamics solution

Definition at line 872 of file cls.cc.

References cell_quadrature, dof_handler, fe, filter, fluid_dynamics, mapping, ConservativeLevelSetFilterBase::model_cast(), multiphysics, simulation_parameters, triangulation, and velocity.

◆ calculate_L2_error()

template<int dim>
double ConservativeLevelSet< dim >::calculate_L2_error ( )

Calculates the L2 error of the solution.

Definition at line 826 of file cls.cc.

References cell_quadrature, dof_handler, fe, mapping, present_solution, simulation_control, simulation_parameters, and triangulation.

◆ calculate_mass_deviation()

template<int dim>
double ConservativeLevelSet< dim >::calculate_mass_deviation ( const Parameters::FluidIndicator monitored_fluid,
const double sharpening_threshold )
private

Calculate the mass deviation of the monitored fluid, between the current iteration and the mass at first iteration (mass_first_iteration). Used to test multiple sharpening threshold in the binary search algorithm (adaptive sharpening).

Parameters
monitored_fluidFluid indicator (fluid_0 or fluid_1) corresponding to the phase of interest.
sharpening_thresholdInterface sharpening threshold that represents the mass conservation level

Definition at line 2233 of file cls.cc.

References calculate_volume_and_mass(), evaluation_point, fluid_dynamics, mass_first_iteration, mass_monitored, multiphysics, present_solution, sharpen_interface(), and sharpening_threshold.

◆ calculate_momentum()

template<int dim>
template<typename VectorType>
Tensor< 1, dim > ConservativeLevelSet< dim >::calculate_momentum ( const GlobalVectorType & solution,
const VectorType & current_solution_fd,
const Parameters::FluidIndicator monitored_fluid )

Calculates the momentum for a given fluid phase. Used for conservation monitoring.

Parameters
[in]solutionCLS solution (phase indicator)
[in]current_solution_fdcurrent solution for the fluid dynamics
[in]monitored_fluidFluid indicator (fluid_0 or fluid_1) corresponding to the phase of interest.
Returns
A tensor<1,dim> corresponding to the entry_string in the prm file.

Definition at line 1084 of file cls.cc.

References cell_quadrature, dof_handler, fe, Parameters::fluid_0, Parameters::fluid_1, fluid_dynamics, mapping, multiphysics, pressure, set_field_vector(), simulation_parameters, triangulation, and velocity.

◆ calculate_volume_and_mass()

template<int dim>
template<typename VectorType>
void ConservativeLevelSet< dim >::calculate_volume_and_mass ( const GlobalVectorType & solution,
const VectorType & current_solution_fd,
const Parameters::FluidIndicator monitored_fluid )

Calculates the volume and mass for a given fluid phase. Used for conservation monitoring.

Parameters
solutionCLS solution (phase indicator)
current_solution_fdcurrent solution for the fluid dynamics
monitored_fluidFluid indicator (fluid_0 or fluid_1) corresponding to the phase of interest.

Definition at line 980 of file cls.cc.

References cell_quadrature, dof_handler, fe, Parameters::fluid_0, Parameters::fluid_1, fluid_dynamics, mapping, mass_monitored, multiphysics, pressure, set_field_vector(), simulation_parameters, triangulation, and volume_monitored.

◆ compute_capillary_time_step_constraint()

template<int dim>
double ConservativeLevelSet< dim >::compute_capillary_time_step_constraint ( const bool pressure_dependent,
const bool temperature_dependent )

Computes the capillary time-step constraint.

The time-step constraint for capillary-driven multiphase flows is computed according to [1]:

\[\Delta t_\sigma = \sqrt{\frac{(\rho_0 + \rho_1) h^3}{2 \pi \sigma}} \]

Parameters
[in]pressure_dependentBoolean indicating if the pressure field is required. The DensityIsothermalIdealGas model requires the pressure field to compute the density.
[in]temperature_dependentBoolean indicating if the temperature field is required. The SurfaceTensionLinear and SurfaceTensionPhaseChange models depend on the temperature field.
Returns
Computed value of the capillary time-step constraint

Reference:

[1] F. Denner, F. Evrard, and B. van Wachem, “Breaching the capillary time-step constraint using a coupled VOF method with implicit surface tension,” J. Comput. Phys., vol. 459, p. 111128, Jun. 2022, doi: 10.1016/j.jcp.2022.111128

Definition at line 1188 of file cls.cc.

References cell_quadrature, compute_cell_diameter(), compute_cell_measure_with_JxW(), dof_handler, fe, fluid_dynamics, heat_transfer, mapping, multiphysics, pressure, set_field_vector(), simulation_parameters, temperature, and triangulation.

◆ compute_error_estimate()

template<int dim>
void ConservativeLevelSet< dim >::compute_error_estimate ( const std::pair< const Variable, Parameters::MultipleAdaptationParameters > & ivar,
dealii::Vector< float > & estimated_error_per_cell )
overridevirtual

Compute the error estimator for mesh refinement.

Parameters
[in]ivarThe current element of the map simulation_parameters.mesh_adaptation.variables
[in,out]estimated_error_per_cellThe deal.II vector of estimated_error_per_cell

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 2513 of file cls.cc.

References compute_kelly(), fe, Parameters::MultipleAdaptationParameters::kelly, and phase.

◆ compute_kelly()

template<int dim>
void ConservativeLevelSet< dim >::compute_kelly ( dealii::Vector< float > & estimated_error_per_cell,
const ComponentMask & component_mask )

Compute the Kelly error estimator on the phase variable for mesh refinement. See : https://www.dealii.org/current/doxygen/deal.II/classKellyErrorEstimator.html for more information on the Kelly error estimator.

Parameters
[in,out]estimated_error_per_cellThe deal.II vector of estimated_error_per_cell
[in]component_maskThe component mask corresponding to the phase variable

Definition at line 2536 of file cls.cc.

References dof_handler, face_quadrature, mapping, and present_solution.

◆ compute_level_set_from_phase_indicator()

template<int dim>
void ConservativeLevelSet< dim >::compute_level_set_from_phase_indicator ( const GlobalVectorType & solution,
GlobalVectorType & level_set_solution )
private

Compute level-set field from the phase indicator field using an inverse tanh-based transformation.

Parameters
[in]solutionPhase indicator solution field
[out]level_set_solutionLevel-set solution field

Definition at line 3580 of file cls.cc.

References locally_owned_dofs, nonzero_constraints, phase, and triangulation.

◆ compute_phase_indicator_from_level_set()

template<int dim>
void ConservativeLevelSet< dim >::compute_phase_indicator_from_level_set ( const GlobalVectorType & level_set_solution,
GlobalVectorType & phase_indicator_solution )
private

Compute the phase indicator field from level-set field using a tanh-based transformation.

Parameters
[in]level_set_solutionLevel-set solution field
[out]phase_indicator_solutionPhase indicator solution field

Definition at line 3601 of file cls.cc.

References locally_owned_dofs, nonzero_constraints, signed_distance_transformation, and triangulation.

◆ copy_local_matrix_to_global_matrix()

template<int dim>
void ConservativeLevelSet< dim >::copy_local_matrix_to_global_matrix ( const StabilizedMethodsCopyData & copy_data)
privatevirtual

Copy local cell information to global matrix.

Definition at line 465 of file cls.cc.

References StabilizedMethodsCopyData::cell_is_local, StabilizedMethodsCopyData::local_dof_indices, StabilizedMethodsCopyData::local_matrix, and zero_constraints.

◆ copy_local_rhs_to_global_rhs()

template<int dim>
void ConservativeLevelSet< dim >::copy_local_rhs_to_global_rhs ( const StabilizedMethodsCopyData & copy_data)
privatevirtual

Copy local cell rhs information to global rhs.

Definition at line 710 of file cls.cc.

References StabilizedMethodsCopyData::cell_is_local, StabilizedMethodsCopyData::local_dof_indices, StabilizedMethodsCopyData::local_rhs, and zero_constraints.

◆ define_non_zero_constraints()

template<int dim>
void ConservativeLevelSet< dim >::define_non_zero_constraints ( )

defined the non zero constraints used to solve the problem.

Definition at line 2889 of file cls.cc.

References BoundaryConditions::dirichlet, dof_handler, locally_owned_dofs, locally_relevant_dofs, nonzero_constraints, BoundaryConditions::periodic, and simulation_parameters.

◆ define_zero_constraints()

template<int dim>
void ConservativeLevelSet< dim >::define_zero_constraints ( )

defined the zero constraints used to solve the problem.

Definition at line 2850 of file cls.cc.

References BoundaryConditions::dirichlet, dof_handler, locally_owned_dofs, locally_relevant_dofs, BoundaryConditions::periodic, simulation_parameters, and zero_constraints.

◆ find_sharpening_threshold()

template<int dim>
double ConservativeLevelSet< dim >::find_sharpening_threshold ( )
private

Find the sharpening threshold to ensure mass conservation of the fluid monitored, as given in the prm (CLS, subsection monitoring), by binary search.

Definition at line 2107 of file cls.cc.

References calculate_mass_deviation(), mass_first_iteration, mass_monitored, PhysicsSolver< GlobalVectorType >::pcout, Parameters::quiet, and simulation_parameters.

◆ finish_simulation()

template<int dim>
void ConservativeLevelSet< dim >::finish_simulation ( )
overridevirtual

◆ gather_output_hook()

template<int dim>
std::vector< OutputStruct< dim, GlobalVectorType > > ConservativeLevelSet< dim >::gather_output_hook ( )
overridevirtual

Gather and return vector of output structs that are particular to some applications.

Returns
Vector of OutputStructs that will be used to write the output results as VTU files.

Reimplemented from AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 724 of file cls.cc.

References cls_subequations_interface, computing_timer, curvature_projection, dof_handler, filtered_solution, phase_gradient_projection, present_solution, signed_distance_solver, simulation_control, and simulation_parameters.

◆ gather_tables()

template<int dim>
std::vector< OutputStructTableHandler > ConservativeLevelSet< dim >::gather_tables ( )
overridevirtual

Returns a vector of references to TableHandler objects that needs to be serialized/deserialized for the CLS solver.

Returns
Structure containing a vector of references to TableHandler objects that needs to be serialized/deserialized for the CLS solver, and their corresponding file names.

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 2552 of file cls.cc.

References error_table, phase, phase_indicator_isocontour_bounding_values_tables, simulation_parameters, table_barycenter, and table_monitoring_cls.

◆ get_curvature_dof_handler()

template<int dim>
const DoFHandler< dim > & ConservativeLevelSet< dim >::get_curvature_dof_handler ( )
inline

Definition at line 392 of file cls.h.

References cls_subequations_interface, and curvature_projection.

◆ get_curvature_solution()

template<int dim>
const GlobalVectorType & ConservativeLevelSet< dim >::get_curvature_solution ( )
inline

Definition at line 406 of file cls.h.

References cls_subequations_interface, and curvature_projection.

◆ get_dof_handler()

template<int dim>
const DoFHandler< dim > & ConservativeLevelSet< dim >::get_dof_handler ( )
inlineoverridevirtual

Getter methods to get the private attributes for the physic currently solved NB : dof_handler and present_solution are passed to the multiphysics interface at the end of the setup_dofs method.

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 343 of file cls.h.

References dof_handler.

◆ get_evaluation_point()

template<int dim>
GlobalVectorType & ConservativeLevelSet< dim >::get_evaluation_point ( )
inlineoverridevirtual

Getter methods that give access to the private attributes of the physics being solved. These methods must be provided by the physics as they are the key to solve a problem using Lethe.

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 349 of file cls.h.

References evaluation_point.

◆ get_local_evaluation_point()

template<int dim>
GlobalVectorType & ConservativeLevelSet< dim >::get_local_evaluation_point ( )
inlineoverridevirtual

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 355 of file cls.h.

References local_evaluation_point.

◆ get_newton_update()

template<int dim>
GlobalVectorType & ConservativeLevelSet< dim >::get_newton_update ( )
inlineoverridevirtual

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 361 of file cls.h.

References newton_update.

◆ get_nonzero_constraints()

template<int dim>
AffineConstraints< double > & ConservativeLevelSet< dim >::get_nonzero_constraints ( )
inlineoverridevirtual

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 379 of file cls.h.

References nonzero_constraints.

◆ get_present_solution()

template<int dim>
GlobalVectorType & ConservativeLevelSet< dim >::get_present_solution ( )
inlineoverridevirtual

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 367 of file cls.h.

References present_solution.

◆ get_projected_phase_indicator_gradient_dof_handler()

template<int dim>
const DoFHandler< dim > & ConservativeLevelSet< dim >::get_projected_phase_indicator_gradient_dof_handler ( )
inline

Definition at line 385 of file cls.h.

References cls_subequations_interface, and phase_gradient_projection.

◆ get_projected_phase_indicator_gradient_solution()

template<int dim>
const GlobalVectorType & ConservativeLevelSet< dim >::get_projected_phase_indicator_gradient_solution ( )
inline

Definition at line 399 of file cls.h.

References cls_subequations_interface, and phase_gradient_projection.

◆ get_residual_rescale_metric()

template<int dim>
double ConservativeLevelSet< dim >::get_residual_rescale_metric ( ) const
inlineoverridevirtual

Return the metric for residual rescaling. By default, should return 1. If the rescale_residual_by_volume is set to true, the method returns the square root of the global volume of the triangulation.

Returns
Rescale metric.

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 431 of file cls.h.

References CLS, mapping, simulation_parameters, and triangulation.

◆ get_system_rhs()

template<int dim>
GlobalVectorType & ConservativeLevelSet< dim >::get_system_rhs ( )
inlineoverridevirtual

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 373 of file cls.h.

References system_rhs.

◆ handle_interface_sharpening()

template<int dim>
void ConservativeLevelSet< dim >::handle_interface_sharpening ( )
private

Carries out interface sharpening. It is called in the modify solution function. Launches sharpen_interface with the possibility to ensure conservation and handles output messages.

Definition at line 2064 of file cls.cc.

References Parameters::adaptive, find_sharpening_threshold(), PhysicsSolver< GlobalVectorType >::pcout, present_solution, Parameters::quiet, sharpen_interface(), sharpening_threshold, simulation_control, and simulation_parameters.

◆ modify_solution()

◆ output_newton_update_norms()

template<int dim>
void ConservativeLevelSet< dim >::output_newton_update_norms ( )
inlineoverridevirtual

Output the L2 and Linfty norms of the correction vector.

Implements PhysicsSolver< GlobalVectorType >.

Definition at line 415 of file cls.h.

References newton_update, and PhysicsSolver< GlobalVectorType >::pcout.

◆ output_per_iteration_timer()

template<int dim>
void ConservativeLevelSet< dim >::output_per_iteration_timer ( )
overridevirtual

Output the per iteration wallclock times.

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 1996 of file cls.cc.

References announce_string(), computing_timer, and PhysicsSolver< GlobalVectorType >::pcout.

◆ percolate_time_vectors()

template<int dim>
void ConservativeLevelSet< dim >::percolate_time_vectors ( )
overridevirtual

Carry out the operations required to rearrange the values of the previous solution at the end of a time step.

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 1374 of file cls.cc.

References present_solution, and previous_solutions.

◆ post_mesh_adaptation()

template<int dim>
void ConservativeLevelSet< dim >::post_mesh_adaptation ( )
overridevirtual

post_mesh_adaption Interpolates the auxiliary physics variables to the new mesh

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 2481 of file cls.cc.

References apply_phase_filter(), filtered_solution, locally_owned_dofs, nonzero_constraints, present_solution, previous_solutions, previous_solutions_transfer, solution_transfer, and triangulation.

◆ postprocess()

◆ pre_mesh_adaptation()

template<int dim>
void ConservativeLevelSet< dim >::pre_mesh_adaptation ( )
overridevirtual

pre_mesh_adaption Prepares the auxiliary physics variables for a mesh refinement/coarsening

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 2466 of file cls.cc.

References present_solution, previous_solutions, previous_solutions_transfer, and solution_transfer.

◆ read_checkpoint()

◆ reinit_face_velocity_with_adequate_solution()

template<int dim>
void ConservativeLevelSet< dim >::reinit_face_velocity_with_adequate_solution ( const typename DoFHandler< dim >::active_cell_iterator & velocity_cell,
const unsigned int & face_no,
CLSScratchData< dim > & scratch_data )
inlineprivate

Helper function to reinit the face velocity with the adequate solution. This prevents code duplication throughout the CLS class. The function looks at the multiphysics interface to decide if the velocity is a block velocity or a regular velocity. Furthermore, it also checks if a time-averaged solution is required. Otherwise, the code here would be copied four times.

Parameters
[in]velocity_cellthe iterator of the cell where the velocity is to be reinitialized.
[in]face_nothe face index where the velocity is to be reinitialized.
[in,out]scratch_datathe scratch data to be used for the reinitialization.

Definition at line 751 of file cls.h.

References fluid_dynamics, multiphysics, and CLSScratchData< dim >::reinit_face_velocity().

◆ reinitialize_interface_with_geometric_method()

template<int dim>
void ConservativeLevelSet< dim >::reinitialize_interface_with_geometric_method ( )
private

◆ reinitialize_interface_with_pde_based_method()

template<int dim>
void ConservativeLevelSet< dim >::reinitialize_interface_with_pde_based_method ( )
private

◆ set_initial_conditions()

◆ setup_amg()

template<int dim>
void ConservativeLevelSet< dim >::setup_amg ( )

Set up the AMG preconditioner stored in amg_preconditioner.

Definition at line 3058 of file cls.cc.

References amg_preconditioner, CLS, computing_timer, dof_handler, fe, simulation_parameters, and system_matrix.

◆ setup_assemblers()

template<int dim>
void ConservativeLevelSet< dim >::setup_assemblers ( )
privatevirtual

sets up the vector of assembler functions

Definition at line 188 of file cls.cc.

References assemblers, inner_face_assembler, simulation_control, simulation_parameters, time_stepping_is_bdf(), and time_stepping_is_sdirk().

◆ setup_dofs()

◆ setup_ilu()

template<int dim>
void ConservativeLevelSet< dim >::setup_ilu ( )

Set up the ILU preconditioner stored in ilu_preconditioner.

Definition at line 3038 of file cls.cc.

References CLS, computing_timer, ilu_preconditioner, simulation_parameters, and system_matrix.

◆ sharpen_interface()

template<int dim>
void ConservativeLevelSet< dim >::sharpen_interface ( GlobalVectorType & solution,
const double sharpening_threshold,
const bool sharpen_previous_solutions )
private

Carries out interface sharpening. It is called in the modify solution function.

Parameters
solutionCLS solution (phase indicator)
sharpening_thresholdInterface sharpening threshold that represents the mass conservation level
sharpen_previous_solutionsBoolean true if sharpening is applied on the present and past solutions, false if the sharpening is applied on the given solution vector only. Used to determine the sharpening threshold by binary search.

Definition at line 2258 of file cls.cc.

References assemble_L2_projection_interface_sharpening(), previous_solutions, sharpening_threshold, solve_interface_sharpening(), and update_solution_and_constraints().

◆ smooth_phase_indicator()

template<int dim>
void ConservativeLevelSet< dim >::smooth_phase_indicator ( GlobalVectorType & solution)
private

Carries out the smoothing phase indicator with a projection step (to avoid a staircase interface).

Definition at line 2298 of file cls.cc.

References assemble_projection_phase_indicator(), and solve_projection_phase_indicator().

◆ solve_interface_sharpening()

template<int dim>
void ConservativeLevelSet< dim >::solve_interface_sharpening ( GlobalVectorType & solution)
private

Solves the assembled system to sharpen the interface. The linear_solver_tolerance is hardcoded = 1e-15, and an ILU Preconditioner is used. After solving the system, this function overwrites the solution with the sharpened solution.

Parameters
solutionCLS solution (phase indicator)

Definition at line 3379 of file cls.cc.

References CLS, Parameters::extra_verbose, ilu_preconditioner, locally_owned_dofs, nonzero_constraints, PhysicsSolver< GlobalVectorType >::pcout, simulation_parameters, system_matrix_phase_indicator, system_rhs_phase_indicator, and triangulation.

◆ solve_linear_system()

template<int dim>
void ConservativeLevelSet< dim >::solve_linear_system ( )
overridevirtual

◆ solve_projection_phase_indicator()

template<int dim>
void ConservativeLevelSet< dim >::solve_projection_phase_indicator ( GlobalVectorType & solution)
private

Solves smooth phase indicator system.

Parameters
solutionCLS solution (phase indicator)

Definition at line 2412 of file cls.cc.

References CLS, ilu_preconditioner, locally_owned_dofs, nonzero_constraints, PhysicsSolver< GlobalVectorType >::pcout, Parameters::quiet, simulation_parameters, system_matrix_phase_indicator, system_rhs_phase_indicator, and triangulation.

◆ update_boundary_conditions()

template<int dim>
void ConservativeLevelSet< dim >::update_boundary_conditions ( )
overridevirtual

Update non zero constraints if the boundary is time dependent.

Reimplemented from AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 2828 of file cls.cc.

References define_non_zero_constraints(), BoundaryConditions::dirichlet, simulation_control, and simulation_parameters.

◆ update_solution_and_constraints()

template<int dim>
void ConservativeLevelSet< dim >::update_solution_and_constraints ( GlobalVectorType & solution)
private

Limit the phase indicators between 0 and 1. This is necessary before interface sharpening. More information can be found in step_41 of deal.II tutorials: https://www.dealii.org/current/doxygen/deal.II/step_41.html.

Definition at line 3211 of file cls.cc.

References bounding_constraints, complete_system_matrix_phase_indicator, dof_handler, locally_owned_dofs, mass_matrix_phase_indicator, nodal_phase_indicator_owned, phase_lower_bound, phase_upper_bound, system_rhs_phase_indicator, and triangulation.

◆ verify_consistency_of_boundary_conditions()

template<int dim>
void ConservativeLevelSet< dim >::verify_consistency_of_boundary_conditions ( )
inlineprivate

Verify consistency of the input parameters for boundary conditions to ensure that for every boundary condition within the triangulation, a boundary condition has been specified in the input file.

Definition at line 447 of file cls.h.

References simulation_parameters, and triangulation.

◆ write_checkpoint()

template<int dim>
void ConservativeLevelSet< dim >::write_checkpoint ( )
overridevirtual

Prepares auxiliary physics to write checkpoint.

Implements AuxiliaryPhysics< dim, GlobalVectorType >.

Definition at line 2609 of file cls.cc.

References gather_tables(), present_solution, previous_solutions, serialize_tables_vector(), solution_transfer, and triangulation.

Member Data Documentation

◆ amg_preconditioner

template<int dim>
std::shared_ptr<TrilinosWrappers::PreconditionAMG> ConservativeLevelSet< dim >::amg_preconditioner
private

AMG preconditioner used by the iterative linear solver of the main conservative level set system.

Definition at line 839 of file cls.h.

◆ assemblers

template<int dim>
std::vector<std::shared_ptr<CLSAssemblerBase<dim> > > ConservativeLevelSet< dim >::assemblers
private

Definition at line 862 of file cls.h.

◆ bounding_constraints

template<int dim>
AffineConstraints<double> ConservativeLevelSet< dim >::bounding_constraints
private

Definition at line 805 of file cls.h.

◆ cell_quadrature

template<int dim>
std::shared_ptr<Quadrature<dim> > ConservativeLevelSet< dim >::cell_quadrature
private

Definition at line 792 of file cls.h.

◆ cls_subequations_interface

template<int dim>
std::shared_ptr<CLSSubequationsInterface<dim> > ConservativeLevelSet< dim >::cls_subequations_interface
private

Definition at line 831 of file cls.h.

◆ complete_system_matrix_phase_indicator

template<int dim>
TrilinosWrappers::SparseMatrix ConservativeLevelSet< dim >::complete_system_matrix_phase_indicator
private

Definition at line 824 of file cls.h.

◆ complete_system_rhs_phase_indicator

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::complete_system_rhs_phase_indicator
private

Definition at line 826 of file cls.h.

◆ computing_timer

template<int dim>
TimerOutput ConservativeLevelSet< dim >::computing_timer
private

Definition at line 779 of file cls.h.

◆ dof_handler

template<int dim>
std::shared_ptr<DoFHandler<dim> > ConservativeLevelSet< dim >::dof_handler
private

Definition at line 786 of file cls.h.

◆ error_table

template<int dim>
ConvergenceTable ConservativeLevelSet< dim >::error_table
private

Definition at line 788 of file cls.h.

◆ evaluation_point

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::evaluation_point
private

Definition at line 799 of file cls.h.

◆ face_quadrature

template<int dim>
std::shared_ptr<Quadrature<dim - 1> > ConservativeLevelSet< dim >::face_quadrature
private

Definition at line 793 of file cls.h.

◆ fe

template<int dim>
std::shared_ptr<FiniteElement<dim> > ConservativeLevelSet< dim >::fe
private

Definition at line 787 of file cls.h.

◆ filter

template<int dim>
std::shared_ptr<ConservativeLevelSetFilterBase> ConservativeLevelSet< dim >::filter
private

Definition at line 868 of file cls.h.

◆ filtered_solution

template<int dim>
std::shared_ptr<GlobalVectorType> ConservativeLevelSet< dim >::filtered_solution
private

Definition at line 808 of file cls.h.

◆ ilu_preconditioner

template<int dim>
std::shared_ptr<TrilinosWrappers::PreconditionILU> ConservativeLevelSet< dim >::ilu_preconditioner
private

Definition at line 833 of file cls.h.

◆ inner_face_assembler

template<int dim>
std::shared_ptr<CLSAssemblerSIPG<dim> > ConservativeLevelSet< dim >::inner_face_assembler
private

Definition at line 865 of file cls.h.

◆ level_set

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::level_set
private

Level-set field obtained from the phase indicator field using a tanh-based transformation

Definition at line 812 of file cls.h.

◆ local_evaluation_point

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::local_evaluation_point
private

Definition at line 800 of file cls.h.

◆ locally_owned_dofs

template<int dim>
IndexSet ConservativeLevelSet< dim >::locally_owned_dofs
private

Definition at line 796 of file cls.h.

◆ locally_relevant_dofs

template<int dim>
IndexSet ConservativeLevelSet< dim >::locally_relevant_dofs
private

Definition at line 797 of file cls.h.

◆ mapping

template<int dim>
std::shared_ptr<Mapping<dim> > ConservativeLevelSet< dim >::mapping
private

Definition at line 791 of file cls.h.

◆ mass_first_iteration

template<int dim>
double ConservativeLevelSet< dim >::mass_first_iteration
private

Definition at line 849 of file cls.h.

◆ mass_matrix_phase_indicator

template<int dim>
TrilinosWrappers::SparseMatrix ConservativeLevelSet< dim >::mass_matrix_phase_indicator
private

Definition at line 827 of file cls.h.

◆ mass_monitored

template<int dim>
double ConservativeLevelSet< dim >::mass_monitored
private

Definition at line 848 of file cls.h.

◆ multiphysics

template<int dim>
MultiphysicsInterface<dim>* ConservativeLevelSet< dim >::multiphysics
private

Definition at line 777 of file cls.h.

◆ newton_update

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::newton_update
private

Definition at line 801 of file cls.h.

◆ nodal_phase_indicator_owned

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::nodal_phase_indicator_owned
private

Definition at line 775 of file cls.h.

◆ nonzero_constraints

template<int dim>
AffineConstraints<double> ConservativeLevelSet< dim >::nonzero_constraints
private

Definition at line 804 of file cls.h.

◆ phase_indicator_isocontour_bounding_values_tables

template<int dim>
std::vector<TableHandler> ConservativeLevelSet< dim >::phase_indicator_isocontour_bounding_values_tables
private

Vector of tables containing evolution of phase indicator isocontour bounding values.

Definition at line 859 of file cls.h.

◆ phase_lower_bound

template<int dim>
const double ConservativeLevelSet< dim >::phase_lower_bound = 0.0
private

Definition at line 843 of file cls.h.

◆ phase_upper_bound

template<int dim>
const double ConservativeLevelSet< dim >::phase_upper_bound = 1.0
private

Definition at line 842 of file cls.h.

◆ present_solution

template<int dim>
std::shared_ptr<GlobalVectorType> ConservativeLevelSet< dim >::present_solution
private

Definition at line 802 of file cls.h.

◆ previous_solutions

template<int dim>
std::shared_ptr<std::vector<GlobalVectorType> > ConservativeLevelSet< dim >::previous_solutions
private

Definition at line 815 of file cls.h.

◆ previous_solutions_transfer

template<int dim>
std::vector<SolutionTransfer<dim, GlobalVectorType> > ConservativeLevelSet< dim >::previous_solutions_transfer
private

Definition at line 820 of file cls.h.

◆ sharpening_threshold

template<int dim>
double ConservativeLevelSet< dim >::sharpening_threshold
private

Definition at line 850 of file cls.h.

◆ signed_distance_solver

template<int dim>
std::shared_ptr<InterfaceTools::SignedDistanceSolver<dim, GlobalVectorType> > ConservativeLevelSet< dim >::signed_distance_solver
private

Definition at line 872 of file cls.h.

◆ signed_distance_transformation

template<int dim>
std::shared_ptr<SignedDistanceTransformationBase> ConservativeLevelSet< dim >::signed_distance_transformation
private

Definition at line 876 of file cls.h.

◆ simulation_control

template<int dim>
std::shared_ptr<SimulationControl> ConservativeLevelSet< dim >::simulation_control
private

Definition at line 785 of file cls.h.

◆ simulation_parameters

template<int dim>
const SimulationParameters<dim>& ConservativeLevelSet< dim >::simulation_parameters
private

Definition at line 781 of file cls.h.

◆ solution_transfer

template<int dim>
std::shared_ptr<SolutionTransfer<dim, GlobalVectorType> > ConservativeLevelSet< dim >::solution_transfer
private

Definition at line 818 of file cls.h.

◆ system_matrix

template<int dim>
TrilinosWrappers::SparseMatrix ConservativeLevelSet< dim >::system_matrix
private

Definition at line 807 of file cls.h.

◆ system_matrix_phase_indicator

template<int dim>
TrilinosWrappers::SparseMatrix ConservativeLevelSet< dim >::system_matrix_phase_indicator
private

Definition at line 823 of file cls.h.

◆ system_rhs

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::system_rhs
private

Definition at line 803 of file cls.h.

◆ system_rhs_phase_indicator

template<int dim>
GlobalVectorType ConservativeLevelSet< dim >::system_rhs_phase_indicator
private

Definition at line 825 of file cls.h.

◆ table_barycenter

template<int dim>
TableHandler ConservativeLevelSet< dim >::table_barycenter
private

Definition at line 853 of file cls.h.

◆ table_monitoring_cls

template<int dim>
TableHandler ConservativeLevelSet< dim >::table_monitoring_cls
private

Definition at line 846 of file cls.h.

◆ triangulation

template<int dim>
std::shared_ptr<parallel::DistributedTriangulationBase<dim> > ConservativeLevelSet< dim >::triangulation
private

Definition at line 784 of file cls.h.

◆ volume_monitored

template<int dim>
double ConservativeLevelSet< dim >::volume_monitored
private

Definition at line 847 of file cls.h.

◆ zero_constraints

template<int dim>
AffineConstraints<double> ConservativeLevelSet< dim >::zero_constraints
private

Definition at line 806 of file cls.h.


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