Skip to content
Snippets Groups Projects
Commit 62326e57 authored by Markus Wolff's avatar Markus Wolff
Browse files

fixed bug in adaptive 2p model after change of initialization order


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8885 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 03d95e3c
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,29 @@ public: ...@@ -106,6 +106,29 @@ public:
// Function which calculates the flux entry // Function which calculates the flux entry
void getFlux(EntryType&, const Intersection&, const CellData&, const bool); void getFlux(EntryType&, const Intersection&, const CellData&, const bool);
//!Initialize
void initialize()
{
ParentType::initialize();
if (!compressibility_)
{
ElementIterator element = problem_.gridView().template begin<0>();
FluidState fluidState;
fluidState.setPressure(wPhaseIdx, problem_.referencePressure(*element));
fluidState.setPressure(nPhaseIdx, problem_.referencePressure(*element));
fluidState.setTemperature(problem_.temperature(*element));
fluidState.setSaturation(wPhaseIdx, 1.);
fluidState.setSaturation(nPhaseIdx, 0.);
density_[wPhaseIdx] = FluidSystem::density(fluidState, wPhaseIdx);
density_[nPhaseIdx] = FluidSystem::density(fluidState, nPhaseIdx);
viscosity_[wPhaseIdx] = FluidSystem::viscosity(fluidState, wPhaseIdx);
viscosity_[nPhaseIdx] = FluidSystem::viscosity(fluidState, nPhaseIdx);
}
velocity_.initialize();
}
/*! \brief Pressure update /*! \brief Pressure update
* *
* \copydetails FVPressure2P::update() * \copydetails FVPressure2P::update()
...@@ -166,20 +189,10 @@ public: ...@@ -166,20 +189,10 @@ public:
DUNE_THROW(Dune::NotImplemented, "Saturation type not supported!"); DUNE_THROW(Dune::NotImplemented, "Saturation type not supported!");
} }
if (!compressibility_) density_[wPhaseIdx] = 0.;
{ density_[nPhaseIdx] = 0.;
ElementIterator element = problem_.gridView().template begin<0>(); viscosity_[wPhaseIdx] = 0.;
FluidState fluidState; viscosity_[nPhaseIdx] = 0.;
fluidState.setPressure(wPhaseIdx, problem_.referencePressure(*element));
fluidState.setPressure(nPhaseIdx, problem_.referencePressure(*element));
fluidState.setTemperature(problem_.temperature(*element));
fluidState.setSaturation(wPhaseIdx, 1.);
fluidState.setSaturation(nPhaseIdx, 0.);
density_[wPhaseIdx] = FluidSystem::density(fluidState, wPhaseIdx);
density_[nPhaseIdx] = FluidSystem::density(fluidState, nPhaseIdx);
viscosity_[wPhaseIdx] = FluidSystem::viscosity(fluidState, wPhaseIdx);
viscosity_[nPhaseIdx] = FluidSystem::viscosity(fluidState, nPhaseIdx);
}
} }
private: private:
......
...@@ -116,6 +116,17 @@ public: ...@@ -116,6 +116,17 @@ public:
DUNE_THROW(Dune::NotImplemented, "Velocity type not supported!"); DUNE_THROW(Dune::NotImplemented, "Velocity type not supported!");
} }
density_[wPhaseIdx] = 0.;
density_[nPhaseIdx] = 0.;
viscosity_[wPhaseIdx] = 0.;
viscosity_[nPhaseIdx] = 0.;
}
//!For initialization
void initialize()
{
ParentType::initialize();
if (!compressibility_) if (!compressibility_)
{ {
ElementIterator element = problem_.gridView().template begin<0> (); ElementIterator element = problem_.gridView().template begin<0> ();
...@@ -197,6 +208,9 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters ...@@ -197,6 +208,9 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters
//get face index //get face index
int isIndexI = intersection.indexInInside(); int isIndexI = intersection.indexInInside();
Scalar faceArea = intersection.geometry().volume();
Scalar faceAreaSum = faceArea;
//get face normal //get face normal
const Dune::FieldVector<Scalar, dim>& unitOuterNormal = intersection.centerUnitOuterNormal(); const Dune::FieldVector<Scalar, dim>& unitOuterNormal = intersection.centerUnitOuterNormal();
...@@ -225,6 +239,8 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters ...@@ -225,6 +239,8 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters
{ {
globalIdxK = problem_.variables().index(*neighborPointer2); globalIdxK = problem_.variables().index(*neighborPointer2);
elementK = neighborPointer2; elementK = neighborPointer2;
faceAreaSum += isItI->geometry().volume();
break; break;
} }
} }
...@@ -440,8 +456,8 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters ...@@ -440,8 +456,8 @@ void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& inters
cellDataJ.fluxData().setVelocityMarker(isIndexJ); cellDataJ.fluxData().setVelocityMarker(isIndexJ);
//times 0.5 because cell face with hanging node is called twice! Do not set marker because it should be called twice! //times 0.5 because cell face with hanging node is called twice! Do not set marker because it should be called twice!
velocityW *= 0.5; velocityW *= faceArea/faceAreaSum;
velocityNW *= 0.5; velocityNW *= faceArea/faceAreaSum;
cellData.fluxData().addVelocity(wPhaseIdx, isIndexI, velocityW); cellData.fluxData().addVelocity(wPhaseIdx, isIndexI, velocityW);
cellData.fluxData().addVelocity(nPhaseIdx, isIndexI, velocityNW); cellData.fluxData().addVelocity(nPhaseIdx, isIndexI, velocityNW);
} }
......
...@@ -69,6 +69,7 @@ template<class TypeTag, class Velocity> class FVVelocity ...@@ -69,6 +69,7 @@ template<class TypeTag, class Velocity> class FVVelocity
public: public:
//!Initialize velocity implementation
void initialize() void initialize()
{ {
velocity_.initialize(); velocity_.initialize();
......
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