Line data Source code
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 : 14 : InputParameters 15 9018 : VariableProductIC::validParams() 16 : { 17 9018 : InputParameters params = InitialCondition::validParams(); 18 9018 : params.addClassDescription("Sets the initial condition as the product of several variables"); 19 18036 : params.addRequiredCoupledVar("values", "The values being multiplied"); 20 9018 : return params; 21 0 : } 22 : 23 4913 : VariableProductIC::VariableProductIC(const InputParameters & parameters) 24 4913 : : InitialCondition(parameters), _n(coupledComponents("values")) 25 : { 26 4913 : _values.resize(_n); 27 14789 : for (unsigned int i = 0; i < _n; i++) 28 9876 : _values[i] = &coupledValue("values", i); 29 4913 : } 30 : 31 : Real 32 63335 : VariableProductIC::value(const Point & /*p*/) 33 : { 34 : Real val = 1; 35 190115 : for (unsigned int i = 0; i < _n; i++) 36 126780 : val *= (*_values[i])[_qp]; 37 63335 : return val; 38 : }