GRINS-0.6.0
Public Member Functions | Protected Attributes | List of all members
GRINS::QoIBase Class Referenceabstract

#include <qoi_base.h>

Inheritance diagram for GRINS::QoIBase:
Inheritance graph
[legend]
Collaboration diagram for GRINS::QoIBase:
Collaboration graph
[legend]

Public Member Functions

 QoIBase (const std::string &qoi_name)
 
virtual ~QoIBase ()
 
virtual QoIBaseclone () const =0
 Clone this QoI. More...
 
virtual bool assemble_on_interior () const =0
 Does the QoI need an element interior assembly loop? More...
 
virtual bool assemble_on_sides () const =0
 Does the QoI need a domain boundary assembly loop? More...
 
virtual void init (const GetPot &input, const MultiphysicsSystem &system)
 Method to allow QoI to cache any system information needed for QoI calculation, for example, solution variable indices. More...
 
virtual void init_context (AssemblyContext &context)
 
virtual void element_qoi (AssemblyContext &context, const unsigned int qoi_index)
 Compute the qoi value for element interiors. More...
 
virtual void element_qoi_derivative (AssemblyContext &context, const unsigned int qoi_index)
 Compute the qoi derivative with respect to the solution on element interiors. More...
 
virtual void side_qoi (AssemblyContext &context, const unsigned int qoi_index)
 Compute the qoi value on the domain boundary. More...
 
virtual void side_qoi_derivative (AssemblyContext &context, const unsigned int qoi_index)
 Compute the qoi derivative with respect to the solution on the domain boundary. More...
 
virtual void parallel_op (const libMesh::Parallel::Communicator &communicator, libMesh::Number &sys_qoi, libMesh::Number &local_qoi)
 Call the parallel operation for this QoI and cache the value. More...
 
virtual void thread_join (libMesh::Number &qoi, const libMesh::Number &other_qoi)
 Call the operation to accumulate this QoI from multiple threads. More...
 
virtual void output_qoi (std::ostream &out) const
 Basic output for computed QoI's. More...
 
libMesh::Number value () const
 Returns the current QoI value. More...
 
const std::string & name () const
 Returns the name of this QoI. More...
 
virtual void set_parameter (libMesh::Number &param_variable, const GetPot &input, const std::string &param_name, libMesh::Number param_default)
 Each subclass can simultaneously read a parameter value from. More...
 
virtual void register_parameter (const std::string &param_name, libMesh::ParameterMultiPointer< libMesh::Number > &param_pointer) const
 Each subclass will register its copy of an independent. More...
 

Protected Attributes

std::string _qoi_name
 
libMesh::Number _qoi_value
 

Detailed Description

Definition at line 54 of file qoi_base.h.

Constructor & Destructor Documentation

GRINS::QoIBase::QoIBase ( const std::string &  qoi_name)

Definition at line 39 of file qoi_base.C.

40  : ParameterUser(qoi_name),
41  _qoi_name(qoi_name),
42  _qoi_value(0.0)
43  {
44  return;
45  }
std::string _qoi_name
Definition: qoi_base.h:131
libMesh::Number _qoi_value
Definition: qoi_base.h:133
ParameterUser(const std::string &user_name)
GRINS::QoIBase::~QoIBase ( )
virtual

Definition at line 47 of file qoi_base.C.

48  {
49  return;
50  }

Member Function Documentation

virtual bool GRINS::QoIBase::assemble_on_interior ( ) const
pure virtual

Does the QoI need an element interior assembly loop?

This is pure virtual to force to user to specify.

Implemented in GRINS::ParsedInteriorQoI, GRINS::Vorticity, and GRINS::AverageNusseltNumber.

Referenced by GRINS::CompositeQoI::add_qoi().

virtual bool GRINS::QoIBase::assemble_on_sides ( ) const
pure virtual

Does the QoI need a domain boundary assembly loop?

This is pure virtual to force to user to specify.

Implemented in GRINS::ParsedInteriorQoI, GRINS::Vorticity, and GRINS::AverageNusseltNumber.

Referenced by GRINS::CompositeQoI::add_qoi().

virtual QoIBase* GRINS::QoIBase::clone ( ) const
pure virtual

Clone this QoI.

We return a raw pointer, but it is expected for the user to take ownership and delete the object when done.

Implemented in GRINS::ParsedInteriorQoI, GRINS::Vorticity, and GRINS::AverageNusseltNumber.

Referenced by GRINS::CompositeQoI::add_qoi().

void GRINS::QoIBase::element_qoi ( AssemblyContext context,
const unsigned int  qoi_index 
)
virtual

Compute the qoi value for element interiors.

Override this method if your QoI is defined on element interiors

