7#include <deal.II/base/parameter_handler.h>
8#include <deal.II/base/parsed_function.h>
9#include <deal.II/base/patterns.h>
18 <<
"Cahn Hilliard boundary id: " << arg1
19 <<
" has already been declared as a boundary condition");
26 ParameterHandler &prm,
27 const types::boundary_id default_boundary_id)
33 "Type of boundary condition for the Cahn-Hilliard equations.",
37 prm.declare_entry(
"id",
38 Utilities::int_to_string(default_boundary_id, 2),
39 Patterns::List(Patterns::Integer()),
40 "Mesh id for boundary conditions");
46 "Inner angle of contact between the fluid 1 and the boundary (in degrees)");
48 Functions::ParsedFunction<dim> temporary_function;
49 prm.enter_subsection(
"phi");
50 temporary_function.declare_parameters(prm);
51 prm.leave_subsection();
58 "Mesh id for periodic face matching. Default entry is -1 to ensure that the periodic id is set by the user");
60 prm.declare_entry(
"periodic direction",
63 "Direction for periodic boundary condition");
69 ParameterHandler &prm,
72 prm.enter_subsection(
"boundary conditions cahn hilliard");
74 prm.declare_entry(
"number",
77 "Number of boundary conditions");
82 "Bool to define if the boundary condition is time dependent");
86 prm.enter_subsection(
"bc " + std::to_string(n));
90 prm.leave_subsection();
93 prm.leave_subsection();
101 std::vector<types::boundary_id> boundary_ids =
106 boundary_ids.size() > 0,
108 "A boundary id has not been set for one of the Cahn Hilliard boundary conditions. Please ensure that the id is set for every boundary condition."));
111 for (
const auto boundary_id : boundary_ids)
113 AssertThrow(this->
type.find(boundary_id) == this->type.end(),
114 CahnHilliardBoundaryDuplicated(boundary_id));
117 prm.enter_subsection(
"phi");
119 std::make_shared<CahnHilliardBoundaryFunctions<dim>>();
120 bcFunctions[boundary_id]->phi.parse_parameters(prm);
121 prm.leave_subsection();
128 this->
type[boundary_id] = boundary_type;
131 types::boundary_id periodic_boundary_id =
132 prm.get_integer(
"periodic id");
136 this->
type[periodic_boundary_id] =
141 .neighbor_id = periodic_boundary_id,
142 .direction =
static_cast<unsigned int>(
143 prm.get_integer(
"periodic direction"))};
152 prm.enter_subsection(
"boundary conditions cahn hilliard");
159 prm.enter_subsection(
"bc " + std::to_string(n));
163 prm.leave_subsection();
166 prm.leave_subsection();
177 const unsigned int component)
const
179 Assert(component < this->n_components,
180 ExcIndexRange(component, 0, this->n_components));
184 return phi->value(p);
DeclException1(CahnHilliardBoundaryDuplicated, types::boundary_id,<< "Cahn Hilliard boundary id: "<< arg1<< " has already been declared as a boundary condition")
Parameters::PeriodicBoundaries periodic_boundaries
std::map< types::boundary_id, CahnHilliardBoundaryType > type
unsigned int number_of_boundary_conditions
This class manages the boundary conditions for the Cahn-Hilliard solver It introduces the boundary fu...
void parse_parameters(ParameterHandler &prm)
Parse the Cahn-Hilliard boundary condition parameters.
void declare_default_entry(ParameterHandler &prm, types::boundary_id default_boundary_id)
Declare the default parameters for one Cahn-Hilliard boundary condition.
std::map< types::boundary_id, double > angle_of_contact
void declare_parameters(ParameterHandler &prm, unsigned int number_of_boundary_conditions)
Declare the Cahn-Hilliard boundary condition parameters.
std::map< types::boundary_id, std::shared_ptr< CahnHilliardBoundaryFunctions< dim > > > bcFunctions
void parse_boundary(ParameterHandler &prm)
Parse the information for one Cahn-Hilliard boundary condition.
Class that implements a boundary conditions for the Cahn-Hilliard equation where the phase and chemic...
double value(const Point< dim > &p, unsigned int component) const override
Calculates the value of a Function-type for the Cahn-Hilliard equations.
Functions::ParsedFunction< dim > * phi
std::vector< T > convert_string_to_vector(const ParameterHandler &prm, const std::string &entry_string)
Return the vector of size N of entry @entry_string. If the entry is specified in the ....
EnumType string_to_enum(const std::string &name)
Return the enumerator whose identifier is name, e.g. to parse the value of a parameter entry into its...
void declare_enum_entry(ParameterHandler &prm, const std::string &entry_name, const EnumType default_value, const std::string &description, const DeprecatedEnumNames< EnumType > &deprecated_names={}, const std::vector< EnumType > &allowed_values={})
Declare a parameter entry whose value is an enumerator. The default value, the accepted values and th...
const std::vector< CahnHilliardBoundaryType > cahn_hilliard_boundary_types