OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FuelCell::ParametricStudy< dim > Class Template Reference

This application is used to perform a parametric study for a given fuel cell model. More...

#include <parametric_study.h>

Inheritance diagram for FuelCell::ParametricStudy< dim >:
Inheritance graph
[legend]

Public Member Functions

 ParametricStudy ()
 Constructor. More...
 
 ~ParametricStudy ()
 
void declare_parameters (ParameterHandler &) const
 
void initialize (ParameterHandler &)
 Read parameters from file. More...
 
void run (ParameterHandler &param, std::string simulator_parameter_file_name, boost::shared_ptr< SimulationSelector< dim > > sim_selector)
 Run a full polarization curve run. More...
 

Protected Member Functions

virtual void set_parameters (ParameterHandler &param, const shared_ptr< FuelCell::ApplicationCore::AdaptiveRefinement< dim > > &solver, const int iteration, const std::string parameter_name, double param_value)
 Modify cell voltage and any other parameters that you would like to modify with respect to the inital input file. More...
 
void run_point (ParameterHandler &param, const std::string simulator_parameter_file_name, const boost::shared_ptr< SimulationSelector< dim > > sim_selector, const int iteration, const std::string parameter_name, const double param_value, std::map< std::string, double > &functionals)
 Run a single point in the polarization curve and return the current density and any other data. More...
 
void print_iteration_info (const unsigned int iteration, const double param_value) const
 
virtual void print_parameters () const
 Print parameters: More...
 
virtual void print_parameteric_study (const std::vector< std::vector< double > > &curve) const
 Print parameteric study results into a file. More...
 
void register_data (const double, std::map< std::string, double > &functionals)
 Store the value of the current density in the solution. More...
 

Protected Attributes

std::string parameter_filename
 Variable where the output file to store parameteric study results is stored. More...
 
std::string parameter_name
 String that defines the parameter that we would like to modify The parameter should be of the from. More...
 
double p_init
 Initial value to run the parametric study, in the units specified for the value. More...
 
double p_end
 Final parameter value used in the parameteric study. More...
 
double dp
 Spacing between points in the parameteric study. More...
 
std::vector< double > p_values
 Another way to define the sequence of parameter values is to use the vector p_values instead of variables p_init, p_end, and dp. More...
 
bool adaptive
 Set to true if you would like to reduce the voltage increment adaptively if convergence could not be achieved with the larger value. More...
 
double min_dp
 
int n_dpPts
 
bool convergence
 Convergence of the solution. More...
 
std::vector< std::vector
< double > > 
curve
 Map used to store the parametric study data. More...
 
FuelCell::ApplicationCore::FEVector coarse_solution
 Vector used to store the solution from the previous iteration if convergence has been achieved. More...
 

Detailed Description

template<int dim>
class FuelCell::ParametricStudy< dim >

This application is used to perform a parametric study for a given fuel cell model.

This class reads the linear and a nonlinear applications to be used from the parameter file and uses them in order to obtain a parameteric study for the given application.

Note that this is an implementation of the more general ParametricStudy class.

Usage

This class is used in SimulationBuilder to run a complete parameteric study. All parameters for this application should be defined in the main parameter file under the following section:

* subsection Simulator
* subsection Parametric study
* set Parameter Name = subsection>>subsection>>name
* set Initial Value = 0.5 #Enter the value you would like to start the parameteric study from.
* set Final Value = #Enter the final value for the parameteric study.
* set Increment = 0.1 #Spacing between points in the parameteric study
* set Adaptive Increment? = false #Set to true if you would like to reduce the voltage increment adaptively if convergence could not be achieved with the larger value
* set Min. Increment [V] = 0.1 #If Adaptive Increment? is set to true, this value controls the
* # minimum change in cell voltage before the parameter study gives up
* # and the voltage is updated again. Note that this value has to be more
* #than 0.01 V as a value of zero would lead to an infinite loop.
* end
* end
*

To use the class, imply create an object, declare the parameters, read the file, initialize and run

* ParameterHandler param;
* curve.declare_parameters(param);
* std::string simulator_parameter_file_name = "input_file.prm";
* param.read_input(simulator_parameter_file_name,
* true);
* curve.initialize(param);
* curve.run(param, simulator_parameter_file_name, sim_selector);
*
Author
M. Secanell, 2014

Constructor & Destructor Documentation

template<int dim>
FuelCell::ParametricStudy< dim >::ParametricStudy ( )

Constructor.

template<int dim>
FuelCell::ParametricStudy< dim >::~ParametricStudy ( )

Member Function Documentation

template<int dim>
void FuelCell::ParametricStudy< dim >::declare_parameters ( ParameterHandler &  ) const
template<int dim>
void FuelCell::ParametricStudy< dim >::initialize ( ParameterHandler &  )

Read parameters from file.

