Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
lumped_mass_weak_form.hpp
Go to the documentation of this file.
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
13 #pragma once
14 
16 #include "smith/physics/mesh.hpp"
17 
18 namespace smith {
19 
21 template <int spatial_dim, typename LumpedFieldSpace, typename DensitySpace, typename... parameter_space>
22 auto createSolidMassWeakForm(const std::string& physics_name, std::shared_ptr<smith::Mesh>& mesh,
23  const FiniteElementState& lumped_field, const FiniteElementState& density)
24 {
25  static constexpr int lumped_dim = LumpedFieldSpace::components;
26 
28  auto weak_form = std::make_shared<WeakFormT>(physics_name, mesh, lumped_field.space(),
29  typename WeakFormT::SpacesT{&density.space()});
30  weak_form->addBodyIntegral(smith::DependsOn<0>{}, mesh->entireBodyName(), [](double /*time*/, auto /*X*/, auto Rho) {
31  if constexpr (lumped_dim == 1) {
32  return smith::tuple{get<VALUE>(Rho), tensor<double, spatial_dim>{}};
33  } else {
34  auto ones = make_tensor<lumped_dim>([](int) { return 1.0; });
35  return smith::tuple{get<VALUE>(Rho) * ones, tensor<double, lumped_dim, spatial_dim>{}};
36  }
37  });
38 
39  return weak_form;
40 }
41 
42 } // namespace smith
Class for encapsulating the critical MFEM components of a primal finite element field.
mfem::ParFiniteElementSpace & space()
Returns a non-owning reference to the internal FESpace.
Implements the WeakForm interface using smith::ShapeAwareFunctional. Allows for generic specification...
Smith mesh class which assists in constructing the appropriate parallel mfem meshes and registering a...
Accelerator functionality.
Definition: smith.cpp:36
auto createSolidMassWeakForm(const std::string &physics_name, std::shared_ptr< smith::Mesh > &mesh, const FiniteElementState &lumped_field, const FiniteElementState &density)
creates a lumped mass weak form
Arbitrary-rank tensor class.
Definition: tensor.hpp:28
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...
Definition: tuple.hpp:28