Skip to content
Snippets Groups Projects
Commit c719d074 authored by Sina Ackermann's avatar Sina Ackermann Committed by Kilian Weishaupt
Browse files

[staggeredGrid] Revise Fourier's law

* correct distance computation for gradient
parent 4b201a7f
No related branches found
No related tags found
Loading
...@@ -51,6 +51,7 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::Staggered > ...@@ -51,6 +51,7 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::Staggered >
{ {
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
...@@ -64,7 +65,9 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::Staggered > ...@@ -64,7 +65,9 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::Staggered >
static const int dimWorld = GridView::dimensionworld; static const int dimWorld = GridView::dimensionworld;
enum { enum {
energyBalanceIdx = Indices::energyBalanceIdx massBalanceIdx = Indices::massBalanceIdx,
energyBalanceIdx = Indices::energyBalanceIdx,
phaseIdx = Indices::phaseIdx
}; };
public: public:
...@@ -98,35 +101,28 @@ public: ...@@ -98,35 +101,28 @@ public:
outsideLambda *= outsideVolVars.extrusionFactor(); outsideLambda *= outsideVolVars.extrusionFactor();
// the resulting averaged conductivity tensor // the resulting averaged conductivity tensor
// const auto lambda = problem.spatialParams().harmonicMean(insideLambda, outsideLambda, scvf.unitOuterNormal()); const auto lambda = harmonicMean(insideLambda, outsideLambda);
const auto lambda = harmonicMean(insideLambda, outsideLambda); // TODO unitOuterNormal?!
const Scalar insideTemp = insideVolVars.temperature(); const Scalar insideTemp = insideVolVars.temperature();
Scalar distance(0.0), outsideTemp(insideTemp); const Scalar outsideTemp = scvf.boundary() ? problem.dirichletAtPos(scvf.center())[energyBalanceIdx]
: outsideVolVars.temperature();
const Scalar distance = scvf.boundary() ? (insideScv.dofPosition() - scvf.ipGlobal()).two_norm()
: (outsideScv.dofPosition() - scvf.ipGlobal()).two_norm();
if(scvf.boundary()) if(scvf.boundary())
{ {
const auto bcTypes = problem.boundaryTypesAtPos(scvf.center()); const auto bcTypes = problem.boundaryTypesAtPos(scvf.center());
if(bcTypes.isOutflow(energyBalanceIdx)) if(bcTypes.isOutflow(energyBalanceIdx) || bcTypes.isNeumann(energyBalanceIdx))
return flux; // TODO flux = 0?? return flux;
else if(bcTypes.isNeumann(energyBalanceIdx))
return flux; // TODO: implement neumann
else
{
distance = (insideScv.dofPosition() - scvf.ipGlobal()).two_norm();
outsideTemp = problem.dirichletAtPos(scvf.center())[energyBalanceIdx];
}
}
else
{
distance = (insideScv.dofPosition() - outsideScv.dofPosition()).two_norm();
outsideTemp = outsideVolVars.temperature();
} }
flux[energyBalanceIdx] = -1.0 * (insideTemp - outsideTemp); flux[energyBalanceIdx] = -1.0 * (insideTemp - outsideTemp);
flux[energyBalanceIdx] *= lambda / distance; flux[energyBalanceIdx] *= lambda / distance;
flux *= scvf.area() * sign(scvf.outerNormalScalar());
return flux; return flux;
} }
}; };
} // end namespace } // end namespace
......
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