template<int dim>
void FuelCell::ParametricStudy< dim >::print_iteration_info ( const unsigned int  iteration,
const double  param_value 
) const
inlineprotected

References FcstUtilities::log.

template<int dim>
virtual void FuelCell::ParametricStudy< dim >::print_parameteric_study ( const std::vector< std::vector< double > > &  curve) const
protectedvirtual

Print parameteric study results into a file.

Reimplemented in FuelCell::PolarizationCurve< dim >.

template<int dim>
virtual void FuelCell::ParametricStudy< dim >::print_parameters ( ) const
protectedvirtual

Print parameters:

Reimplemented in FuelCell::PolarizationCurve< dim >.

template<int dim>
void FuelCell::ParametricStudy< dim >::register_data ( const double  ,
std::map< std::string, double > &  functionals 
)
protected

Store the value of the current density in the solution.

template<int dim>
void FuelCell::ParametricStudy< dim >::run ( ParameterHandler &  param,
std::string  simulator_parameter_file_name,
boost::shared_ptr< SimulationSelector< dim > >  sim_selector 
)

Run a full polarization curve run.

template<int dim>
void FuelCell::ParametricStudy< dim >::run_point ( ParameterHandler &  param,
const std::string  simulator_parameter_file_name,
const boost::shared_ptr< SimulationSelector< dim > >  sim_selector,
const int  iteration,
const std::string  parameter_name,
const double  param_value,
std::map< std::string, double > &  functionals 
)
protected

Run a single point in the polarization curve and return the current density and any other data.

template<int dim>
virtual void FuelCell::ParametricStudy< dim >::set_parameters ( ParameterHandler &  param,
const shared_ptr< FuelCell::ApplicationCore::AdaptiveRefinement< dim > > &  solver,
const int  iteration,
const std::string  parameter_name,
double  param_value 
)
protectedvirtual

Modify cell voltage and any other parameters that you would like to modify with respect to the inital input file.

Reimplemented in FuelCell::PolarizationCurve< dim >.

Member Data Documentation

template<int dim>
bool FuelCell::ParametricStudy< dim >::adaptive
protected

Set to true if you would like to reduce the voltage increment adaptively if convergence could not be achieved with the larger value.

Note
This vaule is set via input file using the following section
* subsection Simulator
* subsection Parametric study
* set Adaptive Increment? = true (or false)
* end
* end
*
template<int dim>
FuelCell::ApplicationCore::FEVector FuelCell::ParametricStudy< dim >::coarse_solution
protected

Vector used to store the solution from the previous iteration if convergence has been achieved.

template<int dim>
bool FuelCell::ParametricStudy< dim >::convergence
protected

Convergence of the solution.

True if the adaptive loop was able to provide a solution.

template<int dim>
std::vector<std::vector<double> > FuelCell::ParametricStudy< dim >::curve
protected

Map used to store the parametric study data.

template<int dim>
double FuelCell::ParametricStudy< dim >::dp
protected

Spacing between points in the parameteric study.

Note
This vaule is set via input file using the following section
* subsection Simulator
* subsection Parameteric study
* set Increment
* end
* end
*
template<int dim>
double FuelCell::ParametricStudy< dim >::min_dp
protected
Note
This vaule is set via input file using the following section
* subsection Simulator
* subsection Parametric study
* set Min. Increment
* end
* end
*
template<int dim>
int FuelCell::ParametricStudy< dim >::n_dpPts
protected
template<int dim>
double FuelCell::ParametricStudy< dim >::p_end
protected

Final parameter value used in the parameteric study.

Note
This vaule is set via input file using the following section
* subsection Simulator
* subsection Parametric study
* set Final Value
* end
* end
*
template<int dim>
double FuelCell::ParametricStudy< dim >::p_init
protected

Initial value to run the parametric study, in the units specified for the value.

Note
This vaule is set via input file using the following section
* subsection Simulator
* subsection Parametric study
* set Initial Value =
* end
* end
*
template<int dim>
std::vector<double> FuelCell::ParametricStudy< dim >::p_values
protected

Another way to define the sequence of parameter values is to use the vector p_values instead of variables p_init, p_end, and dp.

This vector contains the discrete values of a parameter of study.

Note
This vector is set via input file using the following section
* subsection Simulator
* subsection Parameteric study
* set Parameter values = v1, v2, v3, ..., vN
* end
* end
*
template<int dim>
std::string FuelCell::ParametricStudy< dim >::parameter_filename
protected

Variable where the output file to store parameteric study results is stored.

template<int dim>
std::string FuelCell::ParametricStudy< dim >::parameter_name
protected

String that defines the parameter that we would like to modify The parameter should be of the from.

  • For normal parameter: Subsection_1>>Subsection_2>>Value
  • For boundary value or graded: Subsection_1>>Subsection_2>>Material_id:Value

The documentation for this class was generated from the following file: