https://mooseframework.inl.gov
VariableProductIC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "VariableProductIC.h"
11 
12 registerMooseObject("ThermalHydraulicsApp", VariableProductIC);
13 
16 {
18  params.addClassDescription("Sets the initial condition as the product of several variables");
19  params.addRequiredCoupledVar("values", "The values being multiplied");
20  return params;
21 }
22 
24  : InitialCondition(parameters), _n(coupledComponents("values"))
25 {
26  _values.resize(_n);
27  for (unsigned int i = 0; i < _n; i++)
28  _values[i] = &coupledValue("values", i);
29 }
30 
31 Real
32 VariableProductIC::value(const Point & /*p*/)
33 {
34  Real val = 1;
35  for (unsigned int i = 0; i < _n; i++)
36  val *= (*_values[i])[_qp];
37  return val;
38 }
static InputParameters validParams()
std::vector< const VariableValue * > _values
The values being multipled.
Computes the product of coupled variables.
static InputParameters validParams()
registerMooseObject("ThermalHydraulicsApp", VariableProductIC)
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0) const
unsigned int _n
The number of coupled variables.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real value(const Point &p)
void addClassDescription(const std::string &doc_string)
VariableProductIC(const InputParameters &parameters)