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 "CopyValueAux.h" 11 : #include "SystemBase.h" 12 : 13 : registerMooseObject("MooseApp", CopyValueAux); 14 : 15 : InputParameters 16 3236 : CopyValueAux::validParams() 17 : { 18 3236 : InputParameters params = AuxKernel::validParams(); 19 6472 : params.addClassDescription("Returns the specified variable as an auxiliary variable with a " 20 : "simple copy of the variable values."); 21 12944 : params.addRequiredCoupledVar("source", "Variable to take the value of."); 22 12944 : MooseEnum stateEnum("CURRENT=0 OLD=1 OLDER=2", "CURRENT"); 23 9708 : params.addParam<MooseEnum>( 24 : "state", 25 : stateEnum, 26 : "This parameter specifies the state being copied. CURRENT=0 OLD=1 OLDER=2. Copying an older " 27 : "state allows access to previous solution information if necessary."); 28 6472 : return params; 29 3236 : } 30 : 31 91 : CopyValueAux::CopyValueAux(const InputParameters & parameters) 32 : : AuxKernel(parameters), 33 91 : _state(getParam<MooseEnum>("state")), 34 273 : _v(_state == 0 ? coupledValue("source") 35 195 : : _state == 1 ? coupledValueOld("source") 36 169 : : coupledValueOlder("source")), 37 273 : _source_variable(*getVar("source", 0)) 38 : { 39 91 : if (_var.feType().family != _source_variable.feType().family) 40 0 : paramError("variable", 41 0 : "Source (" + Moose::stringify(_source_variable.feType().family) + ") and target (" + 42 0 : Moose::stringify(_var.feType().family) + 43 : ") variable have different families. You may use a ProjectionAux " 44 : "instead of the CopyValueAux"); 45 91 : if (_var.feType().order != _source_variable.feType().order) 46 0 : paramError("variable", 47 0 : "Source (" + Moose::stringify(_source_variable.feType().order) + ") and target (" + 48 0 : Moose::stringify(_var.feType().order) + 49 : ") variable are of different orders. You may use a ProjectionAux " 50 : "instead of the CopyValueAux"); 51 91 : } 52 : 53 : Real 54 542660 : CopyValueAux::computeValue() 55 : { 56 542660 : return _v[_qp]; 57 : }