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 "AtomicDensityAux.h" 10 : #include "MyTRIMRasterizer.h" 11 : 12 : #include "libmesh/utility.h" 13 : 14 : registerMooseObject("MagpieApp", AtomicDensityAux); 15 : 16 : InputParameters 17 0 : AtomicDensityAux::validParams() 18 : { 19 0 : InputParameters params = AuxKernel::validParams(); 20 0 : params.addClassDescription("Compute the atomic density as Atoms/volume at an element using data " 21 : "from a MyTRIMRasterizer. Volume is in the Mesh units set in the " 22 : "rasterizer."); 23 0 : params.addRequiredParam<UserObjectName>("rasterizer", 24 : "MyTRIMRasterizer object to provide material data"); 25 0 : return params; 26 0 : } 27 : 28 0 : AtomicDensityAux::AtomicDensityAux(const InputParameters & parameters) 29 : : AuxKernel(parameters), 30 0 : _rasterizer(getUserObject<MyTRIMRasterizer>("rasterizer")), 31 0 : _volume_scale(Utility::pow<3>(_rasterizer.getTrimParameters().length_scale / 1000.0)) 32 : { 33 0 : } 34 : 35 : Real 36 0 : AtomicDensityAux::computeValue() 37 : { 38 : // prepare the material using data from the rasterizer 39 0 : const std::vector<Real> & material_data = _rasterizer.material(_current_elem); 40 : 41 : // calculate the lattice site occupation 42 : Real total_occupation = 0.0; 43 0 : for (auto t : material_data) 44 0 : total_occupation += t; 45 : 46 : // compute atomic density (siteVolume is in nm^3) 47 0 : return _volume_scale * total_occupation / _rasterizer.siteVolume(_current_elem); 48 : }