module; #include #include export module mean_field:model.compiled_fixed_central_density; export import :eos.polytrope; export import :field.registry; export import :model.compiled_fixed_mass; export import :utils.blocks; export namespace mean_field::models { struct CentralDensityLayoutRequest final { using SpecificationType = FixedCentralDensity; using GeneratedValueType = BorderFor; using GeneratedResidualType = ResidualFor; using ValueBlockType = utils::blocks::fixed_central_density::central_value::value; using ResidualBlockType = utils::blocks::fixed_central_density::central_value::residual; using TermType = utils::blocks::fixed_central_density::central_value; using StateValueBlockTypes = ModelTypeList; static constexpr ConstraintRowInjection rowInjection = ConstraintRowInjection::solver_border; static constexpr std::size_t valueArity = GeneratedValueType::scalarArity; static constexpr std::size_t residualArity = GeneratedResidualType::scalarArity; template [[nodiscard]] static consteval auto valueBlock() { return utils::blocks::get_value_block
(TermType{}); } template [[nodiscard]] static consteval auto residualBlock() { return utils::blocks::get_residual_block(TermType{}); } }; class CompiledFixedCentralDensity final { public: using SpecificationType = FixedCentralDensity; using LayoutRequest = CentralDensityLayoutRequest; using BorderType = typename LayoutRequest::GeneratedValueType; using ResidualType = typename LayoutRequest::GeneratedResidualType; using CarrierField = field::Enthalpy; using BorderField = field::CentralDensityBorder; CompiledFixedCentralDensity( const FixedCentralDensity specification, const eos::Polytrope &equationOfState ) : m_specification(specification), m_equationOfState(equationOfState), m_targetEnthalpy( eos::evaluate( m_equationOfState, m_specification.targetDensity() ) ) { } [[nodiscard]] const FixedCentralDensity &specification() const noexcept { return m_specification; } [[nodiscard]] dimensions::DensityValue targetDensity() const noexcept { return m_specification.targetDensity(); } [[nodiscard]] dimensions::SpecificEnthalpyValue targetEnthalpy() const noexcept { return m_targetEnthalpy; } [[nodiscard]] dimensions::DensityValue densityFromEnthalpy(const dimensions::SpecificEnthalpyValue enthalpy) const { return eos::evaluate(m_equationOfState, enthalpy); } [[nodiscard]] static consteval LayoutRequest layoutRequest() noexcept { return {}; } private: FixedCentralDensity m_specification; eos::Polytrope m_equationOfState; dimensions::SpecificEnthalpyValue m_targetEnthalpy; }; [[nodiscard]] inline CompiledFixedCentralDensity compileConstraint( const FixedCentralDensity specification, const eos::Polytrope &equationOfState ) { return {specification, equationOfState}; } static_assert(ConstraintLayoutRequestType); static_assert(CompiledConstraint); } // namespace mean_field::models