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