Reimplemented in GRINS::Vorticity, and GRINS::ParsedInteriorQoI.

Definition at line 63 of file qoi_base.C.

65  {
66  return;
67  }
void GRINS::QoIBase::element_qoi_derivative ( AssemblyContext context,
const unsigned int  qoi_index 
)
virtual

Compute the qoi derivative with respect to the solution on element interiors.

Override this method if your QoI is defined on element interiors

Reimplemented in GRINS::Vorticity, and GRINS::ParsedInteriorQoI.

Definition at line 69 of file qoi_base.C.

71  {
72  return;
73  }
void GRINS::QoIBase::init ( const GetPot &  input,
const MultiphysicsSystem system 
)
virtual

Method to allow QoI to cache any system information needed for QoI calculation, for example, solution variable indices.

Reimplemented in GRINS::Vorticity, GRINS::ParsedInteriorQoI, and GRINS::AverageNusseltNumber.

Definition at line 52 of file qoi_base.C.

54  {
55  return;
56  }
void GRINS::QoIBase::init_context ( AssemblyContext context)
virtual

Reimplemented in GRINS::Vorticity, GRINS::ParsedInteriorQoI, and GRINS::AverageNusseltNumber.

Definition at line 58 of file qoi_base.C.

59  {
60  return;
61  }
const std::string & GRINS::QoIBase::name ( ) const
inline

Returns the name of this QoI.

Definition at line 143 of file qoi_base.h.

References _qoi_name.

Referenced by GRINS::SteadyVisualization::output_adjoint(), and GRINS::UnsteadyVisualization::output_adjoint().

144  {
145  return _qoi_name;
146  }
std::string _qoi_name
Definition: qoi_base.h:131
void GRINS::QoIBase::output_qoi ( std::ostream &  out) const
virtual

Basic output for computed QoI's.

If fancier output is desired, override this method.

Definition at line 107 of file qoi_base.C.

References _qoi_name, and _qoi_value.

108  {
109  out << "==========================================================" << std::endl;
110 
111  out << _qoi_name+" = "
112  << std::setprecision(16)
113  << std::scientific
114  << _qoi_value << std::endl;
115 
116  out << "==========================================================" << std::endl;
117 
118  return;
119  }
std::string _qoi_name
Definition: qoi_base.h:131
libMesh::Number _qoi_value
Definition: qoi_base.h:133
void GRINS::QoIBase::parallel_op ( const libMesh::Parallel::Communicator &  communicator,
libMesh::Number &  sys_qoi,
libMesh::Number &  local_qoi 
)
virtual

Call the parallel operation for this QoI and cache the value.

By default, this is just a sum. Override if QoI is more complex.

Definition at line 87 of file qoi_base.C.

References _qoi_value.

90  {
91  communicator.sum(local_qoi);
92 
93  sys_qoi = local_qoi;
94 
95  _qoi_value = sys_qoi;
96 
97  return;
98  }
libMesh::Number _qoi_value
Definition: qoi_base.h:133
void GRINS::ParameterUser::register_parameter ( const std::string &  param_name,
libMesh::ParameterMultiPointer< libMesh::Number > &  param_pointer 
) const
virtualinherited

Each subclass will register its copy of an independent.

Reimplemented in GRINS::AxisymmetricHeatTransfer< Conductivity >, GRINS::LowMachNavierStokesBase< Viscosity, SpecificHeat, ThermalConductivity >, GRINS::IncompressibleNavierStokesBase< Viscosity >, GRINS::BoussinesqBuoyancySPGSMStabilization< Viscosity >, GRINS::HeatConduction< Conductivity >, GRINS::HeatTransferBase< Conductivity >, and GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >.

Definition at line 50 of file parameter_user.C.

Referenced by GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::register_parameter(), GRINS::HeatTransferBase< Conductivity >::register_parameter(), GRINS::HeatConduction< Conductivity >::register_parameter(), GRINS::BoussinesqBuoyancySPGSMStabilization< Viscosity >::register_parameter(), GRINS::IncompressibleNavierStokesBase< Viscosity >::register_parameter(), GRINS::LowMachNavierStokesBase< Viscosity, SpecificHeat, ThermalConductivity >::register_parameter(), and GRINS::AxisymmetricHeatTransfer< Conductivity >::register_parameter().

53  {
54  std::map<std::string, libMesh::Number*>::const_iterator it =
55  _my_parameters.find(param_name);
56 
57  if (it != _my_parameters.end())
58  {
59  std::cout << _my_name << " uses parameter " << param_name
60  << std::endl;
61  param_pointer.push_back(it->second);
62  }
63  }
std::map< std::string, libMesh::Number * > _my_parameters
void GRINS::ParameterUser::set_parameter ( libMesh::Number &  param_variable,
const GetPot &  input,
const std::string &  param_name,
libMesh::Number  param_default 
)
virtualinherited

