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 //
14 //---------------------------------------------------------------------------
15 
16 #ifndef _FUELCELLSHOP__REACTION_HEAT_H
17 #define _FUELCELLSHOP__REACTION_HEAT_H
18 
19 // FCST classes
21 #include <materials/PureLiquid.h>
22 #include <utils/fcst_constants.h>
23 
24 // Include deal.II classes
25 #include <deal.II/base/subscriptor.h>
26 
27 using namespace dealii;
28 
29 namespace FuelCellShop
30 {
31  namespace Equation
32  {
84  {
85  public:
87 
88 
91  ReactionHeat();
92 
96  ~ReactionHeat();
97 
100  {
101  kinetics = kin;
102  }
104 
106 
107 
112  {
113  Assert( phi.get_variablename() == protonic_electrical_potential, ExcMessage("Wrong solution variable passed in BaseKinetics::set_electrolyte_potential.") );
114  phi_m = phi;
115  }
120  {
121  Assert( phi.get_variablename() == electronic_electrical_potential, ExcMessage("Wrong solution variable passed in BaseKinetics::set_solid_potential.") );
122  phi_s = phi;
123  }
127  void set_temperature(const SolutionVariable& temperature)
128  {
129  Assert( temperature.get_variablename() == temperature_of_REV, ExcMessage("Wrong solution variable passed in BaseKinetics::set_temperature") );
130  T = temperature;
131  }
135  void set_derivative_flags(const std::vector<VariableNames>& flags)
136  {
137  derivative_flags = flags;
138  }
139 
149  void initialize_factors(const bool& flag_irrev_ORR = true,
150  const bool& flag_irrev_HOR = true,
151  const bool& flag_rev_heat = true,
152  const double& rev_heat_ORR_coef = 1.0,
153  const bool& flag_single_phase_ORR = true)
154  {
155  factor_irrev_ORR = flag_irrev_ORR ? -1.0 : 0.0;
156  factor_rev_ORR = flag_rev_heat ? ((-1.0*rev_heat_ORR_coef)/(2.0*Constants::F())) : 0.0;
157  factor_vap_ORR = flag_single_phase_ORR ? ((-1.0)/(2.0*Constants::F())) : 0.0;
158 
159  factor_irrev_HOR = flag_irrev_HOR ? 1.0 : 0.0;
160  factor_rev_HOR = flag_rev_heat ? ((rev_heat_ORR_coef-1.0)/(2.0*Constants::F())) : 0.0;
161 
162  factors_initialized = true;
163  }
165 
167 
168 
172  void heat_source (std::vector<double>& heat,
173  const std::vector<double>& current) const;
174 
181  void derivative_heat_source (std::map< VariableNames, std::vector<double> >& heat_derived,
182  const std::map< VariableNames, std::vector<double> >& current_derived,
183  const std::vector<double>& current) const;
185 
186  protected:
188 
189 
193  std::vector<VariableNames> derivative_flags;
194 
197 
204 
208  double entropy_rxn(const double& Temp) const
209  {
210  double deltaS = ((8.0*(1.0+log(Temp))) - 92.84) * 4.184; // J/mol-K
211  return deltaS;
212  }
213 
215  double deriv_entropy_rxn(const double& Temp) const
216  {
217  double dDs_dT = (4.184*8.0)/Temp;
218  return dDs_dT;
219  }
220 
223 
226 
229 
232 
235 
239  };
240  } //Thermal
241 } //FuelCellShop
242 #endif //_FUELCELLSHOP__REACTION_HEAT_H
double factor_vap_ORR
Factor for water vaporization heat sink in ORR.
Definition: reaction_heat.h:234
SolutionVariable phi_s
Struct stroing a pointer to the solution vector for the electronic/solid potential.
Definition: reaction_heat.h:201
double F()
Faraday constant, .
Definition: fcst_constants.h:37
VariableNames get_variablename() const
Function to get the VariableNames enumeration corresponding to this struct.
Definition: fcst_variables.h:170
bool factors_initialized
Flag to check whether factors are initialized or not.
Definition: reaction_heat.h:237
VariableNames
The enumeration containing the names of some of the available FCST solution variables and their deriv...
Definition: system_management.h:63
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:71
double factor_rev_ORR
Factor for reversible heating in ORR.
Definition: reaction_heat.h:228
void set_electrolyte_potential(const SolutionVariable &phi)
Set the electrolyte phase potential.
Definition: reaction_heat.h:111
Definition: system_management.h:76
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:193
void set_kinetics(FuelCellShop::Kinetics::BaseKinetics *kin)
Function to set Kinetics for enabling calculation source terms.
Definition: reaction_heat.h:99
void set_temperature(const SolutionVariable &temperature)
Set temperature.
Definition: reaction_heat.h:127
SolutionVariable T
Struct stroing a pointer to the solution vector for the temperature.
Definition: reaction_heat.h:203
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:102
double factor_irrev_HOR
Factor for irreversible heating in HOR.
Definition: reaction_heat.h:225
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:149
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:135
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:215
Definition: system_management.h:72
double factor_irrev_ORR
Factor for irreversible heating in ORR.
Definition: reaction_heat.h:222
FuelCellShop::Kinetics::BaseKinetics * kinetics
Store pointer to the kinetics object.
Definition: reaction_heat.h:196
SolutionVariable phi_m
Struct storing a pointer to the solution vector for the electrolyte potential.
Definition: reaction_heat.h:199
double factor_rev_HOR
Factor for reversible heating in HOR.
Definition: reaction_heat.h:231
void set_solid_potential(const SolutionVariable &phi)
Set the solid phase potential.
Definition: reaction_heat.h:119
This class is used to compute non-linear reaction heat source terms in a catalyst layer...
Definition: reaction_heat.h:83
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:208