Dear Mustapha and Birger,
the dispersionFlux comes from fluxVars.compositionalDispersionFlux(phaseIdx) in https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/porousmediumflow/fluxvariables.hh?ref_type=heads#L120, which further redirects to the discretization-specific implementation in e.g. https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/flux/box/dispersionflux.hh?ref_type=heads#L103 where `massOrMolarDensity` is used. Just like the advective term, where we upwind `massOrMoleDensity * mobility`, the usage of mass or mole fractions in the equation should be accounted for. It's only the diffusive fluxes, calculated directly in the local residual that have the adjustment visible. The term looks correct to me, do you see any other issues with it? Best regards, Mathis ________________________________ From: DuMux <[email protected]> on behalf of Birger Hagemann <[email protected]> Sent: Friday, 15 November 2024 09:39:58 To: DuMux User Mailing List Subject: Re: [DuMux] dispersion flux in the 1PNC model (localresidual.hh) Dear Mustapha, As far as I understand, you are right. The current implementation is only correct, when you work with moles (useMoles = true) and your reference system for the dispersive fluxes is molarAveraged or when for both mass is used. For other combinations either the division or multiplication by the molar mass is missing. This could be implemented in the same way as for the diffusive fluxes. Regards Birger Von: DuMux <[email protected]> Im Auftrag von mustapha El Ossmani Gesendet: Dienstag, 5. November 2024 23:13 An: DuMux User Mailing List <[email protected]> Betreff: [DuMux] dispersion flux in the 1PNC model (localresidual.hh) 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
