Re: [DuMux] Override TwoPNCVolumeVariables::completeFluidState
Timo, The TwoPNCVolumeVariables::completeFluidState() call that I wanted to override was called from TwoPNCVolumeVariables::update(). This is expected: there is no MyTwoPNCVolumeVariables::update() and no easy way to override it because the original implementation needs private members of TwoPNCVolumeVariables. So I think am going to use the cloned implementation for now. Kilian asked me whether I am using the non-isothermal system; that is not the case. Best regards, Dmitry On 26.04.2021 18:12, Timo Koch wrote: On 26. Apr 2021, at 17:07, Dmitry Pavlov wrote: Kilian, Thank you, I wiped out my GridVariables and GridVolumeVariables as you suggested. It turns out the problem was that I inherited TwoPNCVolumeVariables in MyVolumeVariables. Once I stopped doing that and just copy-pasted the entire implementation, everything has come to normal. Hi Dmitry, that’s slightly strange. Letting your VolumeVariables inherit from TwoPNCVolumeVariables should be ok, too. Best Timo Best regards, Dmitry On 26.04.2021 09:45, Kilian Weishaupt wrote: Hi Dmitry, setting the Property for your own VolumeVariables (as you did) should be sufficient. I am just wondering at which point TwoPNCVolumeVariables is still used. Have you searched in your code for them? Are you by chance considering a non-isothermal system? Can you give more details on the first compiler error you get when only setting the VolumeVariables Property (without your subsequent steps)? Best Kilian On 25.04.21 20:41, Dmitry Pavlov wrote: 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 struct VolumeVariables { private: using PV = GetPropType; using FSY = GetPropType; using FST = GetPropType; using SSY = GetPropType; using SST = GetPropType; using PT = typename GetPropType::PermeabilityType; using MT = GetPropType; static constexpr auto DM = GetPropType::discMethod; static constexpr bool enableIS = getPropValue(); using SR = TwoPScvSaturationReconstruction; using BaseTraits = TwoPVolumeVariablesTraits; using DT = GetPropType; using EDM = GetPropType; template struct NCTraits : public BaseTraits { using DiffusionType = DT; using EffectiveDiffusivityModel = EDM; }; public: using type = MyVolumeVariables>; }; 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 struct GridVolumeVariables { private: static constexpr bool enableCache = getPropValue(); using Problem = GetPropType; using PV = GetPropType; [...] using VolumeVariables = MyVolumeVariables>; public: using type = BoxGridVolumeVariables; }; template struct GridVariables { private: using GG = GetPropType; using GVV = GetPropType; using GFVC = GetPropType; public: using type = FVGridVariables; }; 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 DuMux@listserv.uni-stuttgart.de https://listserv.uni-stuttgart.de/mailman/listinfo/dumux ___ DuMux mailing list DuMux@listserv.uni-stuttgart.de https://listserv.uni-stuttgart.de/mailman/listinfo/dumux ___ DuMux mailing list DuMux@listserv.uni-stuttgart.de
Re: [DuMux] Override TwoPNCVolumeVariables::completeFluidState
> On 26. Apr 2021, at 17:07, Dmitry Pavlov wrote: > > Kilian, > > Thank you, I wiped out my GridVariables and GridVolumeVariables as you > suggested. > > It turns out the problem was that I inherited TwoPNCVolumeVariables in > MyVolumeVariables. Once I stopped doing that and just copy-pasted the entire > implementation, everything has come to normal. Hi Dmitry, that’s slightly strange. Letting your VolumeVariables inherit from TwoPNCVolumeVariables should be ok, too. Best Timo > > Best regards, > > Dmitry > > > On 26.04.2021 09:45, Kilian Weishaupt wrote: >> Hi Dmitry, >> >> setting the Property for your own VolumeVariables (as you did) should be >> sufficient. I am just wondering at which point TwoPNCVolumeVariables is >> still used. Have you searched in your code for them? >> Are you by chance considering a non-isothermal system? >> >> Can you give more details on the first compiler error you get when only >> setting the VolumeVariables Property (without your subsequent steps)? >> >> Best >> Kilian >> >> On 25.04.21 20:41, Dmitry Pavlov wrote: >>> 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 >>> struct VolumeVariables >>> { >>> private: >>> using PV = GetPropType; >>> using FSY = GetPropType; >>> using FST = GetPropType; >>> using SSY = GetPropType; >>> using SST = GetPropType; >>> using PT = typename GetPropType>> Properties::SpatialParams>::PermeabilityType; >>> using MT = GetPropType; >>> static constexpr auto DM = GetPropType>> Properties::GridGeometry>::discMethod; >>> static constexpr bool enableIS = getPropValue>> Properties::EnableBoxInterfaceSolver>(); >>> using SR = TwoPScvSaturationReconstruction; >>> using BaseTraits = TwoPVolumeVariablesTraits>> SST, PT, MT, SR>; >>> >>> using DT = GetPropType>> Properties::MolecularDiffusionType>; >>> using EDM = GetPropType>> Properties::EffectiveDiffusivityModel>; >>> template >>> struct NCTraits : public BaseTraits >>> { >>> using DiffusionType = DT; >>> using EffectiveDiffusivityModel = EDM; >>> }; >>> >>> public: >>> using type = MyVolumeVariables>; >>> }; >>> >>> 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 >>> struct GridVolumeVariables >>> { >>> private: >>> static constexpr bool enableCache = getPropValue>> Properties::EnableGridVolumeVariablesCache>(); >>> using Problem = GetPropType; >>> >>> using PV = GetPropType; >>> [...] >>> >>> using VolumeVariables = MyVolumeVariables>> DT, EDM>>; >>> public: >>> using type = BoxGridVolumeVariables>> enableCache>; >>> }; >>> >>> template >>> struct GridVariables >>> { >>> private: >>> using GG = GetPropType; >>> using GVV = GetPropType>> Properties::GridVolumeVariables>; >>> using GFVC = GetPropType>> Properties::GridFluxVariablesCache>; >>> public: >>> using type = FVGridVariables; >>> }; >>> >>> 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 >>> DuMux@listserv.uni-stuttgart.de >>> https://listserv.uni-stuttgart.de/mailman/listinfo/dumux >> >
Re: [DuMux] Override TwoPNCVolumeVariables::completeFluidState
Kilian, Thank you, I wiped out my GridVariables and GridVolumeVariables as you suggested. It turns out the problem was that I inherited TwoPNCVolumeVariables in MyVolumeVariables. Once I stopped doing that and just copy-pasted the entire implementation, everything has come to normal. Best regards, Dmitry On 26.04.2021 09:45, Kilian Weishaupt wrote: Hi Dmitry, setting the Property for your own VolumeVariables (as you did) should be sufficient. I am just wondering at which point TwoPNCVolumeVariables is still used. Have you searched in your code for them? Are you by chance considering a non-isothermal system? Can you give more details on the first compiler error you get when only setting the VolumeVariables Property (without your subsequent steps)? Best Kilian On 25.04.21 20:41, Dmitry Pavlov wrote: 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 struct VolumeVariables { private: using PV = GetPropTypeProperties::PrimaryVariables>; using FSY = GetPropType; using FST = GetPropType; using SSY = GetPropType; using SST = GetPropType; using PT = typename GetPropTypeProperties::SpatialParams>::PermeabilityType; using MT = GetPropType; static constexpr auto DM = GetPropTypeProperties::GridGeometry>::discMethod; static constexpr bool enableIS = getPropValueProperties::EnableBoxInterfaceSolver>(); using SR = TwoPScvSaturationReconstruction; using BaseTraits = TwoPVolumeVariablesTraitsFST, SSY, SST, PT, MT, SR>; using DT = GetPropTypeProperties::MolecularDiffusionType>; using EDM = GetPropTypeProperties::EffectiveDiffusivityModel>; template struct NCTraits : public BaseTraits { using DiffusionType = DT; using EffectiveDiffusivityModel = EDM; }; public: using type = MyVolumeVariablesEDM>>; }; 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 struct GridVolumeVariables { private: static constexpr bool enableCache = getPropValueProperties::EnableGridVolumeVariablesCache>(); using Problem = GetPropType; using PV = GetPropTypeProperties::PrimaryVariables>; [...] using VolumeVariables = MyVolumeVariables>; public: using type = BoxGridVolumeVariablesVolumeVariables, enableCache>; }; template struct GridVariables { private: using GG = GetPropType; using GVV = GetPropTypeProperties::GridVolumeVariables>; using GFVC = GetPropTypeProperties::GridFluxVariablesCache>; public: using type = FVGridVariables; }; 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 DuMux@listserv.uni-stuttgart.de https://listserv.uni-stuttgart.de/mailman/listinfo/dumux ___ DuMux mailing list DuMux@listserv.uni-stuttgart.de https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
Re: [DuMux] Override TwoPNCVolumeVariables::completeFluidState
Hi Dmitry, setting the Property for your own VolumeVariables (as you did) should be sufficient. I am just wondering at which point TwoPNCVolumeVariables is still used. Have you searched in your code for them? Are you by chance considering a non-isothermal system? Can you give more details on the first compiler error you get when only setting the VolumeVariables Property (without your subsequent steps)? Best Kilian On 25.04.21 20:41, Dmitry Pavlov wrote: 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 struct VolumeVariables { private: using PV = GetPropTypeProperties::PrimaryVariables>; using FSY = GetPropType; using FST = GetPropType; using SSY = GetPropType; using SST = GetPropType; using PT = typename GetPropTypeProperties::SpatialParams>::PermeabilityType; using MT = GetPropType; static constexpr auto DM = GetPropTypeProperties::GridGeometry>::discMethod; static constexpr bool enableIS = getPropValueProperties::EnableBoxInterfaceSolver>(); using SR = TwoPScvSaturationReconstruction; using BaseTraits = TwoPVolumeVariablesTraitsSSY, SST, PT, MT, SR>; using DT = GetPropTypeProperties::MolecularDiffusionType>; using EDM = GetPropTypeProperties::EffectiveDiffusivityModel>; template struct NCTraits : public BaseTraits { using DiffusionType = DT; using EffectiveDiffusivityModel = EDM; }; public: using type = MyVolumeVariablesEDM>>; }; 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 struct GridVolumeVariables { private: static constexpr bool enableCache = getPropValueProperties::EnableGridVolumeVariablesCache>(); using Problem = GetPropType; using PV = GetPropTypeProperties::PrimaryVariables>; [...] using VolumeVariables = MyVolumeVariables>; public: using type = BoxGridVolumeVariablesVolumeVariables, enableCache>; }; template struct GridVariables { private: using GG = GetPropType; using GVV = GetPropTypeProperties::GridVolumeVariables>; using GFVC = GetPropTypeProperties::GridFluxVariablesCache>; public: using type = FVGridVariables; }; 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 DuMux@listserv.uni-stuttgart.de https://listserv.uni-stuttgart.de/mailman/listinfo/dumux -- Kilian Weishaupt Institut für Wasser- und Umweltsystemmodellierung (IWS) Lehrstuhl für Hydromechanik und Hydrosystemmodellierung Universität Stuttgart, Pfaffenwaldring 61, 70569 Stuttgart Email: kilian.weisha...@iws.uni-stuttgart.de Telefon: 0049 711 685-60461 ** fax: 0049-711-685-60430 http://www.hydrosys.uni-stuttgart.de ___ DuMux mailing list DuMux@listserv.uni-stuttgart.de https://listserv.uni-stuttgart.de/mailman/listinfo/dumux