Skip to content

Commit

Permalink
Handle saturated theta values
Browse files Browse the repository at this point in the history
  • Loading branch information
gerlero committed Dec 22, 2023
1 parent 726e641 commit 2b585cd
Showing 11 changed files with 31 additions and 63 deletions.
Original file line number Diff line number Diff line change
@@ -51,16 +51,17 @@ Foam::Pmt::unsaturatedFlowModels::BrooksAndCorey::BrooksAndCorey
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::BrooksAndCorey::C(const phaseFractionField& frac)
{
volScalarField p{-pc0_*pow(frac.eff(), -alpha_)};
auto eff = min(frac.eff(), 1 - 1e-7);

volScalarField p{-pc0_*pow(eff, -alpha_)};

return -neg(p + pc0_)*(frac.max() - frac.min())/(alpha_*p*pow(-p/pc0_, 1/alpha_));
}

Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::BrooksAndCorey::M(const phaseFractionField& frac)
{
volScalarField eff{frac.eff()};
auto eff = min(frac.eff(), 1 - 1e-7);

return medium_.K()/phase_.mu()*pow(eff, n_ + l_ - 1)
+ neg0(1 - eff)*dimensionedScalar{dimArea/dimDynamicViscosity, One};
return medium_.K()/phase_.mu()*pow(eff, n_ + l_ - 1);
}
2 changes: 1 addition & 1 deletion libraries/unsaturatedFlowModels/LETd/LETd.C
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ Foam::Pmt::unsaturatedFlowModels::LETd::LETd
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::LETd::D(const phaseFractionField& frac)
{
volScalarField Swp{frac.eff()};
volScalarField Swp{min(frac.eff(), 1 - 1e-7)};

return Dwt_*pow(Swp, L_)/(pow(Swp, L_) + E_*pow(1 - Swp, T_));
}
2 changes: 1 addition & 1 deletion libraries/unsaturatedFlowModels/LETxs/LETxs.C
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ Foam::Pmt::unsaturatedFlowModels::LETxs::LETxs
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::LETxs::D(const phaseFractionField& frac)
{
volScalarField Swp{frac.eff()};
volScalarField Swp{min(frac.eff(), 1 - 1e-7)};
auto Swir = frac.min()/frac.max();

return
8 changes: 3 additions & 5 deletions libraries/unsaturatedFlowModels/VanGenuchten/VanGenuchten.C
Original file line number Diff line number Diff line change
@@ -62,17 +62,15 @@ Foam::Pmt::unsaturatedFlowModels::VanGenuchten::VanGenuchten
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::VanGenuchten::C(const phaseFractionField& frac)
{
volScalarField Se{frac.eff()};
volScalarField Se{min(frac.eff(), 1 - 1e-7)};

return 1/pc0_*m_/(1 - m_)*(frac.max() - frac.min())*pow(Se, 1/m_)*pow((1 - pow(Se, 1/m_)), m_);
}

Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::VanGenuchten::M(const phaseFractionField& frac)
{
volScalarField Se{frac.eff()};
volScalarField Se{min(frac.eff(), 1 - 1e-7)};

return
pos(1 - Se)*medium_.K()/phase_.mu()*pow(Se, l_)*pow(1 - pow(1 - pow(Se, 1/m_), m_), 2)
+ neg0(1 - Se)*dimensionedScalar{dimArea/dimDynamicViscosity, One};
return medium_.K()/phase_.mu()*pow(Se, l_)*pow(1 - pow(1 - pow(Se, 1/m_), m_), 2);
}
2 changes: 1 addition & 1 deletion tests/test_exhaustible/0/theta
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ boundaryField
left
{
type exhaustible;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
remaining 2e-8;
}
right
2 changes: 1 addition & 1 deletion tests/test_parallelization/serial/0/theta
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ boundaryField
left
{
type fixedValue;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
}
right
{
2 changes: 1 addition & 1 deletion tests/test_validity/base/0/theta
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ boundaryField
left
{
type fixedValue;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
}
right
{
2 changes: 1 addition & 1 deletion tutorials/moistureDiffusivityFoam/validity/base/0/theta
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ boundaryField
left
{
type fixedValue;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
}
right
{
19 changes: 4 additions & 15 deletions tutorials/moistureDiffusivityTransportFoam/dispersionTest/0/Utheta
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
@@ -13,7 +6,6 @@ FoamFile
location "0";
object Utheta;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

@@ -31,21 +23,18 @@ boundaryField
}
inletU
{
type zeroGradient;
type zeroGradient;
}
inletD
{
type zeroGradient;
type zeroGradient;
}
outletD
{
type zeroGradient;
type zeroGradient;
}
outletU
{
type zeroGradient;
type zeroGradient;
}
}


// ************************************************************************* //
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: v3.0+ |
| \ / A nd | Web: www.OpenFOAM.com |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile{
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object ampholyte.TARTRAZINE;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 -3 0 0 1 0 0];

@@ -30,7 +23,7 @@ boundaryField
}
inletU
{
type fixedValue;
type fixedValue;
value uniform 0.0;
}
inletD
@@ -40,12 +33,12 @@ boundaryField
}
outletD
{
type inletOutlet;
inletValue uniform 0.0;
type inletOutlet;
inletValue uniform 0.0;
}
outletU
{
type inletOutlet;
inletValue uniform 0.0;
type inletOutlet;
inletValue uniform 0.0;
}
}
25 changes: 6 additions & 19 deletions tutorials/moistureDiffusivityTransportFoam/dispersionTest/0/theta
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class volScalarField;
location "0";
object theta;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 0 0 0 0 0 0];

@@ -32,24 +23,20 @@ boundaryField
}
inletU
{
type fixedValue;
value uniform 0.6999999;
type fixedValue;
value uniform 0.7;
}
inletD
{
type fixedValue;
value uniform 0.6999999;
type fixedValue;
value uniform 0.7;
}
outletD
{
type zeroGradient;
type zeroGradient;
}
outletU
{
type zeroGradient;
type zeroGradient;
}
}



// ************************************************************************* //

0 comments on commit 2b585cd

Please sign in to comment.