OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
app_pemfc_capillary_twophase_nonisothermal.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 //
3 // FCST: Fuel Cell Simulation Toolbox
4 //
5 // Copyright (C) 2013 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: app_pemfc_capillary_twophase_nonisothermal.h 21-05-2013
11 // - Description: Class designed to solve a two-phase, non-isothermal PEMFC model.
12 // - Developers: Jie Zhou
13 // - Id: $ $
14 //
15 //---------------------------------------------------------------------------
16 
17 #ifndef _FUELCELL__APP_PEMFC_CAPILLARY_TWOPHASE_NONISOTHERMAL__H
18 #define _FUELCELL__APP_PEMFC_CAPILLARY_TWOPHASE_NONISOTHERMAL__H
19 
20 
21 //-- OpenFCST
26 #include <layers/catalyst_layer.h>
27 #include <layers/membrane_layer.h>
28 #include <materials/PureGas.h>
29 #include <microscale/PSD_base.h>
30 
39 
47 
48 namespace FuelCell
49 {
50  namespace InitialSolution
51  {
57  template <int dim>
59  :
60  public Function<dim>
61  {
62  public:
67  boost::shared_ptr< FuelCellShop::Geometry::GridBase<dim> > grid,
68  FuelCell::SystemManagement* system_mgmt);
73 
78  void vector_value (const Point<dim> &p,
79  Vector<double> &v) const;
80 
81  private:
84 
86  boost::shared_ptr< FuelCellShop::Geometry::GridBase<dim> > grid;
87 
89  };
90  } //end namespace InitialSolution
91 
92 
93  namespace Application
94  {
95  template <int dim>
97  :
99  {
100  public:
101 
103 
104 
111  AppPemfcCapillaryTwoPhaseNIThermal (boost::shared_ptr<FuelCell::ApplicationCore::ApplicationData> data =
112  boost::shared_ptr<FuelCell::ApplicationCore::ApplicationData> ());
113 
124  virtual void declare_parameters(ParameterHandler& param);
125 
132  virtual void set_parameters(const std::vector<std::string>& name_dvar,
133  const std::vector<double>& value_dvar,
134  ParameterHandler& param) {};
135 
140  void _initialize(ParameterHandler& param);
141 
145  virtual void initialize(ParameterHandler& param);
146 
152  std::shared_ptr<Function<dim> > initial_function);
154 
156 
157 
163  virtual void cell_matrix(FuelCell::ApplicationCore::MatrixVector& cell_matrices,
164  const typename DoFApplication<dim>::CellInfo& cell);
174  virtual void cell_residual(FuelCell::ApplicationCore::FEVector& cell_vector,
175  const typename DoFApplication<dim>::CellInfo& cell);
176 
180  virtual void bdry_matrix(FuelCell::ApplicationCore::MatrixVector& bdry_matrices,
181  const typename DoFApplication<dim>::FaceInfo& bdry_info);
182 
186  virtual void bdry_residual(FuelCell::ApplicationCore::FEVector& bdry_vector,
187  const typename DoFApplication<dim>::FaceInfo& bdry_info);
189 
196  virtual void dirichlet_bc(std::map<unsigned int, double>& boundary_values) const;
197 
204  virtual void check_responses();
205 
209  virtual void cell_responses (std::vector<double>& resp,
210  const typename DoFApplication<dim>::CellInfo& info,
216  virtual void global_responses (std::vector<double>& resp,
218 
224  virtual void cell_dresponses_dl(std::vector<std::vector<double> >& /*cell_df_dl*/,
225  const typename DoFApplication<dim>::CellInfo& /*info*/,
226  const FuelCell::ApplicationCore::FEVector& /*sol*/) {};
227 
233  virtual void global_dresponses_dl(std::vector<std::vector<double> >& df_dl,
240  virtual void cell_dresponses_du(std::vector<FuelCell::ApplicationCore::FEVector >& /*cell_df_du*/,
241  const typename DoFApplication<dim>::CellInfo& /*info*/,
242  std::vector<std::vector<double> >& /*src*/) {};
243 
249  virtual void global_dresponses_du(std::vector<FuelCell::ApplicationCore::FEVector >& df_du,
251 
252 
257  virtual double evaluate (const FuelCell::ApplicationCore::FEVectors& src);
258 
263  virtual void data_out(const std::string& filename,
265 
267 
268 
272  virtual void bdry_responses(std::vector<double>& dst,
276 
277 
278  protected:
279 
281 
282 
283  boost::shared_ptr< FuelCellShop::Geometry::GridBase<dim> > grid;
284 
288 
290 
291 
296 
301 
306 
312 
314 
315  boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer<dim> > AGDL;
316  boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer<dim> > CGDL;
317  boost::shared_ptr< FuelCellShop::Layer::MicroPorousLayer<dim> > AMPL;
318  boost::shared_ptr< FuelCellShop::Layer::MicroPorousLayer<dim> > CMPL;
319  boost::shared_ptr< FuelCellShop::Layer::CatalystLayer<dim> > ACL;
320  boost::shared_ptr< FuelCellShop::Layer::CatalystLayer<dim> > CCL;
321  boost::shared_ptr< FuelCellShop::Layer::MembraneLayer<dim> > ML;
322 
323 
325 
326 
330 
335 
340 
345 
350 
355 
360 
362 
364 
367 
369  std::vector<std::string> design_var;
370 
372  std::vector<double> design_var_value;
373 
375 
377 
379 
381 
383 
385 
387 
389 
392 
393  private:
394 
395  double l_channel;
396 
397  double l_land;
398 
402  double time_k;
403  };
404  }
405 }
406 
407 #endif //_FUELCELL__AppPemfcTwoPhaseNIThermal_H
FuelCellShop::Equation::LambdaTransportEquation< dim > lambda_transport
LambdaTransportEquation object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:344
virtual void check_responses()
This class is called by responses to make sure that all responses requested are implemented in either...
virtual void initialize(ParameterHandler &param)
Call the other initialize routines from the inherited classes.
boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer< dim > > CGDL
Cathhode GDL Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:316
FuelCell::SystemManagement * system
Definition: app_pemfc_capillary_twophase_nonisothermal.h:88
FuelCellShop::PostProcessing::HORCurrentDensityResponse< dim > HORCurrent
Definition: app_pemfc_capillary_twophase_nonisothermal.h:378
virtual void global_dresponses_dl(std::vector< std::vector< double > > &df_dl, const FuelCell::ApplicationCore::FEVector &sol)
This class is used to evaluate the sensitivities of all responses that do not require looping over ce...
Class used to store, read from file and define the operating conditions for a fuel cell...
Definition: operating_conditions.h:118
FuelCellShop::Equation::SorptionSourceTerms< dim > sorption_source_terms
SorptionSourceTerms object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:359
FuelCellShop::Material::Oxygen oxygen
The cathode contains oxygen, so we need to create an object oxygen in order to compute viscosity...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:300
FuelCellShop::Material::Hydrogen hydrogen
The anode contains hydrogen, so we need to create an object hydrogen in order to compute viscosity...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:310
This class is used when solving the problem using Newton&#39;s method to provide an initial solution...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:58
virtual void cell_residual(FuelCell::ApplicationCore::FEVector &cell_vector, const typename DoFApplication< dim >::CellInfo &cell)
Integration of the rhs of the equations.
virtual void declare_parameters(ParameterHandler &param)
Declare all parameters that are needed for:
virtual void cell_dresponses_dl(std::vector< std::vector< double > > &, const typename DoFApplication< dim >::CellInfo &, const FuelCell::ApplicationCore::FEVector &)
This class is used to evaluate the derivative of all the functionals that require looping over cells ...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:224
FuelCellShop::PostProcessing::ORRCurrentDensityResponse< dim > ORRCurrent
Definition: app_pemfc_capillary_twophase_nonisothermal.h:376
This class assembles source terms corresponding to sorption/desorption of water inside the catalyst l...
Definition: sorption_source_terms.h:101
FuelCellShop::Equation::ThermalTransportEquation< dim > thermal_transport
ThermalTransportEquation object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:329
boost::shared_ptr< FuelCellShop::Layer::GasDiffusionLayer< dim > > AGDL
Anode GDL Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:315
virtual void bdry_matrix(FuelCell::ApplicationCore::MatrixVector &bdry_matrices, const typename DoFApplication< dim >::FaceInfo &bdry_info)
Assemble local boundary matrix.
void vector_value(const Point< dim > &p, Vector< double > &v) const
This is the member function that computes the value of the initial solution for a given point...
This class deals with Proton Transport Equation.
Definition: proton_transport_equation.h:132
Class used to calculate the current density at the anode catalyst layer.
Definition: response_current_density.h:180
boost::shared_ptr< FuelCellShop::Layer::CatalystLayer< dim > > CCL
Cathode Catalyst Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:320
virtual void cell_dresponses_du(std::vector< FuelCell::ApplicationCore::FEVector > &, const typename DoFApplication< dim >::CellInfo &, std::vector< std::vector< double > > &)
This class is used to evaluate the derivative of all the functionals that require looping over cells ...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:240
void initialize_solution(FuelCell::ApplicationCore::FEVector &initial_guess, std::shared_ptr< Function< dim > > initial_function)
Initialize nonlinear solution.
FuelCell::OperatingConditions OC
Operating conditions.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:286
virtual void bdry_responses(std::vector< double > &dst, const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &bdry_info, const FuelCell::ApplicationCore::FEVector &src)
Compute some functionals.
Class used to calculate the heat generated due to HOR inside the anode catalyst layer.
Definition: response_reaction_heat.h:284
virtual double evaluate(const FuelCell::ApplicationCore::FEVectors &src)
Post-processing.
FuelCellShop::PostProcessing::ORRReactionHeatResponse< dim > catReactionHeat
Definition: app_pemfc_capillary_twophase_nonisothermal.h:386
Class used to calculate the protonic ohmic heat generated in the proton conducting layers...
Definition: response_ohmic_heat.h:258
boost::shared_ptr< FuelCellShop::Layer::MicroPorousLayer< dim > > CMPL
Cathode MPL Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:318
virtual void data_out(const std::string &filename, const FuelCell::ApplicationCore::FEVectors &src)
Reimplementation of the routine in the base class BaseApplication in namespace AppFrame so that the r...
This class deals with Electron Transport Equation.
Definition: electron_transport_equation.h:128
This class deals with Thermal Transport Equation.
Definition: thermal_transport_equation.h:187
boost::shared_ptr< FuelCellShop::Layer::MicroPorousLayer< dim > > AMPL
Anode MPL Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:317
This class deals with Membrane Water Content Transport Equation.
Definition: lambda_transport_equation.h:128
FuelCellShop::Equation::ReactionSourceTerms< dim > reaction_source_terms
ReactionSourceTerms object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:354
FuelCellShop::Material::Nitrogen nitrogen
The cathode contains nitrogen as solvent, so we need to create an object nitrogen in order to compute...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:305
Definition: app_pemfc_capillary_twophase_nonisothermal.h:96
FuelCellShop::PostProcessing::HORReactionHeatResponse< dim > anReactionHeat
Definition: app_pemfc_capillary_twophase_nonisothermal.h:388
Class used to calculate the amount of water sorbed inside the catalyst layer.
Definition: response_water_sorption.h:106
virtual void cell_responses(std::vector< double > &resp, const typename DoFApplication< dim >::CellInfo &info, const FuelCell::ApplicationCore::FEVector &sol)
Compute the value of all objective function and constraints.
Definition: capillary_transport_equation.h:38
std::vector< std::string > design_var
Stores the design variable names so that the name can be appended to the .vtk file name...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:369
FuelCellShop::PostProcessing::ElectronOhmicHeatResponse< dim > electronOhmicHeat
Definition: app_pemfc_capillary_twophase_nonisothermal.h:382
This class is created for the objects handed to the mesh loops.
Definition: mesh_loop_info_objects.h:544
This class describes properties of pure oxygen.
Definition: PureGas.h:974
FuelCellShop::Equation::ProtonTransportEquation< dim > proton_transport
ProtonTransportEquation object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:339
AppPemfcCapillaryTwoPhaseNIThermalIC(FuelCell::OperatingConditions *OC, boost::shared_ptr< FuelCellShop::Geometry::GridBase< dim > > grid, FuelCell::SystemManagement *system_mgmt)
Constructor.
virtual void set_parameters(const std::vector< std::string > &name_dvar, const std::vector< double > &value_dvar, ParameterHandler &param)
Function called by optimization loop in order to set the values in the ParameterHandler to the new de...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:132
std::vector< MatrixBlock< FullMatrix< double > > > MatrixVector
The matrix vector used in the mesh loops.
Definition: matrix_block.h:102
This class describes properties of pure nitrogen.
Definition: PureGas.h:1027
FuelCellShop::Equation::ElectronTransportEquation< dim > electron_transport
ElectronTransportEquation object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:349
Class used to calculate the heat generated due to ORR inside the cathode catalyst layer...
Definition: response_reaction_heat.h:103
std::map< unsigned int, double > boundary_values
Variable to store boundary values, so they only need to be computed once per mesh refinement...
Definition: block_matrix_application.h:321
void _initialize(ParameterHandler &param)
Set up how many equations are needed and read in parameters for the parameter handler in order to ini...
boost::shared_ptr< FuelCellShop::Geometry::GridBase< dim > > grid
Geometry class object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:86
double l_land
Width of the landing.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:397
double l_channel
Width of the channel.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:395
virtual void global_responses(std::vector< double > &resp, const FuelCell::ApplicationCore::FEVector &sol)
This class is used to evaluate all responses that do not require looping over cells.
FuelCellShop::Equation::FicksTransportEquation< dim > ficks_oxygen_nitrogen
Definition: app_pemfc_capillary_twophase_nonisothermal.h:361
This class assembles the reaction source terms for all other transport equations, if there&#39;s any...
Definition: reaction_source_terms.h:37
virtual void dirichlet_bc(std::map< unsigned int, double > &boundary_values) const
Member function used to set dirichlet boundary conditions.
std::vector< double > design_var_value
Stores the values of the design variables so that the number can be appended to the ...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:372
boost::shared_ptr< FuelCellShop::Layer::MembraneLayer< dim > > ML
Membrane Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:321
virtual void cell_matrix(FuelCell::ApplicationCore::MatrixVector &cell_matrices, const typename DoFApplication< dim >::CellInfo &cell)
Integration of local bilinear form.
FuelCellShop::Material::WaterVapor water
The cathode/anode contains water vapour, so we need to create an object water in order to compute vis...
Definition: app_pemfc_capillary_twophase_nonisothermal.h:295
IMPORTANT: Add all new solution variables and equations here !
Definition: system_management.h:300
virtual void global_dresponses_du(std::vector< FuelCell::ApplicationCore::FEVector > &df_du, const FuelCell::ApplicationCore::FEVector &src)
This class is used to evaluate the sensitivities of all responses that do not require looping over ce...
FuelCellShop::Equation::CapillaryPressureEquation< dim > capillary_transport
CapillaryPressureEquation object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:334
FuelCell Geometry information class.
Definition: geometry.h:92
Class used to calculate the electronic ohmic heat generated in the electron conducting layers...
Definition: response_ohmic_heat.h:102
virtual void bdry_residual(FuelCell::ApplicationCore::FEVector &bdry_vector, const typename DoFApplication< dim >::FaceInfo &bdry_info)
Assemble local boundary residual.
Class used to calculate the heat generated due to sorption of water inside the catalyst layer...
Definition: response_sorption_heat.h:102
boost::shared_ptr< FuelCellShop::Layer::CatalystLayer< dim > > ACL
Anode Catalyst Layer.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:319
AppPemfcCapillaryTwoPhaseNIThermal(boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData > data=boost::shared_ptr< FuelCell::ApplicationCore::ApplicationData >())
Constructor.
FuelCellShop::Equation::FicksTransportEquation< dim > ficks_water_nitrogen
Definition: app_pemfc_capillary_twophase_nonisothermal.h:363
FuelCell::OperatingConditions * OC
Operating conditions class object.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:83
BlockVector< double > FEVector
The vector class used by applications.
Definition: application_data.h:46
The data type used in function calls of Application.
Definition: fe_vectors.h:59
Application handling matrices and assembling the linear system to solve the sensitivity equations...
Definition: optimization_block_matrix_application.h:49
This class deals with Fick&#39;s Transport Equation.
Definition: ficks_transport_equation.h:132
FuelCellShop::PostProcessing::ProtonOhmicHeatResponse< dim > protonOhmicHeat
Definition: app_pemfc_capillary_twophase_nonisothermal.h:380
This class describes properties of pure hydrogen.
Definition: PureGas.h:1081
FuelCellShop::Equation::FicksTransportEquation< dim > ficks_water_hydrogen
Definition: app_pemfc_capillary_twophase_nonisothermal.h:365
boost::shared_ptr< ApplicationData > data
Object for auxiliary data.
Definition: application_base.h:348
FuelCellShop::PostProcessing::WaterSorptionResponse< dim > waterSorption
Definition: app_pemfc_capillary_twophase_nonisothermal.h:390
boost::shared_ptr< FuelCellShop::Geometry::GridBase< dim > > grid
Create an object to generate the mesh.
Definition: app_pemfc_capillary_twophase_nonisothermal.h:283
Class used to calculate the ORR current density and coverages (if provided in the kinetic model) by t...
Definition: response_current_density.h:59
double time_k
Time constant for sorption isotherm [1/s].
Definition: app_pemfc_capillary_twophase_nonisothermal.h:402
This class describes properties of pure WaterVapor.
Definition: PureGas.h:1134
FuelCellShop::PostProcessing::SorptionHeatResponse< dim > sorptionHeat
Definition: app_pemfc_capillary_twophase_nonisothermal.h:384