Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <pup.h> 8 : 9 : #include "DataStructures/DataBox/Prefixes.hpp" 10 : #include "DataStructures/Tensor/Tensor.hpp" 11 : #include "Elliptic/Systems/Elasticity/Tags.hpp" 12 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" 13 : #include "Options/String.hpp" 14 : #include "PointwiseFunctions/InitialDataUtilities/AnalyticSolution.hpp" 15 : #include "Utilities/MakeWithValue.hpp" 16 : #include "Utilities/Serialization/CharmPupable.hpp" 17 : #include "Utilities/TMPL.hpp" 18 : #include "Utilities/TaggedTuple.hpp" 19 : 20 : namespace Elasticity::Solutions { 21 : 22 : /*! 23 : * \brief The trivial solution \f$\xi^i(x)=0\f$ of the Elasticity equations. 24 : * Useful as initial guess. 25 : */ 26 : template <size_t Dim> 27 1 : class Zero : public elliptic::analytic_data::AnalyticSolution { 28 : public: 29 0 : using options = tmpl::list<>; 30 0 : static constexpr Options::String help{ 31 : "The trivial solution, useful as initial guess."}; 32 : 33 0 : Zero() = default; 34 0 : Zero(const Zero&) = default; 35 0 : Zero& operator=(const Zero&) = default; 36 0 : Zero(Zero&&) = default; 37 0 : Zero& operator=(Zero&&) = default; 38 0 : ~Zero() override = default; 39 0 : std::unique_ptr<elliptic::analytic_data::AnalyticSolution> get_clone() 40 : const override { 41 : return std::make_unique<Zero>(*this); 42 : } 43 : 44 : /// \cond 45 : explicit Zero(CkMigrateMessage* m) 46 : : elliptic::analytic_data::AnalyticSolution(m) {} 47 : using PUP::able::register_constructor; 48 : WRAPPED_PUPable_decl_template(Zero); // NOLINT 49 : /// \endcond 50 : 51 : /// Retrieve a collection of variables at coordinates `x` 52 : template <typename DataType, typename... RequestedTags> 53 1 : tuples::TaggedTuple<RequestedTags...> variables( 54 : const tnsr::I<DataType, Dim>& x, 55 : tmpl::list<RequestedTags...> /*meta*/) const { 56 : using supported_tags = 57 : tmpl::list<Tags::Displacement<Dim>, 58 : ::Tags::deriv<Tags::Displacement<Dim>, tmpl::size_t<Dim>, 59 : Frame::Inertial>, 60 : Tags::Strain<Dim>, Tags::MinusStress<Dim>, 61 : Tags::PotentialEnergyDensity<Dim>, 62 : ::Tags::FixedSource<Tags::Displacement<Dim>>>; 63 : static_assert(tmpl::size<tmpl::list_difference<tmpl::list<RequestedTags...>, 64 : supported_tags>>::value == 0, 65 : "The requested tag is not supported"); 66 : return {make_with_value<typename RequestedTags::type>(x, 0.)...}; 67 : } 68 : }; 69 : 70 : /// \cond 71 : template <size_t Dim> 72 : PUP::able::PUP_ID Zero<Dim>::my_PUP_ID = 0; // NOLINT 73 : /// \endcond 74 : 75 : template <size_t Dim> 76 0 : bool operator==(const Zero<Dim>& /*lhs*/, const Zero<Dim>& /*rhs*/) { 77 : return true; 78 : } 79 : 80 : template <size_t Dim> 81 0 : bool operator!=(const Zero<Dim>& /*lhs*/, const Zero<Dim>& /*rhs*/) { 82 : return false; 83 : } 84 : } // namespace Elasticity::Solutions