Commit 57441a3a authored by Lukas Riedel's avatar Lukas Riedel

Consider upwinding schemes in Dirichlet BC

For no upwinding, the harmonic average of theconductivity factors is computed.
parent 99db5435
...@@ -538,27 +538,40 @@ public: ...@@ -538,27 +538,40 @@ public:
// conductivity at saturation // conductivity at saturation
const RF satCond_s = param.condRefToMiller(param.K(p_global_s), p_global_s); const RF satCond_s = param.condRefToMiller(param.K(p_global_s), p_global_s);
const RF penalty = penalty_factor / h_F * degree * (degree + dim - 1); // conductivity factor
const RF head_s = param.headMillerToRef(u_s, p_global_s);
const RF saturation_s = param.saturation(head_s, p_global_s);
const RF relCond_s = param.condFactor(saturation_s, p_global_s);
// compute numerical flux estimation const RF saturation_n = param.saturation(g, p_global_s);
const RF numFlux = satCond_s * ( - (gradu_s * normal) + penalty * jump); const RF relCond_n = param.condFactor(saturation_n, p_global_s);
RF head_upwind; // penalty
if (numFlux > 0) const RF penalty = penalty_factor / h_F * degree * (degree + dim - 1);
head_upwind = param.headMillerToRef(u_s, p_global_s);
else
head_upwind = g; // Miller here?!
// compute saturation from matrix head // compute numerical flux
const RF saturation_upwind = param.saturation(head_upwind, p_global_s); const RF numFlux = satCond_s * (-(gradu_s * normal) + penalty * jump);
// compute relative conductivity // compute conductivity factor
const RF relCond_upwind = param.condFactor(saturation_upwind, p_global_s); RF relCond;
if (upwinding == RichardsDGUpwinding::semiUpwind
|| upwinding == RichardsDGUpwinding::fullUpwind)
{
if (numFlux > 0)
relCond = relCond_s;
else
relCond = relCond_n;
}
else if (upwinding == RichardsDGUpwinding::none)
{
// harmonic average of conductivity factors
relCond = 2 * relCond_s * relCond_n / (relCond_s + relCond_n);
}
// switches between Neumann and Dirichlet bc // switches between Neumann and Dirichlet bc
// this choice is kept constant for one time step // this choice is kept constant for one time step
normal_flux = boundary.j(ig.intersection(),it.position(),time); normal_flux = boundary.j(ig.intersection(),it.position(),time);
if(relCond_upwind * numFlux < normal_flux) { if(relCond * numFlux < normal_flux) {
bcType = BCType::dirichlet; bcType = BCType::dirichlet;
bc_type_cache.emplace(it_id,BoundaryCondition::Dirichlet); bc_type_cache.emplace(it_id,BoundaryCondition::Dirichlet);
} }
...@@ -616,35 +629,48 @@ public: ...@@ -616,35 +629,48 @@ public:
// conductivity at saturation // conductivity at saturation
const RF satCond_s = param.condRefToMiller(param.K(p_global_s), p_global_s); const RF satCond_s = param.condRefToMiller(param.K(p_global_s), p_global_s);
// conductivity factor
const RF head_s = param.headMillerToRef(u_s, p_global_s);
const RF saturation_s = param.saturation(head_s, p_global_s);
const RF relCond_s = param.condFactor(saturation_s, p_global_s);
const RF saturation_n = param.saturation(g, p_global_s);
const RF relCond_n = param.condFactor(saturation_n, p_global_s);
// penalty
const RF penalty = penalty_factor / h_F * degree * (degree + dim - 1); const RF penalty = penalty_factor / h_F * degree * (degree + dim - 1);
// compute numerical flux // compute numerical flux
const RF numFlux = satCond_s * ( - (gradu_s * normal) + penalty * jump); const RF numFlux = satCond_s * ( - (gradu_s * normal) + penalty * jump);
RF head_upwind; // compute conductivity factor
if (numFlux > 0) RF relCond;
head_upwind = param.headMillerToRef(u_s, p_global_s); if (upwinding == RichardsDGUpwinding::semiUpwind
else || upwinding == RichardsDGUpwinding::fullUpwind)
head_upwind = g; // Miller here?! {
if (numFlux > 0)
// compute saturation from matrix head relCond = relCond_s;
const RF saturation_upwind = param.saturation(head_upwind, p_global_s); else
relCond = relCond_n;
// compute relative conductivity }
const RF relCond_upwind = param.condFactor(saturation_upwind, p_global_s); else if (upwinding == RichardsDGUpwinding::none)
{
// harmonic average of conductivity factors
relCond = 2 * relCond_s * relCond_n / (relCond_s + relCond_n);
}
// update residual (flux term) // update residual (flux term)
// diffusion term // diffusion term
// consistency term // consistency term
// + penalty term // + penalty term
for (unsigned int i = 0; i<lfsv_s.size(); i++) for (unsigned int i = 0; i<lfsv_s.size(); i++)
r_s.accumulate(lfsv_s,i, relCond_upwind * numFlux * phi_s[i] * factor); r_s.accumulate(lfsv_s,i, relCond * numFlux * phi_s[i] * factor);
// update residual (symmetry term) // update residual (symmetry term)
// (non-)symmetric IP term // (non-)symmetric IP term
// symmetry term // symmetry term
for (unsigned int i = 0; i<lfsv_s.size(); i++) for (unsigned int i = 0; i<lfsv_s.size(); i++)
r_s.accumulate(lfsv_s,i, theta * (tgradphi_s[i] * normal) * relCond_upwind * satCond_s * jump * factor); r_s.accumulate(lfsv_s,i, theta * (tgradphi_s[i] * normal) * relCond * satCond_s * jump * factor);
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment