4 #include <deal.II/base/utilities.h>     6 #include "parameters_functional.h"    10 namespace Parameters {
    15     prm.enter_subsection(
"functional");
    17         prm.declare_entry(
"functional_type", 
"normLp_volume",
    18                           dealii::Patterns::Selection(
    21                           " weighted_integral_volume | "    22                           " weighted_integral_boundary | "    23                           " error_normLp_volume | "    24                           " error_normLp_boundary | "    27                           " solution_integral | "    28                           " outlet_pressure_integral | "    30                           "Functional that we want to use. "    34                           "  weighted_integral_volume | "    35                           "  weighted_integral_boundary | "    36                           "  error_normLp_volume | "    37                           "  error_normLp_boundary | "    40                           "  solution_integral |"    41                           "  outlet_pressure_integral |"    42                           "  error_normLp_boundary>.");
    44         prm.declare_entry(
"normLp", 
"2.0",
    45                           dealii::Patterns::Double(1.0,dealii::Patterns::Double::max_double_value),
    46                           "Lp norm strength (may not be used depending on the functional choice).");
    48         prm.declare_entry(
"weight_function_type",
"exp_solution",
    49                           dealii::Patterns::Selection(
    52                           " additive_solution | "    55                           " even_poly_solution | "    58                           "The weight function we want to use (may not be used depending on the functional choice). "    62                           "  additive_solution | "    65                           "  even_poly_solution | "    68         prm.declare_entry(
"use_weight_function_laplacian", 
"false",
    69                           dealii::Patterns::Bool(),
    70                           "Indicates whether to use weight function value or laplacian in the functional.");
    72         prm.declare_entry(
"boundary_vector", 
"[0, 1]",
    73                           dealii::Patterns::Anything(),
    74                           "Stores a vector with a list of the (unsigned) integer boundary ID. "    75                           "Formatted in square brackets and seperated by commas, eg. \"[0,2]\"");
    77         prm.declare_entry(
"use_all_boundaries", 
"true",
    78                           dealii::Patterns::Bool(),
    79                           "Indicates whether all boundaries should be evaluated (for boundary functionals). "    80                           "If set to true (default), overrides the boundary_vector list.");
    82     prm.leave_subsection();
    87     prm.enter_subsection(
"functional");
    89         const std::string functional_string = prm.get(
"functional_type");
    90         if(functional_string == 
"normLp_volume")                   {
functional_type = FunctionalType::normLp_volume;}
    91         else if(functional_string == 
"normLp_boundary")            {
functional_type = FunctionalType::normLp_boundary;}
    92         else if(functional_string == 
"weighted_integral_volume")   {
functional_type = FunctionalType::weighted_integral_volume;}
    93         else if(functional_string == 
"weighted_integral_boundary") {
functional_type = FunctionalType::weighted_integral_boundary;}
    94         else if(functional_string == 
"error_normLp_volume")        {
functional_type = FunctionalType::error_normLp_volume;}
    95         else if(functional_string == 
"error_normLp_boundary")      {
functional_type = FunctionalType::error_normLp_boundary;}
    96         else if(functional_string == 
"lift")                       {
functional_type = FunctionalType::lift;}
    97         else if(functional_string == 
"drag")                       {
functional_type = FunctionalType::drag;}
    98         else if(functional_string == 
"solution_integral")          {
functional_type = FunctionalType::solution_integral;}
    99         else if(functional_string == 
"outlet_pressure_integral")   {
functional_type = FunctionalType::outlet_pressure_integral;}
   101         normLp = prm.get_double(
"normLp");
   104         const std::string weight_string = prm.get(
"weight_function_type");
   105         if(weight_string == 
"sine_solution")           {
weight_function_type = ManufacturedSolutionEnum::sine_solution;} 
   106         else if(weight_string == 
"cosine_solution")    {
weight_function_type = ManufacturedSolutionEnum::cosine_solution;} 
   107         else if(weight_string == 
"additive_solution")  {
weight_function_type = ManufacturedSolutionEnum::additive_solution;} 
   108         else if(weight_string == 
"exp_solution")       {
weight_function_type = ManufacturedSolutionEnum::exp_solution;} 
   109         else if(weight_string == 
"poly_solution")      {
weight_function_type = ManufacturedSolutionEnum::poly_solution;} 
   110         else if(weight_string == 
"even_poly_solution") {
weight_function_type = ManufacturedSolutionEnum::even_poly_solution;} 
   111         else if(weight_string == 
"atan_solution")      {
weight_function_type = ManufacturedSolutionEnum::atan_solution;}
   115         std::string boundary_string = prm.get(
"boundary_vector");
   118         std::string removeChars = 
"[]";
   119         for(
unsigned int i = 0; i < removeChars.length(); ++i)
   120             boundary_string.erase(std::remove(boundary_string.begin(), boundary_string.end(), removeChars.at(i)), boundary_string.end());
   121         std::vector<std::string> boundary_string_vector = dealii::Utilities::split_string_list(boundary_string);
   124         for(
auto entry : boundary_string_vector)
   129     prm.leave_subsection();
 ManufacturedSolutionType
Selects the manufactured solution to be used if use_manufactured_source_term=true. 
FunctionalType functional_type
Selection of functinal type. 
void parse_parameters(dealii::ParameterHandler &prm)
Parses input file and sets the variables. 
ManufacturedSolutionEnum weight_function_type
Choice of manufactured solution function to be used in weighting expression. 
std::vector< unsigned int > boundary_vector
Boundary of vector ids to be considered for boundary functional evaluation. 
Files for the baseline physics. 
bool use_all_boundaries
Flag for use of all domain boundaries. 
double normLp
Choice of Lp norm exponent used in functional calculation. 
static void declare_parameters(dealii::ParameterHandler &prm)
Declares the possible variables and sets the defaults. 
bool use_weight_function_laplacian
Flag to use weight function laplacian.