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 14390 : CopyValueAux::validParams() 17 : { 18 14390 : InputParameters params = AuxKernel::validParams(); 19 14390 : params.addClassDescription("Returns the specified variable as an auxiliary variable with a " 20 : "simple copy of the variable values."); 21 14390 : params.addRequiredCoupledVar("source", "Variable to take the value of."); 22 14390 : MooseEnum stateEnum("CURRENT=0 OLD=1 OLDER=2", "CURRENT"); 23 14390 : 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 28780 : return params; 29 14390 : } 30 : 31 65 : CopyValueAux::CopyValueAux(const InputParameters & parameters) 32 : : AuxKernel(parameters), 33 65 : _state(getParam<MooseEnum>("state")), 34 156 : _v(_state == 0 ? coupledValue("source") 35 91 : : _state == 1 ? coupledValueOld("source") 36 78 : : coupledValueOlder("source")), 37 130 : _source_variable(*getVar("source", 0)) 38 : { 39 65 : 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 65 : 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 65 : } 52 : 53 : Real 54 538760 : CopyValueAux::computeValue() 55 : { 56 538760 : return _v[_qp]; 57 : }