Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
cls_phase_gradient_projection.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_cls_phase_gradient_projection_h
5#define lethe_cls_phase_gradient_projection_h
6
8
9#include <deal.II/fe/fe_simplex_p.h>
10
11#include <utility>
12
14 SameCLSSolution,
15 std::string,
16 "A new CLS phase indicator solution has not been set. There is no need "
17 "to solve once more the following equation: "
18 << arg1
19 << ". If you wish to solve the subequation for a new phase indicator field, "
20 "please set a new CLS solution field with "
21 "CLSSubequationsInterface<dim>::set_cls_solution_and_dof_handler() "
22 "before solving the subequation.");
23
25 NoCLSSolution,
26 std::string,
27 "No CLS phase indicator solution has been set. A valid CLS phase indicator "
28 "solution is required to solve the "
29 << arg1
30 << ". Please set a new CLS phase indicator solution field with "
31 "CLSSubequationsInterface<dim>::set_cls_solution_and_dof_handler() "
32 "before solving the subequation.");
33
34/**
35 * @brief CLS phase indicator gradient L2 projection solver.
36 *
37 * @tparam dim Number of dimensions of the problem.
38 */
39template <int dim>
41{
42public:
43 /**
44 * @brief Constructor for the L2 projection of the CLS phase indicator gradient
45 * (PIG).
46 *
47 * @param[in] p_simulation_parameters Simulation parameters.
48 *
49 * @param[in] p_pcout Parallel cout used to print the information.
50 *
51 * @param[in] p_triangulation Distributed mesh information.
52 *
53 * @param[in,out] p_subequations_interface Subequations interface object used
54 * to get information from other subequations and store information from the
55 * current one.
56 */
58 const SimulationParameters<dim> &p_simulation_parameters,
59 const ConditionalOStream &p_pcout,
60 std::shared_ptr<parallel::DistributedTriangulationBase<dim>>
61 p_triangulation,
62 CLSSubequationsInterface<dim> &p_subequations_interface)
65 p_simulation_parameters,
66 ((p_simulation_parameters.multiphysics.cls_parameters
67 .surface_tension_force.verbosity != Parameters::Verbosity::quiet) ||
68 ((p_simulation_parameters.multiphysics.cls_parameters
69 .reinitialization_method.pde_based_interface_reinitialization
70 .enable) &&
71 (p_simulation_parameters.multiphysics.cls_parameters
72 .reinitialization_method.verbosity !=
73 Parameters::Verbosity::quiet))) ?
74 Parameters::Verbosity::verbose :
75 Parameters::Verbosity::quiet, // Set to verbose if surface tension
76 // verbosity is enabled or if PDE-based
77 // interface reinitialization is enabled
78 // and set to verbose
79 p_pcout,
80 std::move(p_triangulation),
81 p_subequations_interface)
82 {
83 if (this->simulation_parameters.mesh.simplex)
84 {
85 // For simplex meshes
86 const FE_SimplexP<dim> subequation_fe(
87 this->simulation_parameters.fem_parameters.CLS_degree);
88 this->fe = std::make_shared<FESystem<dim>>(subequation_fe, dim);
89 this->mapping = std::make_shared<MappingFE<dim>>(*this->fe);
90
91 this->cell_quadrature =
92 std::make_shared<QGaussSimplex<dim>>(this->fe->degree + 1);
93 }
94 else
95 {
96 // Usual case, for quad/hex meshes
97 const FE_Q<dim> subequation_fe(
98 this->simulation_parameters.fem_parameters.CLS_degree);
99 this->fe = std::make_shared<FESystem<dim>>(subequation_fe, dim);
100 this->mapping = std::make_shared<MappingQ<dim>>(this->fe->degree);
101
102 this->cell_quadrature =
103 std::make_shared<QGauss<dim>>(this->fe->degree + 1);
104 }
105 }
106
107 /**
108 * @brief Default destructor.
109 */
111
112private:
113 /**
114 * @brief Assemble system matrix and right-hand side (rhs).
115 */
116 void
118
119 /**
120 * @brief Check if a new CLS solution has been set.
121 */
122 void
124};
125
126#endif
CLSLinearSubequationsSolver(const CLSSubequationsID &p_subequation_id, const SimulationParameters< dim > &p_simulation_parameters, const Parameters::Verbosity &p_subequation_verbosity, const ConditionalOStream &p_pcout, std::shared_ptr< parallel::DistributedTriangulationBase< dim > > p_triangulation, CLSSubequationsInterface< dim > &p_subequations_interface)
Constructor for linear subequations solvers within the CLS auxiliary physics.
const SimulationParameters< dim > & simulation_parameters
CLSPhaseGradientProjection(const SimulationParameters< dim > &p_simulation_parameters, const ConditionalOStream &p_pcout, std::shared_ptr< parallel::DistributedTriangulationBase< dim > > p_triangulation, CLSSubequationsInterface< dim > &p_subequations_interface)
Constructor for the L2 projection of the CLS phase indicator gradient (PIG).
~CLSPhaseGradientProjection()=default
Default destructor.
void check_dependencies_validity() override
Check if a new CLS solution has been set.
void assemble_system_matrix_and_rhs() override
Assemble system matrix and right-hand side (rhs).
Interface for secondary equations (subequations) solved within the CLS auxiliary physics.
DeclException1(SameCLSSolution, std::string, "A new CLS phase indicator solution has not been set. There is no need " "to solve once more the following equation: "<< arg1<< ". If you wish to solve the subequation for a new phase indicator field, " "please set a new CLS solution field with " "CLSSubequationsInterface<dim>::set_cls_solution_and_dof_handler() " "before solving the subequation.")
CLSSubequationsID
IDs associated to the different subequations solved in Lethe.
@ pde_based_interface_reinitialization
CLS PDE-based interface reinitialization.
@ phase_gradient_projection
CLS phase indicator gradient L2 projection.