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 4379 : VariableProductIC::validParams() 16 : { 17 4379 : InputParameters params = InitialCondition::validParams(); 18 4379 : params.addClassDescription("Sets the initial condition as the product of several variables"); 19 8758 : params.addRequiredCoupledVar("values", "The values being multiplied"); 20 4379 : return params; 21 0 : } 22 : 23 2330 : VariableProductIC::VariableProductIC(const InputParameters & parameters) 24 2330 : : InitialCondition(parameters), _n(coupledComponents("values")) 25 : { 26 2330 : _values.resize(_n); 27 7010 : for (unsigned int i = 0; i < _n; i++) 28 4680 : _values[i] = &coupledValue("values", i); 29 2330 : } 30 : 31 : Real 32 65961 : VariableProductIC::value(const Point & /*p*/) 33 : { 34 : Real val = 1; 35 197927 : for (unsigned int i = 0; i < _n; i++) 36 131966 : val *= (*_values[i])[_qp]; 37 65961 : return val; 38 : }