Commit 516283d1 authored by Timo Koch's avatar Timo Koch
Browse files

[2pnc] Major cleanup

* Remove trailing whitespace and tabs
* Move electrochemistry output to the test problem (not related to 2pnc in general)
* Make electrochemistry have static members
* Use naming conventions for indices in the model
* Try to make the model work with cellcentered too (No cell-centered test available so far)
* Make electrochemistry input parameters part of a group "ElectroChemistry"
* Make the electrochemistry model a named enum (ElectroChemistryModel)for readability

Reviewed by martins 



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@15298 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 59275f89
This diff is collapsed.
......@@ -59,7 +59,6 @@ NEW_PROP_TAG(SpatialParams); //!< The type of the spatial parameters
NEW_PROP_TAG(FluidSystem); //!< Type of the multi-component relations
NEW_PROP_TAG(Indices); //!< Enumerations for the model
NEW_PROP_TAG(Chemistry); //!< The chemistry class with which solves equlibrium reactions
NEW_PROP_TAG(useElectrochem); //!< Determines if Output for Electrochemistry is needed
NEW_PROP_TAG(MaterialLaw); //!< The material law which ought to be used (extracted from the spatial parameters)
NEW_PROP_TAG(MaterialLawParams); //!< The parameters of the material law (extracted from the spatial parameters)
......
......@@ -162,10 +162,6 @@ SET_BOOL_PROP(TwoPNC, ProblemEnableGravity, true);
//! Disable velocity output by default
SET_BOOL_PROP(TwoPNC, VtkAddVelocity, false);
//! disable electro-chemistry by default
SET_BOOL_PROP(TwoPNC, useElectrochem, false);
}
}
......
......@@ -62,7 +62,7 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables<TypeTag>
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw;
typedef typename GET_PROP_TYPE(TypeTag, MaterialLawParams) MaterialLawParams;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum
enum
{
dim = GridView::dimension,
dimWorld=GridView::dimensionworld,
......@@ -103,7 +103,7 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables<TypeTag>
enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
enum { dofCodim = isBox ? dim : 0 };
public:
//! The type of the object returned by the fluidState() method
typedef CompositionalFluidState<Scalar, FluidSystem> FluidState;
/*!
......@@ -122,14 +122,14 @@ public:
fvGeometry,
scvIdx,
isOldSol);
completeFluidState(primaryVariables, problem, element, fvGeometry, scvIdx, fluidState_, isOldSol);
/////////////
// calculate the remaining quantities
/////////////
const MaterialLawParams &materialParams = problem.spatialParams().materialLawParams(element, fvGeometry, scvIdx);
// Second instance of a parameter cache.
// Could be avoided if diffusion coefficients also
// became part of the fluid state.
......@@ -161,13 +161,13 @@ public:
}
}
// porosity
// porosity
porosity_ = problem.spatialParams().porosity(element,
fvGeometry,
scvIdx);
Valgrind::CheckDefined(porosity_);
// energy related quantities not contained in the fluid state
asImp_().updateEnergy_(primaryVariables, problem,element, fvGeometry, scvIdx, isOldSol);
}
......@@ -187,12 +187,12 @@ public:
Scalar t = Implementation::temperature_(primaryVariables, problem, element,
fvGeometry, scvIdx);
fluidState.setTemperature(t);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = problem.model().dofMapper().subIndex(element, scvIdx, dofCodim);
#else
int dofIdxGlobal = problem.model().dofMapper().map(element, scvIdx, dofCodim);
#endif
#endif
int phasePresence = problem.model().phasePresence(dofIdxGlobal, isOldSol);
/////////////
......@@ -211,7 +211,7 @@ public:
else if (formulation == pgSl)
Sg = 1.0 - primaryVariables[switchIdx];
else DUNE_THROW(Dune::InvalidStateException, "Formulation: " << formulation << " is invalid.");
}
}
else DUNE_THROW(Dune::InvalidStateException, "phasePresence: " << phasePresence << " is invalid.");
fluidState.setSaturation(nPhaseIdx, Sg);
fluidState.setSaturation(wPhaseIdx, 1.0 - Sg);
......@@ -309,7 +309,7 @@ public:
// composition is stored explicitly.
// extract _mass_ fractions in the gas phase
Dune::FieldVector<Scalar, numComponents> moleFrac;
for (int compIdx=numMajorComponents; compIdx<numComponents; ++compIdx)
{
moleFrac[compIdx] = primaryVariables[compIdx];
......@@ -329,7 +329,7 @@ public:
{
fluidState.setMoleFraction(wPhaseIdx, compIdx, moleFrac[compIdx]);
}
// calculate the composition of the remaining phases (as
// well as the densities of all phases). this is the job
// of the "computeFromReferencePhase2pnc" constraint solver
......@@ -349,7 +349,7 @@ public:
fluidState.setViscosity(phaseIdx, mu);
}
}
/*!
* \brief Returns the phase state for the control-volume.
*/
......@@ -375,7 +375,7 @@ public:
{
if (phaseIdx < numPhases)
return fluidState_.density(phaseIdx);
else
DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
}
......@@ -402,8 +402,8 @@ public:
* \param phaseIdx The phase index
*/
Scalar pressure(int phaseIdx) const
{
return fluidState_.pressure(phaseIdx);
{
return fluidState_.pressure(phaseIdx);
}
/*!
......@@ -448,7 +448,7 @@ public:
{ return diffCoeff_[phaseIdx][compIdx]; }
protected:
static Scalar temperature_(const PrimaryVariables &priVars,
const Problem& problem,
const Element &element,
......@@ -457,7 +457,7 @@ protected:
{
return problem.temperatureAtPos(fvGeometry.subContVol[scvIdx].global);
}
template<class ParameterCache>
static Scalar enthalpy_(const FluidState& fluidState,
const ParameterCache& paramCache,
......@@ -491,8 +491,8 @@ private:
{ return *static_cast<Implementation*>(this); }
const Implementation &asImp_() const
{ return *static_cast<const Implementation*>(this); }
{ return *static_cast<const Implementation*>(this); }
};
} // end namespace
......
......@@ -64,7 +64,7 @@ namespace Dumux
\f}
*
* All equations are discretized using a vertex-centered finite volume (box)
* or cell-centered finite volume scheme (this is not done for 2pnc approach yet, however possible) as
* or cell-centered finite volume scheme (this is not done for 2pnc approach yet, however possible) as
* spatial and the implicit Euler method as time discretization.
*
* By using constitutive relations for the capillary pressure \f$p_c =
......@@ -141,8 +141,7 @@ class TwoPNCMinModel: public TwoPNCModel<TypeTag>
plSg = TwoPNCFormulation::plSg,
pgSl = TwoPNCFormulation::pgSl,
formulation = GET_PROP_VALUE(TypeTag, Formulation),
useElectrochem = GET_PROP_VALUE(TypeTag, useElectrochem)
formulation = GET_PROP_VALUE(TypeTag, Formulation)
};
typedef typename GridView::template Codim<dim>::Entity Vertex;
......@@ -156,7 +155,7 @@ class TwoPNCMinModel: public TwoPNCModel<TypeTag>
typedef Dune::FieldVector<Scalar, numPhases> PhasesVector;
enum { isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox) };
enum { dofCodim = isBox ? dim : 0 };
enum { dofCodim = isBox ? dim : 0 };
public:
......@@ -180,29 +179,26 @@ public:
unsigned numDofs = this->numDofs();
// create the required scalar fields
ScalarField *Sg = writer.allocateManagedBuffer (numDofs);
ScalarField *Sl = writer.allocateManagedBuffer (numDofs);
ScalarField *pg = writer.allocateManagedBuffer (numDofs);
ScalarField *pl = writer.allocateManagedBuffer (numDofs);
ScalarField *pc = writer.allocateManagedBuffer (numDofs);
ScalarField *rhoL = writer.allocateManagedBuffer (numDofs);
ScalarField *rhoG = writer.allocateManagedBuffer (numDofs);
ScalarField *mobL = writer.allocateManagedBuffer (numDofs);
ScalarField *mobG = writer.allocateManagedBuffer (numDofs);
ScalarField *Sg = writer.allocateManagedBuffer (numDofs);
ScalarField *Sl = writer.allocateManagedBuffer (numDofs);
ScalarField *pg = writer.allocateManagedBuffer (numDofs);
ScalarField *pl = writer.allocateManagedBuffer (numDofs);
ScalarField *pc = writer.allocateManagedBuffer (numDofs);
ScalarField *rhoL = writer.allocateManagedBuffer (numDofs);
ScalarField *rhoG = writer.allocateManagedBuffer (numDofs);
ScalarField *mobL = writer.allocateManagedBuffer (numDofs);
ScalarField *mobG = writer.allocateManagedBuffer (numDofs);
ScalarField *phasePresence = writer.allocateManagedBuffer (numDofs);
ScalarField *temperature = writer.allocateManagedBuffer (numDofs);
ScalarField *poro = writer.allocateManagedBuffer (numDofs);
ScalarField *boxVolume = writer.allocateManagedBuffer (numDofs);
// ScalarField *potential = writer.allocateManagedBuffer (numDofs);
ScalarField *cellNum = writer.allocateManagedBuffer (numDofs);
ScalarField *cellNum = writer.allocateManagedBuffer (numDofs);
ScalarField *permeabilityFactor = writer.allocateManagedBuffer (numDofs);
ScalarField *precipitateVolumeFraction[numSPhases] ;
// ScalarField *saturationIdx[numSPhases];
for (int i = 0; i < numSPhases; ++i)
for (int i = 0; i < numSPhases; ++i)
{
precipitateVolumeFraction[i]= writer.allocateManagedBuffer (numDofs);
precipitateVolumeFraction[i]= writer.allocateManagedBuffer (numDofs);
}
ScalarField *massFraction[numPhases][numComponents];
......@@ -225,15 +221,15 @@ public:
ImplicitVelocityOutput<TypeTag> velocityOutput(this->problem_());
if (velocityOutput.enableOutput()) // check if velocity output is demanded
{
// initialize velocity fields
for (unsigned int i = 0; i < numDofs; ++i)
{
(*velocityN)[i] = Scalar(0);
(*velocityW)[i] = Scalar(0);
(*cellNum)[i] = Scalar(0.0);
}
}
{
// initialize velocity fields
for (unsigned int i = 0; i < numDofs; ++i)
{
(*velocityN)[i] = Scalar(0);
(*velocityW)[i] = Scalar(0);
(*cellNum)[i] = Scalar(0.0);
}
}
unsigned numElements = this->gridView_().size(0);
ScalarField *rank =
......@@ -250,7 +246,7 @@ public:
int idx = this->problem_().elementMapper().map(*elemIt);
(*rank)[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
elemVolVars.update(this->problem_(),
*elemIt,
fvGeometry,
......@@ -260,7 +256,7 @@ public:
int numVerts = elemIt->subEntities(dim);
#else
int numVerts = elemIt->template count<dim> ();
#endif
#endif
for (int i = 0; i < numVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*elemIt, i, dim);
......@@ -271,36 +267,25 @@ public:
i,
false);
(*Sg)[globalIdx] = volVars.saturation(nPhaseIdx);
(*Sl)[globalIdx] = volVars.saturation(wPhaseIdx);
(*pg)[globalIdx] = volVars.pressure(nPhaseIdx);
(*pl)[globalIdx] = volVars.pressure(wPhaseIdx);
(*pc)[globalIdx] = volVars.capillaryPressure();
(*rhoL)[globalIdx] = volVars.fluidState().density(wPhaseIdx);
(*rhoG)[globalIdx] = volVars.fluidState().density(nPhaseIdx);
(*mobL)[globalIdx] = volVars.mobility(wPhaseIdx);
(*mobG)[globalIdx] = volVars.mobility(nPhaseIdx);
(*boxVolume)[globalIdx] += fvGeometry.subContVol[i].volume;
(*poro)[globalIdx] = volVars.porosity();
(*Sg)[globalIdx] = volVars.saturation(nPhaseIdx);
(*Sl)[globalIdx] = volVars.saturation(wPhaseIdx);
(*pg)[globalIdx] = volVars.pressure(nPhaseIdx);
(*pl)[globalIdx] = volVars.pressure(wPhaseIdx);
(*pc)[globalIdx] = volVars.capillaryPressure();
(*rhoL)[globalIdx] = volVars.fluidState().density(wPhaseIdx);
(*rhoG)[globalIdx] = volVars.fluidState().density(nPhaseIdx);
(*mobL)[globalIdx] = volVars.mobility(wPhaseIdx);
(*mobG)[globalIdx] = volVars.mobility(nPhaseIdx);
(*boxVolume)[globalIdx] += fvGeometry.subContVol[i].volume;
(*poro)[globalIdx] = volVars.porosity();
for (int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx)
{
(*precipitateVolumeFraction[sPhaseIdx])[globalIdx] = volVars.precipitateVolumeFraction(sPhaseIdx + numPhases);
}
(*temperature)[globalIdx] = volVars.temperature();
(*permeabilityFactor)[globalIdx] = volVars.permeabilityFactor();
(*temperature)[globalIdx] = volVars.temperature();
(*permeabilityFactor)[globalIdx] = volVars.permeabilityFactor();
(*phasePresence)[globalIdx] = this->staticDat_[globalIdx].phasePresence;
// (*potential)[globalIdx] = (volVars.pressure(wPhaseIdx)-1e5)
// /volVars.fluidState().density(wPhaseIdx)
// /9.81
// - (zmax - globalPos[dim-1]);
//
//
// for (int sPhaseIdx = 0; sPhaseIdx < numSPhases; ++sPhaseIdx)
// {
// (*saturationIdx[sPhaseIdx])[globalIdx] = volVars.saturationIdx(sPhaseIdx + numPhases);
// }
for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
for (int compIdx = 0; compIdx < numComponents; ++compIdx)
......@@ -339,10 +324,9 @@ public:
writer.attachVertexData(*permeabilityFactor, "permeabilityFactor");
writer.attachVertexData(*temperature, "temperature");
writer.attachVertexData(*phasePresence, "phase presence");
// writer.attachVertexData(*potential, "potential");
writer.attachVertexData(*boxVolume, "boxVolume");
for (int i = 0; i < numSPhases; ++i)
{
std::ostringstream oss;
......@@ -351,14 +335,6 @@ public:
writer.attachDofData(*precipitateVolumeFraction[i], oss.str().c_str(), isBox);
}
// for (int i = 0; i < numSPhases; ++i)
// {
// std::ostringstream oss;
// oss << "saturationIndex_"
// << FluidSystem::phaseName(numPhases + i);
// writer.attachDofData(*saturationIdx[i], oss.str().c_str(), isBox);
// }
writer.attachVertexData(*Perm[0], "Kxx");
if (dim >= 2)
writer.attachVertexData(*Perm[1], "Kyy");
......@@ -447,9 +423,9 @@ public:
wasSwitched = this->gridView_().comm().max(wasSwitched);
setSwitched_(wasSwitched);
}
}
protected:
/*!
* \brief Set whether there was a primary variable switch after in
* the last timestep.
......@@ -458,7 +434,7 @@ protected:
{
switchFlag_ = yesno;
}
/*!
* \copydoc 2pnc::primaryVarSwitch_
*/
......@@ -513,7 +489,7 @@ protected:
{
Scalar sumxl = 0;
//Calculate sum of mole fractions (water and air) in the hypothetical liquid phase
//WARNING: Here numComponents is replaced by numMajorComponents as the solutes
//WARNING: Here numComponents is replaced by numMajorComponents as the solutes
//are only present in the liquid phase and cannot condense as the liquid (water).
for (int compIdx = 0; compIdx < numComponents; compIdx++)
{
......
......@@ -26,151 +26,83 @@
#ifndef ELECTRO_CHEMNI_HH
#define ELECTRO_CHEMNI_HH
#include <dumux/common/exceptions.hh>
#include <dumux/material/constants.hh>
#include <dumux/material/components/component.hh>
#include <dumux/material/fluidsystems/h2on2o2fluidsystem.hh>
#include <dumux/material/chemistry/electrochemistry/electrochemistry.hh>
#include <cmath>
#include <iostream>
namespace Dumux
{
/*!
* \brief
* Class calculating source terms and current densities for fuel cells
* with the electrochemical models suggested by Ochs [2008] or Acosta [2006]
* for the non-isothermal case
*/
template <class TypeTag, Dumux::ElectroChemistryModel electroChemistryModel>
class ElectroChemistryNI : public ElectroChemistry<TypeTag, electroChemistryModel>
{
typedef ElectroChemistry<TypeTag, electroChemistryModel> ParentType;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) VolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
typedef Dumux::Constants<Scalar> Constant;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { //equation indices
conti0EqIdx = Indices::conti0EqIdx,
contiH2OEqIdx = conti0EqIdx + wCompIdx,
contiO2EqIdx = conti0EqIdx + wCompIdx + 2,
energyEqIdx = FluidSystem::numComponents, //energy equation
};
public:
/*!
* \brief
* Class calculating source terms and current densities for fuel cells
* with the electrochemical models suggested by Ochs [2008] or Acosta [2006]
* \brief Calculates reaction sources with an electrochemical model approach.
*
* \param values The primary variable vector
* \param volVars The volume variables
*
* For this method, the \a values parameter stores source values
*/
template <class TypeTag, const int electroChemApproach>
class ElectroChemestryNI:friend ElectroChemestry<TypeTag,electroChemApproach>
static void reactionSource(PrimaryVariables &values,
const VolumeVariables &volVars)
{
protected:
typedef ElectroChemestry<TypeTag,electroChemApproach> ParentType;
typedef ElectroChemestryNI<TypeTag,electroChemApproach> ThisType;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(VolumeVariables)) VolumeVariables;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables)) PrimaryVariables;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
typedef typename GridView::template Codim<0>::Entity Element;
typedef typename GET_PROP_TYPE(TypeTag, PTAG(FVElementGeometry)) FVElementGeometry;
typedef Dumux::Constants<Scalar> Constant;
typedef ElectroChemestryNI<TypeTag> ThisType;
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { //indices of the phases
wPhaseIdx = Indices::wPhaseIdx,
nPhaseIdx = Indices::nPhaseIdx,
//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,
//indices of the primary variables
pressureIdx = Indices::pressureIdx, //gas-phase pressure
switchIdx = Indices::switchIdx, //liquid saturation or mole fraction
temperatureIdx = FluidSystem::numComponents, //temperature
//equation indices
conti0EqIdx = Indices::conti0EqIdx,
contiH2OEqIdx = conti0EqIdx + wCompIdx,
contiO2EqIdx = conti0EqIdx + wCompIdx + 2,
energyEqIdx = FluidSystem::numComponents, //energy equation
};
public:
ElectroChemestryNI()
{
gridYMin_ = 0.0;
gridYMax_ = GET_RUNTIME_PARAM(TypeTag, Scalar, Grid.UpperRightY);
nCellsY_ = GET_RUNTIME_PARAM(TypeTag, Scalar, Grid.NumberOfCellsY);
maxIter_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.MaxIterations);
cellVoltage_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.CellVoltage);
thermoneutralVoltage_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.ThermoneutralVoltage);
reversibleVoltage_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.ReversibleVoltage);
specificResistance_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.SpecificResistance);
transferCoefficient_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.TransferCoefficient);
numElectrons_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.NumElectrons);
refO2PartialPressure_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.RefO2PartialPressure);
transportNumberH2O_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.TransportNumberH20);
pO2Inlet_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.pO2Inlet);
refCurrentDensity_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.RefCurrentDensity);
refTemperature_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.RefTemperature);
activationBarrier_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.ActivationBarrier);
surfaceIncreasingFactor_ = GET_RUNTIME_PARAM(TypeTag, Scalar, FuelCell.SurfaceIncreasingFactor);
eps_ = 1e-6;
}
/*!
* \brief Calculates reaction sources with an electrochemical model approach.
*
* \param q The primary variable vector
* \param volVars The volume variables
*
* For this method, the \a q parameter stores primary
* variables.
*/
void reactionSource(PrimaryVariables &q,
const VolumeVariables &volVars)
{
//initialise current density
Scalar currentDensity = 0.0;
//call internal method to calculate the current density
currentDensity = calculateCurrentDensity_(volVars, maxIter_);
//correction to account for actually relevant reaction area
//current density has to be devided by the half length of the box
//see diploma thesis Lena Walter
Scalar lengthBox= (gridYMax_ - gridYMin_)/nCellsY_;
if(electroChemApproach==2)
currentDensity = currentDensity/lengthBox; //ACOSTA
else
currentDensity = currentDensity*2/lengthBox;
//conversion from [A/cm^2] to [A/m^2]
currentDensity = currentDensity*10000;
//calculation of flux terms with faraday equation
q[contiH2OEqIdx] = currentDensity/(2*Constant::F); //reaction term in reaction layer
q[contiH2OEqIdx] += currentDensity/Constant::F*transportNumberH2O_; //osmotic term in membrane
q[contiO2EqIdx] = -currentDensity/(4*Constant::F); //O2-equation
q[energyEqIdx] = (thermoneutralVoltage_ - cellVoltage_)*currentDensity; //energy equation
}
private:
Scalar eps_;
Scalar gridYMin_;
Scalar gridYMax_;
Scalar nCellsY_;
Scalar maxIter_;
Scalar cellVoltage_;
Scalar thermoneutralVoltage_;
Scalar reversibleVoltage_;
Scalar specificResistance_;
Scalar transferCoefficient_;
Scalar numElectrons_;
Scalar refO2PartialPressure_;
Scalar transportNumberH2O_;
Scalar pO2Inlet_;
Scalar refCurrentDensity_;
Scalar refTemperature_;
Scalar activationBarrier_;
Scalar surfaceIncreasingFactor_;
};
static Scalar transportNumberH2O = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.TransportNumberH20);
static Scalar maxIter = GET_RUNTIME_PARAM(TypeTag, Scalar, ElectroChemistry.MaxIterations);
static Scalar gridYMin = 0.0;
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);
//initialise current density
Scalar currentDensity = 0.0;
//call internal method to calculate the current density
currentDensity = this->calculateCurrentDensity_(volVars, maxIter);
//correction to account for actually relevant reaction area
//current density has to be devided by the half length of the box
Scalar lengthBox = (gridYMax - gridYMin)/nCellsY;
if(electroChemistryModel == ElectroChemistryModel::Acosta)
currentDensity = currentDensity/lengthBox;
else
currentDensity = currentDensity*2/lengthBox;