Program Listing for File elasticity_problem_parameters.h

Return to documentation for file (include/immersx/physics/elasticity_problem_parameters.h)

// ---------------------------------------------------------------------
//
// Copyright (C) 2024 by Luca Heltai
//
// This file is part of the ImmersX application, based on
// the deal.II library.
//
// The ImmersX application is free software; you can use
// it, redistribute it, and/or modify it under the terms of the Apache-2.0
// License WITH LLVM-exception as published by the Free Software Foundation;
// either version 3.0 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE.md at the top
// level of the ImmersX distribution.
//
// ---------------------------------------------------------------------

#ifndef dealii_distributed_lagrange_multiplier_elasticity_problem_parameters_h
#define dealii_distributed_lagrange_multiplier_elasticity_problem_parameters_h

#include <deal.II/base/parameter_acceptor.h>
#include <deal.II/base/parsed_convergence_table.h>
#include <deal.II/base/parsed_function.h>
#include <deal.II/base/patterns.h>
#include <deal.II/base/types.h>

#include <deal.II/lac/solver_control.h>

#include <immersx/core/time_parameters.h>
#include <immersx/physics/material_properties.h>
#include <immersx/physics/modulated_parsed_function.h>

#include <map>
#include <memory>
#include <set>
#include <string>

#ifdef DEAL_II_WITH_VTK
#  include <immersx/coupling/reduced_coupling.h>
#endif

namespace ImmersX
{
  enum class TimeMode
  {
    Static,
    QuasiStatic,
    Dynamic
  };

  enum class ElasticityModel
  {
    LinearElasticity,
    KelvinVoigt
  };

  enum class CouplingType
  {
    Point,
    TensorProduct
  };

  template <int dim, int spacedim = dim>
  class ElasticityProblemParameters : public ParameterAcceptor
  {
  public:
    ElasticityProblemParameters();

    const MaterialProperties &
    get_material_properties(const types::material_id material_id) const;

    const ModulatedParsedFunction<spacedim> &
    get_dirichlet_bc(const types::boundary_id boundary_id) const;

    const ModulatedParsedFunction<spacedim> &
    get_neumann_bc(const types::boundary_id boundary_id) const;

    const ModulatedParsedFunction<spacedim> &
    get_rhs(const types::material_id material_id) const;

    void
    set_rhs_times(const double time) const;

    void
    set_boundary_condition_times(const double time) const;

    void
    check_model_consistency();

    TimeMode time_mode = TimeMode::Static;

    ElasticityModel elasticity_model = ElasticityModel::LinearElasticity;

    std::string  output_directory   = ".";
    std::string  output_name        = "solution";
    unsigned int fe_degree          = 1;
    unsigned int initial_refinement = 5;
    std::set<types::boundary_id> dirichlet_ids{0};
    std::set<types::boundary_id> weak_dirichlet_ids{};
    std::set<types::boundary_id> neumann_ids{};
    std::set<types::boundary_id> normal_flux_ids{};

    MaterialProperties default_material_properties{
      "default"};
    std::map<types::material_id, std::string>
      material_tags_by_material_id;

    std::map<types::material_id, std::unique_ptr<MaterialProperties>>
      material_properties_by_id;
    std::set<types::material_id> rhs_material_ids{};

    std::string domain_type        = "generate";
    std::string triangulation_type = "distributed";
    std::string name_of_grid = "hyper_cube";
    std::string arguments_for_grid =
      "-1: 1: false";
    double      grid_scale = 1.0;
    std::string refinement_strategy =
      "fixed_fraction";
    double       coarsening_fraction = 0.0;
    double       refinement_fraction = 0.3;
    unsigned int n_refinement_cycles = 1;
    unsigned int max_cells           = 20000;
    bool         output_pressure     = false;
    double       penalty_term        = 1.0e4;

    bool pressure_coupling = false;

    mutable ModulatedParsedFunction<spacedim> rhs;
    std::map<types::material_id,
             std::shared_ptr<ModulatedParsedFunction<spacedim>>>
      rhs_by_material_id;

    mutable ParameterAcceptorProxy<Functions::ParsedFunction<spacedim>>
      exact_solution;

    mutable ParameterAcceptorProxy<Functions::ParsedFunction<spacedim>>
      initial_displacement;

    mutable ParameterAcceptorProxy<Functions::ParsedFunction<spacedim>>
      initial_velocity;

    mutable ModulatedParsedFunction<spacedim> bc;
    std::map<types::boundary_id,
             std::shared_ptr<ModulatedParsedFunction<spacedim>>>
      dirichlet_bc_by_id;

    mutable ModulatedParsedFunction<spacedim>
      Neumann_bc;
    std::map<types::boundary_id,
             std::shared_ptr<ModulatedParsedFunction<spacedim>>>
      neumann_bc_by_id;

    std::string weight_expression = "1.";

#ifdef DEAL_II_WITH_VTK
    ReducedCouplingParameters<1, 2, spacedim, spacedim>
      tensor_product_coupling_parameters;
#endif

    CouplingType coupling_type = CouplingType::Point;

    mutable ParameterAcceptorProxy<ReductionControl>
      displacement_solver_control;

    mutable ParameterAcceptorProxy<ReductionControl>
      reduced_mass_solver_control;

    mutable ParameterAcceptorProxy<ReductionControl>
      augmented_lagrange_solver_control;

    mutable ParameterAcceptorProxy<ReductionControl>
      schur_complement_solver_control;

    bool estimate_condition_number = false;

    bool output_results_before_solving = false;

    mutable ParsedConvergenceTable convergence_table;

    TimeParameters time_parameters;
  };

} // namespace ImmersX

#endif