3.1-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
electrochemistryni.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*****************************************************************************
4 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_ELECTROCHEMISTRY_NI_HH
25#define DUMUX_ELECTROCHEMISTRY_NI_HH
26
29
30namespace Dumux {
31
40template <class Scalar, class Indices, class FluidSystem, class GridGeometry, ElectroChemistryModel electroChemistryModel>
41class ElectroChemistryNI : public ElectroChemistry<Scalar, Indices, FluidSystem, GridGeometry, electroChemistryModel>
42{
45
46 enum {
47 //equation indices
48 contiH2OEqIdx = Indices::conti0EqIdx + FluidSystem::H2OIdx,
49 contiO2EqIdx = Indices::conti0EqIdx + FluidSystem::O2Idx,
50 energyEqIdx = Indices::energyEqIdx, //energy equation
51 };
52
53 using GridView = typename GridGeometry::GridView;
54 static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethod::box;
55 using GlobalPosition = typename Dune::FieldVector<typename GridView::ctype, GridView::dimensionworld>;
56 using CellVector = typename Dune::FieldVector<typename GridView::ctype, GridView::dimension>;
57
58public:
68 template<class SourceValues>
69 static void reactionSource(SourceValues &values, Scalar currentDensity,
70 const std::string& paramGroup = "")
71 {
72 //correction to account for actually relevant reaction area
73 //current density has to be devided by the half length of the box
74 //\todo Do we have multiply with the electrochemically active surface area (ECSA) here instead?
75 static Scalar gridYMax = getParamFromGroup<GlobalPosition>(paramGroup, "Grid.UpperRight")[1];
76 static Scalar nCellsY = getParamFromGroup<GlobalPosition>(paramGroup, "Grid.Cells")[1];
77
78 // Warning: This assumes the reaction layer is always just one cell (cell-centered) or half a box (box) thick
79 const auto lengthBox = gridYMax/nCellsY;
80 if (isBox)
81 currentDensity *= 2.0/lengthBox;
82 else
83 currentDensity *= 1.0/lengthBox;
84
85 static Scalar transportNumberH2O = getParam<Scalar>("ElectroChemistry.TransportNumberH20");
86 static Scalar thermoneutralVoltage = getParam<Scalar>("ElectroChemistry.ThermoneutralVoltage");
87 static Scalar cellVoltage = getParam<Scalar>("ElectroChemistry.CellVoltage");
88
89 //calculation of flux terms with faraday equation
90 values[contiH2OEqIdx] = currentDensity/(2*Constant::F); //reaction term in reaction layer
91 values[contiH2OEqIdx] += currentDensity/Constant::F*transportNumberH2O; //osmotic term in membrane
92 values[contiO2EqIdx] = -currentDensity/(4*Constant::F); //O2-equation
93 values[energyEqIdx] = (thermoneutralVoltage - cellVoltage)*currentDensity; //energy equation
94 }
95};
96
97} // end namespace Dumux
98
99#endif
Electrochemical model for a fuel cell application.
A central place for various physical constants occuring in some equations.
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
This class calculates source terms and current densities for fuel cells with the electrochemical mode...
Definition: electrochemistry.hh:53
Class calculating source terms and current densities for fuel cells with the electrochemical models s...
Definition: electrochemistryni.hh:42
static void reactionSource(SourceValues &values, Scalar currentDensity, const std::string &paramGroup="")
Calculates reaction sources with an electrochemical model approach.
Definition: electrochemistryni.hh:69
A central place for various physical constants occuring in some equations.
Definition: constants.hh:39
static constexpr Scalar F
Faraday constant .
Definition: constants.hh:66