OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reaction_heat.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2011-13 by Energy Systems Design Laboratory, University of Alberta
6 //
7 // This software is distributed under the MIT License.
8 // For more information, see the README file in /doc/LICENSE
9 //
10 // - Class: reaction_heat.h
11 // - Description: Header file for class computing heat source terms due to electrochemical reaction
12 // - Developers: Madhur Bhaiya
13 // - $Id: reaction_heat.h 2605 2014-08-15 03:36:44Z secanell $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELLSHOP__REACTION_HEAT_H
18 #define _FUELCELLSHOP__REACTION_HEAT_H
19 
20 // FCST classes
21 #include "base_kinetics.h"
22 #include "PureLiquid.h"
23 #include "fcst_constants.h"
24 
25 // Include deal.II classes
26 #include <base/parameter_handler.h>
27 #include <base/point.h>
28 #include <base/function.h>
29 #include <lac/vector.h>
30 #include <fe/fe_values.h>
31 #include <deal.II/base/subscriptor.h>
32 
33 //Include STL
34 #include <cmath>
35 #include <iostream>
36 #include <algorithm>
37 
38 using namespace dealii;
39 
40 namespace FuelCellShop
41 {
42  namespace Equation
43  {
95  {
96  public:
98 
99 
102  ReactionHeat();
103 
107  ~ReactionHeat();
108 
111  {
112  kinetics = kin;
113  }
115 
117 
118 
123  {
124  Assert( phi.get_variablename() == protonic_electrical_potential, ExcMessage("Wrong solution variable passed in BaseKinetics::set_electrolyte_potential.") );
125  phi_m = phi;
126  }
131  {
132  Assert( phi.get_variablename() == electronic_electrical_potential, ExcMessage("Wrong solution variable passed in BaseKinetics::set_solid_potential.") );
133  phi_s = phi;
134  }
138  void set_temperature(const SolutionVariable& temperature)
139  {
140  Assert( temperature.get_variablename() == temperature_of_REV, ExcMessage("Wrong solution variable passed in BaseKinetics::set_temperature") );
141  T = temperature;
142  }
146  void set_derivative_flags(const std::vector<VariableNames>& flags)
147  {
148  derivative_flags = flags;
149  }
150 
160  void initialize_factors(const bool& flag_irrev_ORR = true,
161  const bool& flag_irrev_HOR = true,
162  const bool& flag_rev_heat = true,
163  const double& rev_heat_ORR_coef = 1.0,
164  const bool& flag_single_phase_ORR = true)
165  {
166  factor_irrev_ORR = flag_irrev_ORR ? -1.0 : 0.0;
167  factor_rev_ORR = flag_rev_heat ? ((-1.0*rev_heat_ORR_coef)/(2.0*Constants::F())) : 0.0;
168  factor_vap_ORR = flag_single_phase_ORR ? ((-1.0)/(2.0*Constants::F())) : 0.0;
169 
170  factor_irrev_HOR = flag_irrev_HOR ? 1.0 : 0.0;
171  factor_rev_HOR = flag_rev_heat ? ((rev_heat_ORR_coef-1.0)/(2.0*Constants::F())) : 0.0;
172 
173  factors_initialized = true;
174  }
176 
178 
179 
183  void heat_source (std::vector<double>& heat,
184  const std::vector<double>& current) const;
185 
192  void derivative_heat_source (std::map< VariableNames, std::vector<double> >& heat_derived,
193  const std::map< VariableNames, std::vector<double> >& current_derived,
194  const std::vector<double>& current) const;
196 
197  protected:
199 
200 
204  std::vector<VariableNames> derivative_flags;
205 
208 
215 
219  double entropy_rxn(const double& Temp) const
220  {
221  double deltaS = ((8.0*(1.0+log(Temp))) - 92.84) * 4.184; // J/mol-K
222  return deltaS;
223  }
224 
226  double deriv_entropy_rxn(const double& Temp) const
227  {
228  double dDs_dT = (4.184*8.0)/Temp;
229  return dDs_dT;
230  }
231 
234 
237 
240 
243 
246 
250  };
251  } //Thermal
252 } //FuelCellShop
253 #endif //_FUELCELLSHOP__REACTION_HEAT_H
double factor_vap_ORR
Factor for water vaporization heat sink in ORR.
Definition: reaction_heat.h:245
SolutionVariable phi_s
Struct stroing a pointer to the solution vector for the electronic/solid potential.
Definition: reaction_heat.h:212
double F()
Faraday constant, .
Definition: fcst_constants.h:38
VariableNames get_variablename() const
Function to get the VariableNames enumeration corresponding to this struct.
Definition: fcst_variables.h:163
bool factors_initialized
Flag to check whether factors are initialized or not.
Definition: reaction_heat.h:248
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:62
This structure is used to encapsulate data from constant values and variable solution data that is us...
Definition: fcst_variables.h:86
Definition: system_management.h:70
double factor_rev_ORR
Factor for reversible heating in ORR.
Definition: reaction_heat.h:239
void set_electrolyte_potential(const SolutionVariable &phi)
Set the electrolyte phase potential.
Definition: reaction_heat.h:122
Definition: system_management.h:75
std::vector< VariableNames > derivative_flags
Flags for derivatives: These flags are used to request derivatives which are computed using the deriv...
Definition: reaction_heat.h:204
void set_kinetics(FuelCellShop::Kinetics::BaseKinetics *kin)
Function to set Kinetics for enabling calculation source terms.
Definition: reaction_heat.h:110
void set_temperature(const SolutionVariable &temperature)
Set temperature.
Definition: reaction_heat.h:138
SolutionVariable T
Struct stroing a pointer to the solution vector for the temperature.
Definition: reaction_heat.h:214
FCSTLogStream log
Object used to output data to file and, if file attached recorded to a file as well.
Virtual class used to provide the interface for all kinetic/reaction children.
Definition: base_kinetics.h:107
double factor_irrev_HOR
Factor for irreversible heating in HOR.
Definition: reaction_heat.h:236
void initialize_factors(const bool &flag_irrev_ORR=true, const bool &flag_irrev_HOR=true, const bool &flag_rev_heat=true, const double &rev_heat_ORR_coef=1.0, const bool &flag_single_phase_ORR=true)
Method to initialize the flags and factors corresponding to various source term components in the app...
Definition: reaction_heat.h:160
void set_derivative_flags(const std::vector< VariableNames > &flags)
Set the variables for which we would like to compute the derivatives.
Definition: reaction_heat.h:146
double deriv_entropy_rxn(const double &Temp) const
Function to compute derivative of entropy change of reaction with respect to temperature [K]...
Definition: reaction_heat.h:226
Definition: system_management.h:71
double factor_irrev_ORR
Factor for irreversible heating in ORR.
Definition: reaction_heat.h:233
FuelCellShop::Kinetics::BaseKinetics * kinetics
Store pointer to the kinetics object.
Definition: reaction_heat.h:207
SolutionVariable phi_m
Struct storing a pointer to the solution vector for the electrolyte potential.
Definition: reaction_heat.h:210
double factor_rev_HOR
Factor for reversible heating in HOR.
Definition: reaction_heat.h:242
void set_solid_potential(const SolutionVariable &phi)
Set the solid phase potential.
Definition: reaction_heat.h:130
This class is used to compute non-linear reaction heat source terms in a catalyst layer...
Definition: reaction_heat.h:94
double entropy_rxn(const double &Temp) const
Function to compute entropy change of reaction [J/(mol-K)] as a function of temperature [K]...
Definition: reaction_heat.h:219