Skip to content
Snippets Groups Projects
Commit ed61fa6c authored by Timo Koch's avatar Timo Koch
Browse files

[richards] Make fluid system check reusable and check in several places

parent febf1013
No related branches found
No related tags found
1 merge request!2784Feature/richards fluidsystem
Pipeline #7634 passed
Pipeline: dumux-lecture

#7653

    Pipeline: dumux

    #7638

      Pipeline: dumux

      #7637

        +2
        ...@@ -79,6 +79,9 @@ class RichardsLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalR ...@@ -79,6 +79,9 @@ class RichardsLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalR
        // first index for the mass balance // first index for the mass balance
        enum { conti0EqIdx = Indices::conti0EqIdx }; enum { conti0EqIdx = Indices::conti0EqIdx };
        // checks if the fluid system uses the Richards model index convention
        static constexpr auto fsCheck = GetPropType<TypeTag, Properties::ModelTraits>::checkFluidSystem(FluidSystem{});
        // phase & component indices // phase & component indices
        static constexpr auto liquidPhaseIdx = FluidSystem::phase0Idx; static constexpr auto liquidPhaseIdx = FluidSystem::phase0Idx;
        static constexpr auto gasPhaseIdx = FluidSystem::phase1Idx; static constexpr auto gasPhaseIdx = FluidSystem::phase1Idx;
        ......
        ...@@ -133,6 +133,27 @@ struct RichardsModelTraits ...@@ -133,6 +133,27 @@ struct RichardsModelTraits
        static constexpr bool enableAdvection() { return true; } static constexpr bool enableAdvection() { return true; }
        static constexpr bool enableMolecularDiffusion() { return enableDiff; } static constexpr bool enableMolecularDiffusion() { return enableDiff; }
        static constexpr bool enableEnergyBalance() { return false; } static constexpr bool enableEnergyBalance() { return false; }
        //! The Richards model has some assumptions on the fluid systems
        //! that can be verified with this trait
        template<class FluidSystem>
        static constexpr bool fluidSystemIsCompatible()
        {
        return !FluidSystem::isGas(FluidSystem::phase0Idx)
        && FluidSystem::isGas(FluidSystem::phase1Idx);
        }
        //! The Richards model has some assumptions on the fluid systems
        //! that can be verified with this trait
        template<class FluidSystem>
        static constexpr auto checkFluidSystem(const FluidSystem& fs)
        {
        struct FluidSystemCheck {
        static_assert(fluidSystemIsCompatible<FluidSystem>(),
        "Richards model currently assumes the first phase to be liquid and the second phase to be gaseous.");
        };
        return FluidSystemCheck{};
        }
        }; };
        /*! /*!
        ......
        ...@@ -75,6 +75,9 @@ class RichardsVolumeVariables ...@@ -75,6 +75,9 @@ class RichardsVolumeVariables
        using EffDiffModel = typename Traits::EffectiveDiffusivityModel; using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
        // checks if the fluid system uses the Richards model index convention
        static constexpr auto fsCheck = ModelTraits::checkFluidSystem(typename Traits::FluidSystem{});
        public: public:
        //! Export type of the fluid system //! Export type of the fluid system
        using FluidSystem = typename Traits::FluidSystem; using FluidSystem = typename Traits::FluidSystem;
        ...@@ -93,9 +96,6 @@ public: ...@@ -93,9 +96,6 @@ public:
        static constexpr auto liquidPhaseIdx = Traits::FluidSystem::phase0Idx; static constexpr auto liquidPhaseIdx = Traits::FluidSystem::phase0Idx;
        static constexpr auto gasPhaseIdx = Traits::FluidSystem::phase1Idx; static constexpr auto gasPhaseIdx = Traits::FluidSystem::phase1Idx;
        static_assert(!Traits::FluidSystem::isGas(liquidPhaseIdx), "Richards model assumes first phase to be liquid");
        static_assert(Traits::FluidSystem::isGas(gasPhaseIdx), "Richards model assumes second phase to be gaseous");
        /*! /*!
        * \brief Updates all quantities for a given control volume. * \brief Updates all quantities for a given control volume.
        * *
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment