OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
FuelCellShop::PostProcessing::MassFluxResponse< dim > Class Template Reference

Class used to calculate the total mass flux at a boundary. More...

#include <response_mass_flux.h>

Inheritance diagram for FuelCellShop::PostProcessing::MassFluxResponse< dim >:
Inheritance graph
[legend]
Collaboration diagram for FuelCellShop::PostProcessing::MassFluxResponse< dim >:
Collaboration graph
[legend]

Public Member Functions

Constructor, declaration and initialization
 MassFluxResponse (const FuelCell::SystemManagement &sm)
 
 ~MassFluxResponse ()
 
Compute functional
void compute_responses (const typename DoFApplication< dim >::CellInfo &info, FuelCellShop::Layer::BaseLayer< dim > *const layer, std::map< FuelCellShop::PostProcessing::ResponsesNames, double > &respMap) const
 This member function computes the mass flux in a cell. More...
 
void compute_responses (std::vector< FuelCellShop::SolutionVariable > solution_variables, const typename DoFApplication< dim >::CellInfo &info, FuelCellShop::Layer::BaseLayer< dim > *const layer, std::map< FuelCellShop::PostProcessing::ResponsesNames, double > &respMap) const
 Routine used in order to compute the response with a modified solution (not the one stored in CellInfo object.) More...
 
void bdry_responses (std::vector< double > &dst, const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &bdry_info, std::vector< std::string > &responseNames, std::vector< unsigned int > &bdryIDs) const
 This member function computes the total mass flux along specified boundaries. More...
 

Private Attributes

Compute parameters
unsigned int numOutputVars
 private variable for storing the number of species to calculate the mass flux for. More...
 
std::vector< unsigned int > bdryIDs
 private variable for storing a vector of the boundary ids to calculate mass flux along. More...
 
std::vector< std::string > nameOutputVars
 private variable for storing the names of species to calculate the mass flux for. More...
 

Additional Inherited Members

- Protected Member Functions inherited from FuelCellShop::PostProcessing::BaseResponse< dim >
 BaseResponse (const FuelCell::SystemManagement &sm)
 Constructor. More...
 
virtual ~BaseResponse ()
 Destructor. More...
 
virtual void declare_parameters (ParameterHandler &param) const
 Declare any necessary parameters to compute the functional. More...
 
virtual void initialize (ParameterHandler &param)
 Initialize class parameters. More...
 
- Protected Attributes inherited from FuelCellShop::PostProcessing::BaseResponse< dim >
const FuelCell::SystemManagementsystem_management
 Pointer to system management. More...
 

Detailed Description

template<int dim>
class FuelCellShop::PostProcessing::MassFluxResponse< dim >

Class used to calculate the total mass flux at a boundary.

This class returns the total mass flux at specified boundary IDs, i.e.

\[ \oint_{\Gamma} \rho_i \boldsymbol{\hat{u}}_i \cdot \boldsymbol{n} \, \mathrm{d}\Gamma \]

User can then divide the obtained total quantity by the length (2D simulation) or surface area (3D simulation) in order to determine average mass flux.

Note: be careful if combining multiple boundary ids into one. For example if you have two outlets that have the same BCs and you call them by the same boundary ID then calculating the average mass flux gets a bit more tricky, as you need to normalize the integral over each outlet. If the outlets are the same dimensions then just divide by the length of one of the outlets (NOT the combined length of the outlets).

Remarks
  • This class will not work if density and velocity are not being solved for.
  • At this moment only implemented for bdry_responses() in application class

Usage

In the input data file, the following parameters can be specified (see declare_parameters ):

* subsection Output Variables
* set Compute boundary responses = true
* set num_output_vars = 3
* set Output boundary id = 1, 2
* set Output_var_0 = total_mass_flux_species_1
* set Output_var_2 = total_mass_flux_species_2
* set Output_var_3 = total_mass_flux_species_3
* end
*
Note
: you can specify up to 5 different total_mass_flux_species. If you require more add more to application_core/optimization_block_matrix_application.cc at the end of the file

