8 #include "DataStructures/DataBox/PrefixHelpers.hpp"
9 #include "Domain/Creators/RegisterDerivedWithCharm.hpp"
11 #include "Elliptic/Actions/InitializeAnalyticSolution.hpp"
12 #include "Elliptic/Actions/InitializeFields.hpp"
13 #include "Elliptic/Actions/InitializeFixedSources.hpp"
14 #include "Elliptic/DiscontinuousGalerkin/DgElementArray.hpp"
15 #include "Elliptic/DiscontinuousGalerkin/ImposeBoundaryConditions.hpp"
16 #include "Elliptic/DiscontinuousGalerkin/ImposeInhomogeneousBoundaryConditionsOnSource.hpp"
17 #include "Elliptic/DiscontinuousGalerkin/InitializeFirstOrderOperator.hpp"
18 #include "Elliptic/DiscontinuousGalerkin/NumericalFluxes/FirstOrderInternalPenalty.hpp"
19 #include "Elliptic/FirstOrderOperator.hpp"
20 #include "Elliptic/Systems/Elasticity/FirstOrderSystem.hpp"
21 #include "Elliptic/Systems/Elasticity/Tags.hpp"
22 #include "Elliptic/Tags.hpp"
23 #include "Elliptic/Triggers/EveryNIterations.hpp"
24 #include "IO/Observer/Actions/RegisterEvents.hpp"
25 #include "IO/Observer/Helpers.hpp"
26 #include "IO/Observer/ObserverComponent.hpp"
27 #include "NumericalAlgorithms/Convergence/Tags.hpp"
28 #include "NumericalAlgorithms/DiscontinuousGalerkin/BoundarySchemes/FirstOrder/FirstOrderScheme.hpp"
29 #include "NumericalAlgorithms/DiscontinuousGalerkin/Tags.hpp"
31 #include "Parallel/Actions/SetupDataBox.hpp"
32 #include "Parallel/Actions/TerminatePhase.hpp"
34 #include "Parallel/InitializationFunctions.hpp"
35 #include "Parallel/PhaseDependentActionList.hpp"
36 #include "Parallel/Reduction.hpp"
38 #include "ParallelAlgorithms/Actions/MutateApply.hpp"
39 #include "ParallelAlgorithms/DiscontinuousGalerkin/CollectDataForFluxes.hpp"
40 #include "ParallelAlgorithms/DiscontinuousGalerkin/FluxCommunication.hpp"
41 #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeDomain.hpp"
42 #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeInterfaces.hpp"
43 #include "ParallelAlgorithms/DiscontinuousGalerkin/InitializeMortars.hpp"
44 #include "ParallelAlgorithms/Events/ObserveErrorNorms.hpp"
45 #include "ParallelAlgorithms/Events/ObserveFields.hpp"
46 #include "ParallelAlgorithms/Events/ObserveVolumeIntegrals.hpp"
47 #include "ParallelAlgorithms/EventsAndTriggers/Actions/RunEventsAndTriggers.hpp"
48 #include "ParallelAlgorithms/Initialization/Actions/AddComputeTags.hpp"
49 #include "ParallelAlgorithms/Initialization/Actions/RemoveOptionsAndTerminatePhase.hpp"
50 #include "ParallelAlgorithms/LinearSolver/Gmres/Gmres.hpp"
52 #include "PointwiseFunctions/AnalyticData/AnalyticData.hpp"
53 #include "PointwiseFunctions/AnalyticData/Elasticity/AnalyticData.hpp"
54 #include "PointwiseFunctions/AnalyticSolutions/Elasticity/AnalyticSolution.hpp"
55 #include "PointwiseFunctions/AnalyticSolutions/Elasticity/BentBeam.hpp"
56 #include "PointwiseFunctions/AnalyticSolutions/Elasticity/HalfSpaceMirror.hpp"
57 #include "PointwiseFunctions/AnalyticSolutions/Elasticity/Zero.hpp"
58 #include "PointwiseFunctions/AnalyticSolutions/Tags.hpp"
59 #include "PointwiseFunctions/Elasticity/PotentialEnergy.hpp"
62 #include "Utilities/Functional.hpp"
65 namespace SolveElasticity::OptionTags {
67 static std::string name() noexcept {
return "LinearSolver"; }
69 "The iterative Krylov-subspace linear solver";
72 static std::string name() noexcept {
return "GMRES"; }
73 static constexpr
Options::String help =
"Options for the GMRES linear solver";
80 struct Metavariables {
81 static constexpr
size_t volume_dim = Dim;
88 using analytic_solution_registrars = tmpl::flatten<tmpl::list<
89 tmpl::conditional_t<Dim == 2, Elasticity::Solutions::Registrars::BentBeam,
91 tmpl::conditional_t<Dim == 3,
92 Elasticity::Solutions::Registrars::HalfSpaceMirror,
94 using background_registrars = analytic_solution_registrars;
100 using initial_guess_registrars =
101 tmpl::list<Elasticity::Solutions::Registrars::Zero<Dim>>;
106 "Find the solution to a linear elasticity problem."};
108 using fluxes_computer_tag =
114 using analytic_solution_tag = background_tag;
118 using linear_solver =
122 using linear_solver_iteration_id =
127 typename system::fields_tag>;
129 typename system::primal_fields>;
130 using auxiliary_variables =
132 typename system::auxiliary_fields>;
137 volume_dim, fluxes_computer_tag, primal_variables,
138 auxiliary_variables>>;
143 volume_dim, linear_operand_tag,
146 normal_dot_numerical_flux, linear_solver_iteration_id>;
150 using observe_fields =
typename system::fields_tag::tags_list;
151 using analytic_solution_fields = observe_fields;
152 using events = tmpl::list<
154 volume_dim, linear_solver_iteration_id, observe_fields,
155 analytic_solution_fields>,
157 analytic_solution_fields>,
159 volume_dim, linear_solver_iteration_id,
160 tmpl::list<Elasticity::Tags::PotentialEnergyDensity<volume_dim>>>>;
162 linear_solver_iteration_id>>;
165 using const_global_cache_tags =
166 tmpl::list<background_tag, initial_guess_tag, fluxes_computer_tag,
167 normal_dot_numerical_flux,
171 using observed_reduction_data_tags =
172 observers::collect_reduction_data_tags<tmpl::flatten<tmpl::list<
173 typename Event<events>::creatable_classes, linear_solver>>>;
176 enum class Phase { Initialization, RegisterWithObserver, Solve, Exit };
178 using initialization_actions = tmpl::list<
186 typename linear_solver::initialize_element,
194 background_tag, analytic_solution_fields,
200 volume_dim,
typename system::fluxes_computer,
201 typename system::sources_computer, linear_operand_tag,
202 primal_variables, auxiliary_variables>,
205 using build_linear_operator_actions = tmpl::list<
211 linear_operand_tag>>,
213 linear_operand_tag, primal_variables>,
220 using register_actions =
224 using solve_actions = tmpl::list<
225 typename linear_solver::template solve<tmpl::list<
232 initialization_actions>,
238 using component_list = tmpl::flatten<
239 tmpl::list<dg_element_array,
typename linear_solver::component_list,
244 static Phase determine_next_phase(
245 const Phase& current_phase,
246 const Parallel::CProxy_GlobalCache<
247 Metavariables>& ) noexcept {
248 switch (current_phase) {
249 case Phase::Initialization:
250 return Phase::RegisterWithObserver;
251 case Phase::RegisterWithObserver:
257 "Should never call determine_next_phase with the current phase "
261 "Unknown type of phase. Did you static_cast<Phase> an integral "
267 static const std::vector<void (*)()> charm_init_node_funcs{
268 &setup_error_handling,
270 &domain::creators::register_derived_with_charm,
272 metavariables::background_tag::type::element_type>,
274 metavariables::initial_guess_tag::type::element_type>,
276 metavariables::system::boundary_conditions_base>,
281 static const std::vector<void (*)()> charm_init_proc_funcs{
Base class for analytic solutions of the linear Elasticity equations.
Definition: AnalyticSolution.hpp:34
Add into the DataBox default constructed items for the collection of tags requested by any of the act...
Definition: SetupDataBox.hpp:102
A GMRES solver for nonsymmetric linear systems of equations .
Definition: Gmres.hpp:87
Registers this element of a parallel component with the local Observer parallel component for each tr...
Definition: RegisterEvents.hpp:97
Adds boundary contributions to the sources.
Definition: ImposeInhomogeneousBoundaryConditionsOnSource.hpp:71
Send local boundary data needed for fluxes to neighbors.
Definition: FluxCommunication.hpp:78
Definition: RemoveOptionsAndTerminatePhase.hpp:27
tmpl::list< Tags... > face_compute_tags
Definition: InitializeInterfaces.hpp:41
Terminate the algorithm to proceed to the next phase.
Definition: TerminatePhase.hpp:26
tmpl::list< Tags... > slice_tags_to_face
Definition: InitializeInterfaces.hpp:31
void disable_openblas_multithreading() noexcept
Disable OpenBLAS multithreading since it conflicts with Charm++ parallelism.
Definition: Blas.cpp:15
A template for defining a registrar.
Definition: Registration.hpp:42
Mutating DataBox invokable to compute the bulk contribution to the operator represented by the Operat...
Definition: FirstOrderOperator.hpp:224
void enable_floating_point_exceptions()
Definition: FloatingPointExceptions.cpp:27
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:36
List of all the actions to be executed in the specified phase.
Definition: PhaseDependentActionList.hpp:16
The nodegroup parallel component that is responsible for writing data to disk.
Definition: ObserverComponent.hpp:51
Initialize items related to the interfaces between Elements and on external boundaries.
Definition: InitializeInterfaces.hpp:120
The parallel component responsible for managing the DG elements that compose the computational domain...
Definition: DgElementArray.hpp:37
Initialize items related to the basic structure of the element.
Definition: InitializeDomain.hpp:67
Definition: InitializeAnalyticSolution.hpp:87
Base class for the background of the Elasticity system, i.e. its variable-independent quantities....
Definition: AnalyticData.hpp:25
Run the events and triggers.
Definition: RunEventsAndTriggers.hpp:27
Apply the function Mutator::apply to the DataBox.
Definition: MutateApply.hpp:40
The group parallel component that is responsible for reducing data to be observed.
Definition: ObserverComponent.hpp:29
Definition: Trigger.hpp:34
Initialize mortars between elements for exchanging fluxes.
Definition: InitializeMortars.hpp:78
Collect data that is needed to compute numerical fluxes and store it on mortars, projecting it if nec...
Definition: CollectDataForFluxes.hpp:68
Definition: ObserveFields.hpp:68
The internal penalty flux for first-order elliptic equations.
Definition: FirstOrderInternalPenalty.hpp:147
Provides analytic tensor data as a function of the spatial coordinates.
Definition: AnalyticData.hpp:30
Initialize the dynamic fields of the elliptic system, i.e. those we solve for.
Definition: InitializeFields.hpp:43
tmpl::list< Tags... > exterior_compute_tags
Definition: InitializeInterfaces.hpp:46
Definition: ObserveVolumeIntegrals.hpp:51
const char *const String
The string used in option structs.
Definition: Options.hpp:32
Boundary contributions for a first-order DG scheme.
Definition: FirstOrderScheme.hpp:66
The linear elasticity equation formulated as a set of coupled first-order PDEs.
Definition: FirstOrderSystem.hpp:54
void register_derived_classes_with_charm() noexcept
Register derived classes of the Base class.
Definition: RegisterDerivedClassesWithCharm.hpp:31
Set field data on external boundaries so that they represent homogeneous (zero) Dirichlet boundary co...
Definition: ImposeBoundaryConditions.hpp:91
Initialize DataBox tags for building the first-order elliptic DG operator.
Definition: InitializeFirstOrderOperator.hpp:49
Receive boundary data needed for fluxes from neighbors.
Definition: FluxCommunication.hpp:175
Initialize the "fixed sources" of the elliptic equations, i.e. their variable-independent source term...
Definition: InitializeFixedSources.hpp:53
Definition: InterfaceComputeTags.hpp:186
tmpl::list< Tags... > slice_tags_to_exterior
Definition: InitializeInterfaces.hpp:36