Commit 9f0aa9f6 authored by Timo Koch's avatar Timo Koch
Browse files

[2pncni] Enable the non-isothermal 2pnc model

Add required properties and their defaults.
[fix] Parameter in the ni electrochemistry
[cleanup] Adjust class names to naming conventions

Reviewed by bernd



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15403 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 4cf11e2c
......@@ -31,6 +31,7 @@
#include <dumux/implicit/box/boxproperties.hh>
#include <dumux/implicit/cellcentered/ccproperties.hh>
#include <dumux/implicit/nonisothermal/niproperties.hh>
namespace Dumux
{
......@@ -46,6 +47,11 @@ NEW_TYPE_TAG(TwoPNC);
NEW_TYPE_TAG(BoxTwoPNC, INHERITS_FROM(BoxModel, TwoPNC));
NEW_TYPE_TAG(CCTwoPNC, INHERITS_FROM(CCModel, TwoPNC));
//! The type tag for the implicit non-isothermal two phase n component problems
NEW_TYPE_TAG(TwoPNCNI, INHERITS_FROM(TwoPNC, NonIsothermal));
NEW_TYPE_TAG(BoxTwoPNCNI, INHERITS_FROM(BoxModel, TwoPNCNI));
NEW_TYPE_TAG(CCTwoPNCNI, INHERITS_FROM(CCModel, TwoPNCNI));
//////////////////////////////////////////////////////////////////
// Property tags
//////////////////////////////////////////////////////////////////
......
......@@ -36,9 +36,10 @@
#include "2pncproperties.hh"
#include "2pncnewtoncontroller.hh"
#include <dumux/implicit/nonisothermal/nipropertydefaults.hh>
#include <dumux/implicit/common/implicitdarcyfluxvariables.hh>
#include <dumux/material/spatialparams/implicitspatialparams.hh>
#include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh>
namespace Dumux
{
......@@ -125,10 +126,8 @@ public:
typedef typename MaterialLaw::Params type;
};
//! Use the 2pnc local residual operator
SET_TYPE_PROP(TwoPNC,
LocalResidual,
TwoPNCLocalResidual<TypeTag>);
//! Use the 2pnc local residual
SET_TYPE_PROP(TwoPNC, LocalResidual, TwoPNCLocalResidual<TypeTag>);
//! Use the 2pnc newton controller
SET_TYPE_PROP(TwoPNC, NewtonController, TwoPNCNewtonController<TypeTag>);
......@@ -162,6 +161,50 @@ SET_BOOL_PROP(TwoPNC, ProblemEnableGravity, true);
//! Disable velocity output by default
SET_BOOL_PROP(TwoPNC, VtkAddVelocity, false);
//! Somerton is used as default model to compute the effective thermal heat conductivity
SET_PROP(NonIsothermal, ThermalConductivityModel)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
public:
typedef ThermalConductivitySomerton<Scalar, Indices> type;
};
//! temperature is already written by the isothermal model
SET_BOOL_PROP(TwoPNCNI, NiOutputLevel, 0);
//////////////////////////////////////////////////////////////////
// Property values for isothermal model required for the general non-isothermal model
//////////////////////////////////////////////////////////////////
// set isothermal Model
SET_TYPE_PROP(TwoPNCNI, IsothermalModel, TwoPNCModel<TypeTag>);
// set isothermal FluxVariables
SET_TYPE_PROP(TwoPNCNI, IsothermalFluxVariables, TwoPNCFluxVariables<TypeTag>);
//set isothermal VolumeVariables
SET_TYPE_PROP(TwoPNCNI, IsothermalVolumeVariables, TwoPNCVolumeVariables<TypeTag>);
//set isothermal LocalResidual
SET_TYPE_PROP(TwoPNCNI, IsothermalLocalResidual, TwoPNCLocalResidual<TypeTag>);
//set isothermal Indices
SET_TYPE_PROP(TwoPNCNI, IsothermalIndices, TwoPNCIndices<TypeTag, /*PVOffset=*/0>);
//set isothermal NumEq
SET_PROP(TwoPNCNI, IsothermalNumEq)
{
private:
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
public:
static const int value = FluidSystem::numComponents;
};
}
}
......
......@@ -97,8 +97,8 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables<TypeTag>
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename Grid::ctype CoordScalar;
typedef Dumux::miscible2pncComposition<Scalar, FluidSystem> miscible2pncComposition;
typedef Dumux::computeFromReferencePhase2pnc<Scalar, FluidSystem> computeFromReferencePhase2pnc;
typedef Dumux::Miscible2pNCComposition<Scalar, FluidSystem> Miscible2pNCComposition;
typedef Dumux::ComputeFromReferencePhase2pNC<Scalar, FluidSystem> ComputeFromReferencePhase2pNC;
enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
enum { dofCodim = isBox ? dim : 0 };
......@@ -258,13 +258,13 @@ public:
// constraint solver
// set the known mole fractions in the fluidState so that they
// can be used by the miscible2pncComposition constraint solver
// can be used by the Miscible2pNCComposition constraint solver
for (int compIdx=numMajorComponents; compIdx<numComponents; ++compIdx)
{
fluidState.setMoleFraction(wPhaseIdx, compIdx, primaryVariables[compIdx]);
}
miscible2pncComposition::solve(fluidState,
Miscible2pNCComposition::solve(fluidState,
paramCache,
wPhaseIdx, //known phaseIdx
/*setViscosity=*/true,
......@@ -296,8 +296,8 @@ public:
// calculate the composition of the remaining phases (as
// well as the densities of all phases). this is the job
// of the "computeFromReferencePhase2pnc" constraint solver
computeFromReferencePhase2pnc::solve(fluidState,
// of the "ComputeFromReferencePhase2pNC" constraint solver
ComputeFromReferencePhase2pNC::solve(fluidState,
paramCache,
nPhaseIdx,
/*setViscosity=*/true,
......@@ -332,8 +332,8 @@ public:
// calculate the composition of the remaining phases (as
// well as the densities of all phases). this is the job
// of the "computeFromReferencePhase2pnc" constraint solver
computeFromReferencePhase2pnc::solve(fluidState,
// of the "ComputeFromReferencePhase2pNC" constraint solver
ComputeFromReferencePhase2pNC::solve(fluidState,
paramCache,
wPhaseIdx,
/*setViscosity=*/true,
......
......@@ -101,8 +101,8 @@ class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables<TypeTag>
typedef typename GridView::template Codim<0>::Entity Element;
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
typedef typename Grid::ctype CoordScalar;
typedef Dumux::miscible2pncComposition<Scalar, FluidSystem> miscible2pncComposition;
typedef Dumux::computeFromReferencePhase2pncmin<Scalar, FluidSystem> computeFromReferencePhase2pncmin;
typedef Dumux::Miscible2pNCComposition<Scalar, FluidSystem> Miscible2pNCComposition;
typedef Dumux::ComputeFromReferencePhase2pNCMin<Scalar, FluidSystem> ComputeFromReferencePhase2pNCMin;
enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
enum { dofCodim = isBox ? dim : 0 };
......@@ -290,7 +290,7 @@ public:
fluidState.setMoleFraction(wPhaseIdx, compIdx, priVars[compIdx]);
}
miscible2pncComposition::solve(fluidState,
Miscible2pNCComposition::solve(fluidState,
paramCache,
wPhaseIdx, //known phaseIdx
/*setViscosity=*/true,
......@@ -339,7 +339,7 @@ public:
// calculate the composition of the remaining phases (as
// well as the densities of all phases). this is the job
// of the "ComputeFromReferencePhase2pNc" constraint solver
computeFromReferencePhase2pncmin::solve(fluidState,
ComputeFromReferencePhase2pNCMin::solve(fluidState,
paramCache,
nPhaseIdx,
nPhaseOnly,
......@@ -376,7 +376,7 @@ public:
// calculate the composition of the remaining phases (as
// well as the densities of all phases). this is the job
// of the "ComputeFromReferencePhase2pNc" constraint solver
computeFromReferencePhase2pncmin::solve(fluidState,
ComputeFromReferencePhase2pNCMin::solve(fluidState,
paramCache,
wPhaseIdx,
wPhaseOnly,
......
......@@ -65,23 +65,26 @@ class ElectroChemistry
enum {
//indices of the phases
wPhaseIdx = Indices::wPhaseIdx,
nPhaseIdx = Indices::nPhaseIdx,
nPhaseIdx = Indices::nPhaseIdx
};
enum {
//indices of the components
wCompIdx = FluidSystem::wCompIdx, //major component of the liquid phase
nCompIdx = FluidSystem::nCompIdx, //major component of the gas phase
O2Idx = wCompIdx + 2,
O2Idx = wCompIdx + 2
};
enum {
//indices of the primary variables
pressureIdx = Indices::pressureIdx, //gas-phase pressure
switchIdx = Indices::switchIdx, //liquid saturation or mole fraction
temperatureIdx = FluidSystem::numComponents, //temperature
temperatureIdx = FluidSystem::numComponents //temperature
};
enum {
//equation indices
conti0EqIdx = Indices::conti0EqIdx,
contiH2OEqIdx = conti0EqIdx + wCompIdx,
contiO2EqIdx = conti0EqIdx + wCompIdx + 2,
energyEqIdx = FluidSystem::numComponents, //energy equation
energyEqIdx = FluidSystem::numComponents //energy equation
};
public:
......
......@@ -50,13 +50,18 @@ class ElectroChemistryNI : public ElectroChemistry<TypeTag, electroChemistryMode
typedef Dumux::Constants<Scalar> Constant;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum {
//indices of the components
wCompIdx = FluidSystem::wCompIdx, //major component of the liquid phase
nCompIdx = FluidSystem::nCompIdx, //major component of the gas phase
O2Idx = wCompIdx + 2
};
enum { //equation indices
conti0EqIdx = Indices::conti0EqIdx,
contiH2OEqIdx = conti0EqIdx + wCompIdx,
contiO2EqIdx = conti0EqIdx + wCompIdx + 2,
energyEqIdx = FluidSystem::numComponents, //energy equation
};
};
public:
/*!
......@@ -76,12 +81,13 @@ public:
static Scalar gridYMax = GET_RUNTIME_PARAM(TypeTag, Scalar, Grid.UpperRightY);
static Scalar nCellsY = GET_RUNTIME_PARAM(TypeTag, Scalar, Grid.NumberOfCellsY);
static Scalar thermoneutralVoltage = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.ThermoneutralVoltage);
static Scalar cellVoltage = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.CellVoltage);
//initialise current density
Scalar currentDensity = 0.0;
//call internal method to calculate the current density
currentDensity = this->calculateCurrentDensity_(volVars, maxIter);
currentDensity = ParentType::calculateCurrentDensity_(volVars, maxIter);
//correction to account for actually relevant reaction area
//current density has to be devided by the half length of the box
......
......@@ -65,7 +65,7 @@ namespace Dumux {
* - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases
*/
template <class Scalar, class FluidSystem>
class computeFromReferencePhase2pnc
class ComputeFromReferencePhase2pNC
{
enum { numPhases = FluidSystem::numPhases };
enum { numComponents = FluidSystem::numComponents };
......
......@@ -65,7 +65,7 @@ namespace Dumux {
* - if the setEnthalpy parameter is true, also specific enthalpies and internal energies of *all* phases
*/
template <class Scalar, class FluidSystem>
class computeFromReferencePhase2pncmin
class ComputeFromReferencePhase2pNCMin
{
enum { numPhases = FluidSystem::numPhases };
enum { numComponents = FluidSystem::numComponents };
......
......@@ -57,7 +57,7 @@ namespace Dumux {
* - if the setInternalEnergy parameter is true, also specific enthalpies and internal energies of *all* phases
*/
template <class Scalar, class FluidSystem>
class miscible2pncComposition
class Miscible2pNCComposition
{
static const int numPhases = FluidSystem::numPhases;
static const int numComponents = FluidSystem::numComponents;
......
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