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 Jan 24, 2024
1 parent 30f5d01 commit 7912e24
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@ Foam::Pmt::unsaturatedFlowModels::BrooksAndCorey::BrooksAndCorey
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::BrooksAndCorey::C()
{
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()
{
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
Expand Up @@ -48,7 +48,7 @@ Foam::Pmt::unsaturatedFlowModels::LETd::LETd
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::LETd::D()
{
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
Expand Up @@ -57,7 +57,7 @@ Foam::Pmt::unsaturatedFlowModels::LETxs::LETxs
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::LETxs::D()
{
volScalarField Swp{frac_.eff()};
volScalarField Swp{min(frac_.eff(), 1 - 1e-7)};
auto Swir = frac_.min()/frac_.max();

return
Expand Down
8 changes: 3 additions & 5 deletions libraries/unsaturatedFlowModels/VanGenuchten/VanGenuchten.C
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@ Foam::Pmt::unsaturatedFlowModels::VanGenuchten::VanGenuchten
Foam::tmp<Foam::volScalarField>
Foam::Pmt::unsaturatedFlowModels::VanGenuchten::C()
{
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()
{
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
Expand Up @@ -16,7 +16,7 @@ boundaryField
left
{
type exhaustible;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
remaining 2e-8;
}
right
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parallelization/serial/0/theta
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ boundaryField
left
{
type fixedValue;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
}
right
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_validity/base/0/theta
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ boundaryField
left
{
type fixedValue;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
}
right
{
Expand Down
2 changes: 1 addition & 1 deletion tutorials/moistureDiffusivityFoam/validity/base/0/theta
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ boundaryField
left
{
type fixedValue;
value uniform 0.6999999; //= 0.7 - 1e-7
value uniform 0.7;
}
right
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +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
Expand Up @@ -33,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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class volScalarField;
location "0";
object theta;
Expand All @@ -24,20 +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 7912e24

Please sign in to comment.