Implementation in Applications

In order to use this classes, first add it to your application as an object.

In the class constructor, construct the class passing SystemManagement. This object is used in order to find the solution variables as appropriate, and flag parameters.

//---------------------------------------------------------------------------
template<int dim>
NAME::AppCompressibleFlows<dim>::AppCompressibleFlows( boost::shared_ptr<ApplicationData> data )
:
OptimizationBlockMatrixApplication<dim>(data),
fluid_transport_equations(this->system_management, data),
mass_flux_response(this->system_management),
fluid("fluid"),
CChannel("channel", fluid)
{ }

Note that unlike some response classes, this class does not require declare parameters, as information is declared by the OptimizationBlockMatrixApplication class. initialize() is used so the parameters do not need to be passed to MassFluxResponse.

Next, the object has to be initialized once SystemManagement and ThermalTransportEquation objects have already been initialized:

template<int dim>
void
NAME::AppCompressibleFlows<dim>::initialize(ParameterHandler& param)
{
// Initialize post-processing routines:
mass_flux_response.initialize(param);
}

Finally, the object is ready for use in bdry_responses in your application:

template<int dim>
void
NAME::AppCompressibleFlows<dim>::bdry_responses(std::vector<double>& dst,
{
mass_flux_response.bdry_responses(dst, bdry_info);
}
Author
Chad Balen, 2016

Constructor & Destructor Documentation

Member Function Documentation

template<int dim>
void FuelCellShop::PostProcessing::MassFluxResponse< dim >::bdry_responses ( std::vector< double > &  dst,
const typename FuelCell::ApplicationCore::DoFApplication< dim >::FaceInfo &  bdry_info,
std::vector< std::string > &  responseNames,
std::vector< unsigned int > &  bdryIDs 
) const

This member function computes the total mass flux along specified boundaries.

Call this function in the application class in the bdry_responses() function:

template<int dim>
void
NAME::AppCompressibleFlows<dim>::bdry_responses(std::vector<double>& dst,
{
mass_flux_response.bdry_responses(dst, bdry_info);
}
template<int dim>
void FuelCellShop::PostProcessing::MassFluxResponse< dim >::compute_responses ( const typename DoFApplication< dim >::CellInfo &  info,
FuelCellShop::Layer::BaseLayer< dim > *const  layer,
std::map< FuelCellShop::PostProcessing::ResponsesNames, double > &  respMap 
) const
virtual

This member function computes the mass flux in a cell.

Note
Currently NOT IMPLEMENTED.

Implements FuelCellShop::PostProcessing::BaseResponse< dim >.

template<int dim>
void FuelCellShop::PostProcessing::MassFluxResponse< dim >::compute_responses ( std::vector< FuelCellShop::SolutionVariable solution_variables,
const typename DoFApplication< dim >::CellInfo &  info,
FuelCellShop::Layer::BaseLayer< dim > *const  layer,
std::map< FuelCellShop::PostProcessing::ResponsesNames, double > &  respMap 
) const
virtual

Routine used in order to compute the response with a modified solution (not the one stored in CellInfo object.)

Note
Currently NOT IMPLEMENTED.

Implements FuelCellShop::PostProcessing::BaseResponse< dim >.

Member Data Documentation

template<int dim>
std::vector<unsigned int> FuelCellShop::PostProcessing::MassFluxResponse< dim >::bdryIDs
private

private variable for storing a vector of the boundary ids to calculate mass flux along.

Set in initalize();

template<int dim>
std::vector<std::string> FuelCellShop::PostProcessing::MassFluxResponse< dim >::nameOutputVars
private

private variable for storing the names of species to calculate the mass flux for.

This is important in case the user has three species but only wants the mass flux for two of them. As well, this way the user can specify what order they want the output in. Format for strings should be: "total_mass_flux_species_" + integer.

template<int dim>
unsigned int FuelCellShop::PostProcessing::MassFluxResponse< dim >::numOutputVars
private

private variable for storing the number of species to calculate the mass flux for.

Set in initialize().


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