Skip to content
Snippets Groups Projects
Commit a1c2c41d authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[3p3c][localresidual] Clean-up

parent a49c08d4
No related branches found
No related tags found
1 merge request!1696Feature/diffusion laws mass refvelocity
...@@ -34,8 +34,6 @@ namespace Dumux ...@@ -34,8 +34,6 @@ namespace Dumux
* \ingroup ThreePThreeCModel * \ingroup ThreePThreeCModel
* \brief Element-wise calculation of the Jacobian matrix for problems * \brief Element-wise calculation of the Jacobian matrix for problems
* using the three-phase three-component fully implicit model. * using the three-phase three-component fully implicit model.
*
* This class is used to fill the gaps in BoxLocalResidual for the 3P3C flow.
*/ */
template<class TypeTag> template<class TypeTag>
class ThreePThreeCLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> class ThreePThreeCLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual>
...@@ -162,54 +160,35 @@ public: ...@@ -162,54 +160,35 @@ public:
// Add diffusive energy fluxes. For isothermal model the contribution is zero. // Add diffusive energy fluxes. For isothermal model the contribution is zero.
EnergyLocalResidual::heatConductionFlux(flux, fluxVars); EnergyLocalResidual::heatConductionFlux(flux, fluxVars);
const auto diffusionFluxesWPhase = fluxVars.molecularDiffusionFlux(wPhaseIdx);
// diffusive fluxes // diffusive fluxes
Scalar jGW = 0.0; const auto diffusionFluxesWPhase = fluxVars.molecularDiffusionFlux(wPhaseIdx);
Scalar jNW = 0.0; Scalar jGW = diffusionFluxesWPhase[gCompIdx];
Scalar jWW = 0.0; Scalar jNW = diffusionFluxesWPhase[nCompIdx];
//check for the reference system and adapt units of the diffusive flux accordingly. //check for the reference system and adapt units of the diffusive flux accordingly.
if (referenceSystemFormulation == ReferenceSystemFormulation::massAveraged) if (referenceSystemFormulation == ReferenceSystemFormulation::massAveraged)
{ {
jGW += diffusionFluxesWPhase[gCompIdx]/FluidSystem::molarMass(gCompIdx); jGW /= FluidSystem::molarMass(gCompIdx);
jNW += diffusionFluxesWPhase[nCompIdx]/FluidSystem::molarMass(nCompIdx); jNW /= FluidSystem::molarMass(nCompIdx);
} }
else if (referenceSystemFormulation == ReferenceSystemFormulation::molarAveraged) const Scalar jWW = -(jGW+jNW);
{
jGW += diffusionFluxesWPhase[gCompIdx];
jNW += diffusionFluxesWPhase[nCompIdx];
}
else
DUNE_THROW(Dune::NotImplemented, "other reference systems than mass and molar averaged are not implemented");
jWW += -(jGW+jNW);
const auto diffusionFluxesGPhase = fluxVars.molecularDiffusionFlux(gPhaseIdx); const auto diffusionFluxesGPhase = fluxVars.molecularDiffusionFlux(gPhaseIdx);
Scalar jWG = diffusionFluxesGPhase[wCompIdx];
Scalar jWG = 0.0; Scalar jNG = diffusionFluxesGPhase[nCompIdx];
Scalar jNG = 0.0;
Scalar jGG = 0.0;
//check for the reference system and adapt units of the diffusive flux accordingly. //check for the reference system and adapt units of the diffusive flux accordingly.
if (referenceSystemFormulation == ReferenceSystemFormulation::massAveraged) if (referenceSystemFormulation == ReferenceSystemFormulation::massAveraged)
{ {
jWG += diffusionFluxesGPhase[wCompIdx]/FluidSystem::molarMass(wCompIdx); jWG /= FluidSystem::molarMass(wCompIdx);
jNG += diffusionFluxesGPhase[nCompIdx]/FluidSystem::molarMass(nCompIdx); jNG /= FluidSystem::molarMass(nCompIdx);
} }
else const Scalar jGG = -(jWG+jNG);
{
jWG += diffusionFluxesGPhase[wCompIdx];
jNG += diffusionFluxesGPhase[nCompIdx];
}
jGG += -(jWG+jNG);
// At the moment we do not consider diffusion in the NAPL phase // At the moment we do not consider diffusion in the NAPL phase
Scalar jWN = 0.0; const Scalar jWN = 0.0;
Scalar jGN = 0.0; const Scalar jGN = 0.0;
Scalar jNN = 0.0; const Scalar jNN = 0.0;
flux[contiWEqIdx] += jWW+jWG+jWN; flux[contiWEqIdx] += jWW+jWG+jWN;
flux[contiNEqIdx] += jNW+jNG+jNN; flux[contiNEqIdx] += jNW+jNG+jNN;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment