Skip to content

[tests][2pncmin] corrected source term. Previously physically wrong, units did...

Johannes Hommel requested to merge bugfix/2pncmin into master

[tests][2pncmin] corrected source term. Previously physically wrong, units did not balance. Updated reference

Previously the moles of precipitated salt (precipSalt[mol/m³]) were in some cases set as the rate of dissolution/precipitation [mol/(m³ s)] and the check, not to dissolve more than available salt compared [(mol s)/m³] to [mol/m³]:

        Scalar precipSalt = volVars.porosity() * volVars.molarDensity(liquidPhaseIdx)
                                               * volVars.saturation(liquidPhaseIdx)
                                               * abs(moleFracNaCl_wPhase - moleFracNaCl_Max_wPhase);
        if (moleFracNaCl_wPhase < moleFracNaCl_Max_wPhase)
            precipSalt *= -1;

        // make sure we don't dissolve more salt than previously precipitated
        if (precipSalt*timeStepSize_ + volVars.solidVolumeFraction(sPhaseIdx)* volVars.solidComponentMolarDensity(sPhaseIdx)< 0)
            precipSalt = -volVars.solidVolumeFraction(sPhaseIdx)* volVars.solidComponentMolarDensity(sPhaseIdx)/timeStepSize_;

        // make sure there is still pore space available for precipitation
        if (volVars.solidVolumeFraction(sPhaseIdx) >= this->spatialParams().referencePorosity(element, scv) - saltPorosity  && precipSalt > 0)
            precipSalt = 0;

        source[conti0EqIdx + NaClIdx] += -precipSalt;
        source[precipNaClEqIdx] += precipSalt;

Fixed by correcting the rate calculation, now dividing by the time step size:

Scalar precipSalt = volVars.porosity() * volVars.molarDensity(liquidPhaseIdx)
                                               * volVars.saturation(liquidPhaseIdx)
                                               * abs(moleFracNaCl_wPhase - moleFracNaCl_Max_wPhase)
                                               / timeStepSize_;

Resulting in a source term that makes physical sense and has correct units, but of course produces different results, thus updated the reference solutions for the 2pncmin tests.

Merge request reports