https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
12registerMooseObject("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
31Real
32VariableProductIC::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}
registerMooseObject("ThermalHydraulicsApp", VariableProductIC)
virtual const VariableValue & coupledValue(const std::string &var_name, unsigned int comp=0) const
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Computes the product of coupled variables.
static InputParameters validParams()
std::vector< const VariableValue * > _values
The values being multipled.
unsigned int _n
The number of coupled variables.
virtual Real value(const Point &p)
VariableProductIC(const InputParameters &parameters)