32 template <
int spatial_dim,
typename OutputSpace,
typename inputs = Parameters<>>
46 template <
int spatial_dim,
typename OutputSpace,
typename... InputSpaces>
60 const mfem::ParFiniteElementSpace& output_mfem_space,
61 const typename Base::SpacesT& input_mfem_spaces)
62 :
Base(physics_name, mesh, output_mfem_space, input_mfem_spaces)
79 template <
int... active_parameters,
typename BodyIntegralType>
82 const double* dt = &this->dt_;
83 const size_t* cycle = &this->cycle_;
84 Base::addBodyIntegral(depends_on, body_name, [dt, cycle, integrand](
double t,
auto X,
auto... inputs) {
86 return integrand(time_info, X, inputs...);
96 template <
typename BodyIntegralType>
99 constexpr
int num_inputs =
sizeof...(InputSpaces);
100 addBodyIntegralWithAllParams(body_name, integrand, std::make_integer_sequence<int, num_inputs>{});
111 template <
int... active_parameters,
typename BodyLoadType>
114 addBodyIntegral(depends_on, body_name, [load_function](
auto t_info,
auto X,
auto... inputs) {
121 template <
typename BodyLoadType>
124 constexpr
int num_inputs =
sizeof...(InputSpaces);
125 addBodySourceWithAllParams(body_name, load_function, std::make_integer_sequence<int, num_inputs>{});
136 template <
int... active_parameters,
typename BoundaryIntegralType>
138 BoundaryIntegralType integrand)
140 const double* dt = &this->dt_;
141 const size_t* cycle = &this->cycle_;
142 Base::addBoundaryIntegral(depends_on, boundary_name, [dt, cycle, integrand](
double t,
auto X,
auto... inputs) {
144 return integrand(time_info, X, inputs...);
150 template <
typename BoundaryIntegralType>
153 constexpr
int num_inputs =
sizeof...(InputSpaces);
154 addBoundaryIntegralWithAllParams(boundary_name, integrand, std::make_integer_sequence<int, num_inputs>{});
165 template <
int... active_parameters,
typename BoundaryFluxType>
167 BoundaryFluxType flux_function)
169 const double* dt = &this->dt_;
170 const size_t* cycle = &this->cycle_;
171 Base::addBoundaryFlux(depends_on, boundary_name,
172 [dt, cycle, flux_function](
double t,
auto X,
auto n,
auto... inputs) {
174 return flux_function(time_info, X, n, inputs...);
180 template <
typename BoundaryFluxType>
183 constexpr
int num_inputs =
sizeof...(InputSpaces);
184 addBoundaryFluxWithAllParams(boundary_name, flux_function, std::make_integer_sequence<int, num_inputs>{});
195 template <
int... active_parameters,
typename InteriorIntegralType>
197 InteriorIntegralType integrand)
199 const double* dt = &this->dt_;
200 const size_t* cycle = &this->cycle_;
201 Base::addInteriorBoundaryIntegral(depends_on, interior_name,
202 [dt, cycle, integrand](
double t,
auto X,
auto... inputs) {
204 return integrand(time_info, X, inputs...);
210 template <
typename InteriorIntegralType>
213 constexpr
int num_inputs =
sizeof...(InputSpaces);
214 addInteriorBoundaryIntegralWithAllParams(interior_name, integrand, std::make_integer_sequence<int, num_inputs>{});
218 template <
typename BodyIntegralType,
int... all_params>
219 void addBodyIntegralWithAllParams(std::string body_name, BodyIntegralType integrand,
220 std::integer_sequence<int, all_params...>)
225 template <
typename BodyLoadType,
int... all_params>
226 void addBodySourceWithAllParams(std::string body_name, BodyLoadType load_function,
227 std::integer_sequence<int, all_params...>)
229 addBodySource(DependsOn<all_params...>{}, body_name, load_function);
232 template <
typename BoundaryIntegralType,
int... all_params>
233 void addBoundaryIntegralWithAllParams(std::string boundary_name, BoundaryIntegralType integrand,
234 std::integer_sequence<int, all_params...>)
236 addBoundaryIntegral(DependsOn<all_params...>{}, boundary_name, integrand);
239 template <
typename InteriorIntegralType,
int... all_params>
240 void addInteriorBoundaryIntegralWithAllParams(std::string interior_name, InteriorIntegralType integrand,
241 std::integer_sequence<int, all_params...>)
243 addInteriorBoundaryIntegral(DependsOn<all_params...>{}, interior_name, integrand);
246 template <
typename BoundaryFluxType,
int... all_params>
247 void addBoundaryFluxWithAllParams(std::string boundary_name, BoundaryFluxType flux_function,
248 std::integer_sequence<int, all_params...>)
250 addBoundaryFlux(DependsOn<all_params...>{}, boundary_name, flux_function);
261 template <
int spatial_dim,
typename OutputSpace,
typename inputs = Parameters<>>
265 template <
int spatial_dim,
typename OutputSpace,
typename TrialInputSpace,
typename... InputSpaces>
269 static constexpr
int NUM_STATE_VARS = 4;
280 const mfem::ParFiniteElementSpace& output_mfem_space,
281 const typename TimeDiscretizedWeakFormT::SpacesT& input_mfem_spaces)
282 : time_rule_(time_rule)
284 time_discretized_weak_form_ =
285 std::make_shared<TimeDiscretizedWeakFormT>(physics_name, mesh, output_mfem_space, input_mfem_spaces);
286 time_discretized_weak_form = time_discretized_weak_form_;
288 typename TimeDiscretizedWeakFormT::SpacesT trial_removed_spaces(std::next(input_mfem_spaces.begin()),
289 input_mfem_spaces.end());
290 final_reaction_weak_form_ =
291 std::make_shared<FinalReactionFormT>(physics_name, mesh, output_mfem_space, trial_removed_spaces);
292 final_reaction_weak_form = final_reaction_weak_form_;
296 template <
int... active_parameters,
typename BodyIntegralType>
298 BodyIntegralType integrand)
300 auto time_rule = time_rule_;
301 time_discretized_weak_form_->addBodyIntegral(
303 [integrand, time_rule](
const TimeInfo& t,
auto X,
auto U,
auto U_old,
auto U_dot_old,
auto U_dot_dot_old,
305 return integrand(t, X, time_rule.value(t, U, U_old, U_dot_old, U_dot_dot_old),
306 time_rule.dot(t, U, U_old, U_dot_old, U_dot_dot_old),
307 time_rule.ddot(t, U, U_old, U_dot_old, U_dot_dot_old), inputs...);
310 body_name, integrand);
314 template <
typename BodyIntegralType>
317 addBodyIntegral(
DependsOn<>{}, body_name, integrand);
321 template <
int... active_parameters,
typename BodyLoadType>
324 auto time_rule = time_rule_;
325 time_discretized_weak_form_->addBodyIntegral(
327 [load_function, time_rule](
const TimeInfo& t,
auto X,
auto U,
auto U_old,
auto U_dot_old,
auto U_dot_dot_old,
330 -load_function(t.time(), get<VALUE>(X),
331 get<VALUE>(time_rule.value(t, U, U_old, U_dot_old, U_dot_dot_old)),
332 get<VALUE>(time_rule.dot(t, U, U_old, U_dot_old, U_dot_dot_old)),
333 get<VALUE>(time_rule.ddot(t, U, U_old, U_dot_old, U_dot_dot_old)), get<VALUE>(inputs)...),
336 final_reaction_weak_form_->addBodyIntegral(
338 [load_function](
const TimeInfo& t,
auto X,
auto... inputs) {
344 template <
typename BodyLoadType>
347 addBodySource(
DependsOn<>{}, body_name, load_function);
351 std::shared_ptr<TimeDiscretizedWeakFormT> time_discretized_weak_form_;
352 std::shared_ptr<FinalReactionFormT> final_reaction_weak_form_;
Smith mesh class which assists in constructing the appropriate parallel mfem meshes and registering a...
Accelerator functionality.
mfem::future::tuple< T... > tuple
Expose MFEM tuple in the Smith namespace.
encodes rules for time discretizing second order odes (involving first and second time derivatives)....
a struct that is used in the physics modules to clarify which template arguments are user-controlled ...
struct storing time and timestep information
A sentinel struct for eliding no-op tensor operations.
Provides templated implementations for discretizing values, velocities and accelerations from current...