Commit 3aa12e45 authored by Timo Koch's avatar Timo Koch
Browse files

[localresidual] Fix how boundary types are obtained. Don't pass them to computeFlux

parent 0273ac12
......@@ -87,7 +87,7 @@ protected:
const auto& insideScv = fvGeometry.scv(scvf.insideScvIdx());
const auto& outsideScv = fvGeometry.scv(scvf.outsideScvIdx());
auto flux = this->asImp_().computeFlux(element, fvGeometry, elemVolVars, scvf, bcTypes[insideScv.index()], elemFluxVarsCache[scvf]);
auto flux = this->asImp_().computeFlux(element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache[scvf]);
this->residual_[insideScv.index()] += flux;
this->residual_[outsideScv.index()] -= flux;
......@@ -119,10 +119,8 @@ protected:
for (auto&& scv : scvs(fvGeometry))
{
auto scvBcTypes = bcTypes[scv.index()];
if (!scvBcTypes.hasDirichlet())
continue;
this->asImp_().evalDirichlet_(element, fvGeometry, elemVolVars, scv, scvBcTypes);
if (scvBcTypes.hasDirichlet())
this->asImp_().evalDirichlet_(element, fvGeometry, elemVolVars, scv, scvBcTypes);
}
}
}
......
......@@ -89,7 +89,7 @@ protected:
const FluxVariablesCache& fluxVarsCache)
{
if (!scvf.boundary() /*TODO: || GET_PROP_VALUE(TypeTag, BoundaryReconstruction)*/)
return this->asImp_().computeFlux(element, fvGeometry, elemVolVars, scvf, bcTypes[0], fluxVarsCache);
return this->asImp_().computeFlux(element, fvGeometry, elemVolVars, scvf, fluxVarsCache);
else
return PrimaryVariables(0.0);
......@@ -98,17 +98,20 @@ protected:
void evalBoundary_(const Element &element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const ElementBoundaryTypes& bcTypes,
const ElementBoundaryTypes& elemBcTypes,
const ElementFluxVariablesCache& elemFluxVarsCache)
{
for (auto&& scvf : scvfs(fvGeometry))
{
if (scvf.boundary())
this->residual_[0] += evalBoundaryFluxes_(element, fvGeometry, elemVolVars, scvf, bcTypes[0], elemFluxVarsCache[scvf]);
{
auto bcTypes = this->problem().boundaryTypes(element, scvf);
this->residual_[0] += evalBoundaryFluxes_(element, fvGeometry, elemVolVars, scvf, bcTypes, elemFluxVarsCache[scvf]);
}
}
// additionally treat mixed D/N conditions in a strong sense
if (bcTypes.hasDirichlet())
if (elemBcTypes.hasDirichlet())
{
for (auto&& scvf : scvfs(fvGeometry))
{
......@@ -201,7 +204,7 @@ protected:
// temporary vector to store the Dirichlet boundary fluxes
PrimaryVariables flux(0);
auto dirichletFlux = this->asImp_().computeFlux(element, fvGeometry, elemVolVars, scvf, bcTypes, fluxVarsCache);
auto dirichletFlux = this->asImp_().computeFlux(element, fvGeometry, elemVolVars, scvf, fluxVarsCache);
// add fluxes to the residual
for (int eqIdx = 0; eqIdx < numEq; ++eqIdx)
......
......@@ -40,19 +40,21 @@ namespace Dumux
template<class TypeTag>
class ThreePThreeCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
{
typedef typename GET_PROP_TYPE(TypeTag, BaseLocalResidual) ParentType;
typedef typename GET_PROP_TYPE(TypeTag, LocalResidual) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, SubControlVolume) SubControlVolume;
typedef typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace) SubControlVolumeFace;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, FluxVariables) FluxVariables;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
using ParentType = typename GET_PROP_TYPE(TypeTag, BaseLocalResidual);
using Implementation = typename GET_PROP_TYPE(TypeTag, LocalResidual);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables);
using FluxVariablesCache = typename GET_PROP_TYPE(TypeTag, FluxVariablesCache);
using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables);
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
enum {
numPhases = GET_PROP_VALUE(TypeTag, NumPhases),
......@@ -71,8 +73,6 @@ class ThreePThreeCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual
gCompIdx = Indices::gCompIdx
};
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
public:
ThreePThreeCLocalResidual() : ParentType()
......@@ -122,11 +122,17 @@ public:
*/
PrimaryVariables computeFlux(const Element& element,
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf,
const BoundaryTypes& bcTypes)
const FluxVariablesCache& fluxVarsCache)
{
FluxVariables fluxVars;
fluxVars.initAndComputeFluxes(this->problem(), element, fvGeometry, scvf);
fluxVars.initAndComputeFluxes(this->problem(),
element,
fvGeometry,
elemVolVars,
scvf,
fluxVarsCache);
// get upwind weights into local scope
auto massWeight = massWeight_;
......
......@@ -47,7 +47,6 @@ class ImmiscibleLocalResidual : public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Element = typename GridView::template Codim<0>::Entity;
......@@ -105,7 +104,6 @@ public:
const FVElementGeometry& fvGeometry,
const ElementVolumeVariables& elemVolVars,
const SubControlVolumeFace& scvf,
const BoundaryTypes& bcTypes,
const FluxVariablesCache& fluxVarsCache) const
{
FluxVariables fluxVars;
......
Supports Markdown
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