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

Reply via email to