Hello,

I am using the 2pnc model for compositional gas+oil simulation and I think the way TwoPNCVolumeVariables::completeFluidState works now does not satisfy my needs. One thing is MiscibleMultiPhaseComposition being not designed for non-ideal mixtures, the other is ComputeFromReferencePhase machinery which I find puzzling, interfering and not related to the problem I am trying to solve.

So I thought, DuMux is flexible and I should be able to set my own properties for my problem tag. I added the following into problem.hh

        template<class TypeTag>
        struct VolumeVariables<TypeTag, TTag::My>
        {
        private:
            using PV = GetPropType<TypeTag, Properties::PrimaryVariables>;
            using FSY = GetPropType<TypeTag, Properties::FluidSystem>;
            using FST = GetPropType<TypeTag, Properties::FluidState>;
            using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
            using SST = GetPropType<TypeTag, Properties::SolidState>;
            using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
            using MT = GetPropType<TypeTag, Properties::ModelTraits>;
            static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;             static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
            using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
            using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;

            using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;             using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
            template<class BaseTraits, class DT, class EDM>
            struct NCTraits : public BaseTraits
            {
                using DiffusionType = DT;
                using EffectiveDiffusivityModel = EDM;
            };

        public:
            using type = MyVolumeVariables<NCTraits<BaseTraits, DT, EDM>>;
        };

It partially works because I am

using PrimaryVariableSwitch = MyPrimaryVariableSwitch;

in MyVolumeVariables and it gets properly called.


But the following line the VtkOutputModule

                auto elemVolVars = localView(gridVariables_.curGridVolVars());

is template-instantiated with VolumeVariables = TwoPNCVolumeVariables, not MyVolumeVariables. I tried tracking down why, got lost in GridVariables and GridVolumeVariables, tried as the last resort adding the following in problem.hh

         //! The grid volume variables vector class
        template<class TypeTag>
        struct GridVolumeVariables<TypeTag, TTag::My>
        {
        private:
            static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridVolumeVariablesCache>();
            using Problem = GetPropType<TypeTag, Properties::Problem>;

            using PV = GetPropType<TypeTag, Properties::PrimaryVariables>;
            [...]

            using VolumeVariables = MyVolumeVariables<NCTraits<BaseTraits, DT, EDM>>;
        public:
            using type = BoxGridVolumeVariables<Problem, VolumeVariables, enableCache>;
        };

        template<class TypeTag>
        struct GridVariables<TypeTag, TTag::My>
        {
        private:
            using GG = GetPropType<TypeTag, Properties::GridGeometry>;
            using GVV = GetPropType<TypeTag, Properties::GridVolumeVariables>;             using GFVC = GetPropType<TypeTag, Properties::GridFluxVariablesCache>;
        public:
            using type = FVGridVariables<GG, GVV, GFVC>;
        };

And got the following error from dumux/dumux/assembly/fvlocalassemblerbase.hh:315:29: error: invalid initialization of reference of type ...

The problematic line is

     { return elemVolVars[scv]; }

At this point I am not sure I am on the right path. Any help will be much appreciated.


Best regards,

Dmitry



_______________________________________________
DuMux mailing list
[email protected]
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to