Each subclass can simultaneously read a parameter value from.

Definition at line 35 of file parameter_user.C.

References GRINS::ParameterUser::_my_name, and GRINS::ParameterUser::_my_parameters.

Referenced by GRINS::AveragedFanAdjointStabilization< Viscosity >::AveragedFanAdjointStabilization(), GRINS::AveragedTurbineAdjointStabilization< Viscosity >::AveragedTurbineAdjointStabilization(), GRINS::BoussinesqBuoyancyAdjointStabilization< Viscosity >::BoussinesqBuoyancyAdjointStabilization(), GRINS::BoussinesqBuoyancyBase::BoussinesqBuoyancyBase(), GRINS::BoussinesqBuoyancySPGSMStabilization< Viscosity >::BoussinesqBuoyancySPGSMStabilization(), GRINS::ConstantConductivity::ConstantConductivity(), GRINS::ConstantPrandtlConductivity::ConstantPrandtlConductivity(), GRINS::ConstantSourceFunction::ConstantSourceFunction(), GRINS::ConstantSourceTerm::ConstantSourceTerm(), GRINS::ConstantSpecificHeat::ConstantSpecificHeat(), GRINS::ConstantViscosity::ConstantViscosity(), GRINS::ElasticCable< StressStrainLaw >::ElasticCable(), GRINS::ElasticCableConstantGravity::ElasticCableConstantGravity(), GRINS::ElasticMembrane< StressStrainLaw >::ElasticMembrane(), GRINS::ElasticMembraneConstantPressure::ElasticMembraneConstantPressure(), GRINS::HeatConduction< Conductivity >::HeatConduction(), GRINS::HeatTransferBase< Conductivity >::HeatTransferBase(), GRINS::IncompressibleNavierStokesBase< Viscosity >::IncompressibleNavierStokesBase(), GRINS::AverageNusseltNumber::init(), GRINS::MooneyRivlin::MooneyRivlin(), GRINS::ReactingLowMachNavierStokesBase< Mixture, Evaluator >::ReactingLowMachNavierStokesBase(), GRINS::HookesLaw1D::read_input_options(), GRINS::HookesLaw::read_input_options(), GRINS::AxisymmetricBoussinesqBuoyancy::read_input_options(), and GRINS::VelocityDragAdjointStabilization< Viscosity >::VelocityDragAdjointStabilization().

39  {
40  param_variable = input(param_name, param_default);
41 
42  libmesh_assert_msg(!_my_parameters.count(param_name),
43  "ERROR: " << _my_name << " double-registered parameter " <<
44  param_name);
45 
46  _my_parameters[param_name] = &param_variable;
47  }
std::map< std::string, libMesh::Number * > _my_parameters
void GRINS::QoIBase::side_qoi ( AssemblyContext context,
const unsigned int  qoi_index 
)
virtual

Compute the qoi value on the domain boundary.

Override this method if your QoI is defined on the domain boundary

Reimplemented in GRINS::AverageNusseltNumber.

Definition at line 75 of file qoi_base.C.

77  {
78  return;
79  }
void GRINS::QoIBase::side_qoi_derivative ( AssemblyContext context,
const unsigned int  qoi_index 
)
virtual

Compute the qoi derivative with respect to the solution on the domain boundary.

Override this method if your QoI is defined on the domain boundary

Reimplemented in GRINS::AverageNusseltNumber.

Definition at line 81 of file qoi_base.C.

83  {
84  return;
85  }
void GRINS::QoIBase::thread_join ( libMesh::Number &  qoi,
const libMesh::Number &  other_qoi 
)
virtual

Call the operation to accumulate this QoI from multiple threads.

By default, this is just a sum. Override if QoI is more complex.

Definition at line 100 of file qoi_base.C.

101  {
102  qoi += other_qoi;
103 
104  return;
105  }
libMesh::Number GRINS::QoIBase::value ( ) const
inline

Returns the current QoI value.

Definition at line 137 of file qoi_base.h.

References _qoi_value.

138  {
139  return _qoi_value;
140  }
libMesh::Number _qoi_value
Definition: qoi_base.h:133

Member Data Documentation

std::string GRINS::QoIBase::_qoi_name
protected

Definition at line 131 of file qoi_base.h.

Referenced by name(), and output_qoi().

libMesh::Number GRINS::QoIBase::_qoi_value
protected

Definition at line 133 of file qoi_base.h.

Referenced by output_qoi(), parallel_op(), and value().


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

Generated on Mon Jun 22 2015 21:32:24 for GRINS-0.6.0 by  doxygen 1.8.9.1