Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/Tag.hpp" 7 : #include "DataStructures/Tensor/Tensor.hpp" 8 : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp" 9 : #include "Evolution/Systems/ScalarTensor/Tags.hpp" 10 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 11 : #include "Utilities/Gsl.hpp" 12 : 13 : namespace ScalarTensor { 14 : 15 : /*! 16 : * \brief Add in the source term to the \f$\Pi\f$ 17 : * evolved variable of the ::CurvedScalarWave system. 18 : * 19 : * \details The only source term in the wave equation 20 : * \f[ 21 : * \Box \Psi = \mathcal{S} ~, 22 : * \f] 23 : * 24 : * is in the equation for \f$\Pi\f$: 25 : * \f[ 26 : * \partial_t \Pi + \text{\{spatial derivative 27 : * terms\}} = \alpha \mathcal{S} 28 : * ~, 29 : * \f] 30 : * 31 : * where \f$\mathcal{S}\f$ is the source term (e. g. in the Klein-Gordon 32 : * equation, the source term is the derivative of the scalar potential 33 : * \f$\mathcal{S} \equiv \partial V / \partial \Psi \f$.) 34 : * 35 : * This function adds that contribution to the existing value of `dt_pi_scalar`. 36 : * The wave equation terms in the scalar equation should be computed before 37 : * passing the `dt_pi_scalar` to this function for updating. 38 : * 39 : * \param dt_pi_scalar Time derivative terms of $\Pi$. The sourceless part 40 : * should be computed before with ::CurvedScalarWave::TimeDerivative. 41 : * \param scalar_source Source term $\mathcal{S}$ for the scalar equation. 42 : * \param lapse Lapse $\alpha$. 43 : * 44 : * \see `CurvedScalarWave::TimeDerivative` for details about the source-less 45 : * part of the time derivative calculation. 46 : */ 47 1 : void add_scalar_source_to_dt_pi_scalar( 48 : gsl::not_null<Scalar<DataVector>*> dt_pi_scalar, 49 : const Scalar<DataVector>& scalar_source, const Scalar<DataVector>& lapse); 50 : 51 : /*! 52 : * \brief Computes the source term given by the mass of the scalar. 53 : * 54 : * \details For a scalar field with mass parameter \f$ m_\Psi \f$, 55 : * the wave equation takes the form 56 : * \f[ 57 : * \Box \Psi = \mathcal{S} ~, 58 : * \f] 59 : * 60 : * where the source is given by 61 : * \f[ 62 : * \mathcal{S} \equiv m^2_\Psi \Psi~. 63 : * \f] 64 : * 65 : * Here the mass parameter value is an option that needs to be specified in the 66 : * input file. 67 : * 68 : * \param scalar_source Source term $\mathcal{S}$ for the scalar equation. 69 : * \param psi Scalar field $\Psi$. 70 : * \param mass_psi Mass of the scalar field $m_\Psi$. 71 : * 72 : * \see `ScalarTensor::Tags::ScalarMass` for details about the mass. 73 : */ 74 1 : void mass_source(gsl::not_null<Scalar<DataVector>*> scalar_source, 75 : const Scalar<DataVector>& psi, const double mass_psi); 76 : 77 : namespace Tags { 78 : 79 : /*! 80 : * \brief Compute tag for the scalar source. 81 : * 82 : * \details Compute the scalar source from data box items using 83 : * `mass_source`. 84 : */ 85 1 : struct ScalarSourceCompute : ScalarSource, db::ComputeTag { 86 0 : using argument_tags = 87 : tmpl::list<CurvedScalarWave::Tags::Psi, ScalarTensor::Tags::ScalarMass>; 88 0 : using return_type = Scalar<DataVector>; 89 0 : static constexpr void (*function)(const gsl::not_null<return_type*> result, 90 : const Scalar<DataVector>&, 91 : const double) = &mass_source; 92 0 : using base = ScalarSource; 93 : }; 94 : 95 : } // namespace Tags 96 : } // namespace ScalarTensor