Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */ 4 : /* */ 5 : /* Copyright 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "MyTRIMDensityAux.h" 10 : #include "MooseMyTRIMMaterial.h" 11 : 12 : registerMooseObject("MagpieApp", MyTRIMDensityAux); 13 : 14 : InputParameters 15 9 : MyTRIMDensityAux::validParams() 16 : { 17 9 : InputParameters params = AuxKernel::validParams(); 18 9 : params.addClassDescription("Returns the material density in g/cm^3"); 19 18 : params.addRequiredParam<UserObjectName>("rasterizer", 20 : "MyTRIMRasterizer object to provide material data"); 21 9 : return params; 22 0 : } 23 : 24 5 : MyTRIMDensityAux::MyTRIMDensityAux(const InputParameters & parameters) 25 : : AuxKernel(parameters), 26 5 : _rasterizer(getUserObject<MyTRIMRasterizer>("rasterizer")), 27 5 : _trim_parameters(_rasterizer.getTrimParameters()), 28 10 : _nvars(_trim_parameters.nVars()) 29 : { 30 5 : if (isNodal()) 31 0 : mooseError("MyTRIMDensityAux needs to be applied to an elemental AuxVariable."); 32 5 : } 33 : 34 : Real 35 3600 : MyTRIMDensityAux::computeValue() 36 : { 37 3600 : if (_qp == 0) 38 : { 39 : // prepare the material using data from the rasterizer 40 900 : const std::vector<Real> & material_data = _rasterizer.material(_current_elem); 41 900 : MooseMyTRIMMaterial material(&_simconf); 42 : 43 : // set elements 44 900 : MyTRIM_NS::Element element; 45 2700 : for (unsigned int i = 0; i < _nvars; ++i) 46 : { 47 1800 : element = _trim_parameters.element_prototypes[i]; 48 1800 : element._t = material_data[i]; 49 1800 : material._element.push_back(element); 50 : } 51 : 52 : // calculate the density (must happen first!) 53 900 : material.calculateDensity(_rasterizer.siteVolume(_current_elem)); 54 : 55 900 : _value_cache = material._rho; 56 : } 57 : 58 3600 : return _value_cache; 59 : }