Hello DuMuX developers,

I have a question about the implementation of dispersion in the 1PNC model (*localresidual.hh*). I am asking if the division on the molar mass is not missing in the case where we choose to work with the molar fraction and especially  that the variable referenceSystemFormulation is ReferenceSystemFormulation::massAveraged by default.

Below in red the relevant part in the code.

 // in case one balance is substituted by the total mole balance

            if (useTotalMoleOrMassBalance)
            {
                // the physical quantities for which we perform upwinding
                const auto upwindTerm = [&massOrMoleDensity, phaseIdx] (const auto& volVars)                 { return massOrMoleDensity(volVars, phaseIdx)*volVars.mobility(phaseIdx); };

                flux[replaceCompEqIdx] += fluxVars.advectiveFlux(phaseIdx, upwindTerm);

                for(int compIdx = 0; compIdx < numComponents; ++compIdx)
                {
                    //check for the reference system and adapt units of the diffusive flux accordingly.                     if (referenceSystemFormulation == ReferenceSystemFormulation::massAveraged)                         flux[replaceCompEqIdx] += useMoles ? diffusiveFluxes[compIdx]/FluidSystem::molarMass(compIdx) : diffusiveFluxes[compIdx];                     else if (referenceSystemFormulation == ReferenceSystemFormulation::molarAveraged)                         flux[replaceCompEqIdx] += useMoles ? diffusiveFluxes[compIdx]                                                 : diffusiveFluxes[compIdx]*FluidSystem::molarMass(compIdx);
                    else
                        DUNE_THROW(Dune::NotImplemented, "other reference systems than mass and molar averaged are not implemented");
                }
            }

            //! Add advective phase energy fluxes. For isothermal model the contribution is zero.             EnergyLocalResidual::heatConvectionFlux(flux, fluxVars, phaseIdx);

            if constexpr (ModelTraits::enableCompositionalDispersion())
            {
                if constexpr (FVElementGeometry::GridGeometry::discMethod == DiscretizationMethods::box && numPhases == 1)
                {
                    const auto dispersionFluxes = fluxVars.compositionalDispersionFlux(phaseIdx);                     for (int compIdx = 0; compIdx < numComponents; ++compIdx)
                    {
**flux[compIdx] += dispersionFluxes[compIdx]; **
                    }
                }
                else
                    DUNE_THROW(Dune::NotImplemented, "Dispersion Fluxes are only implemented for single phase flows using the Box method.");
            }

        }


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

Reply via email to