https://mooseframework.inl.gov
Loading...
Searching...
No Matches
EBSDReaderAvgDataAux.C
Go to the documentation of this file.
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
11#include "EBSDReader.h"
13
15
18{
20 params.addClassDescription("Outputs the requested EBSD reader average data, for a given phase if "
21 "specified, for the grain at the local node/element.");
22 params.addParam<unsigned int>("phase", "The phase to use for all queries.");
23 params.addRequiredParam<UserObjectName>("ebsd_reader", "The EBSDReader GeneralUserObject");
24 params.addRequiredParam<UserObjectName>("grain_tracker", "The GrainTracker UserObject");
27 "data_name",
28 field_types,
29 "The averaged data to be extracted from the EBSD data by this AuxKernel");
30 params.addParam<Real>("invalid", -1.0, "Value to return for points without active grains.");
31 return params;
32}
33
35 : AuxKernel(parameters),
36 _phase(isParamValid("phase") ? getParam<unsigned int>("phase") : libMesh::invalid_uint),
37 _ebsd_reader(getUserObject<EBSDReader>("ebsd_reader")),
38 _grain_tracker(getUserObject<GrainTrackerInterface>("grain_tracker")),
39 _data_name(getParam<MooseEnum>("data_name")),
40 _val(_ebsd_reader.getAvgDataAccessFunctor(_data_name)),
41 _invalid(getParam<Real>("invalid"))
42{
43}
44
45void
47{
48 // get the dominant grain for the current element/node
49 const int grain_id =
52 0);
53
54 // no grain found
55 if (grain_id < 0)
57
58 // get the data for the grain
59 else
61 : (*_val)(_ebsd_reader.getAvgData(grain_id));
62}
63
64Real
registerMooseObject("PhaseFieldApp", EBSDReaderAvgDataAux)
void ErrorVector unsigned int
const Elem *const & _current_elem
const Node *const & _current_node
static InputParameters validParams()
static MooseEnum getAvgDataFieldType()
This kernel makes data from the EBSDReader GeneralUserObject available as AuxVariables.
const GrainTrackerInterface & _grain_tracker
Grain tracker user object.
EBSDReaderAvgDataAux(const InputParameters &parameters)
const unsigned int _phase
Optional phase number needed for global grain index retrieval.
static InputParameters validParams()
const EBSDReader & _ebsd_reader
EBSD reader user object.
const Real _invalid
Value to return for points without active grains.
Real _value
precalculated element value
virtual void precalculateValue()
A GeneralUserObject that reads an EBSD file and stores the centroid data in a data structure which in...
Definition EBSDReader.h:32
const EBSDAvgData & getAvgData(unsigned int i) const
Get the requested type of average data for (global) grain number i.
Definition EBSDReader.C:356
This class defines the interface for the GrainTracking objects.
virtual Real getEntityValue(dof_id_type entity_id, FeatureFloodCount::FieldType, std::size_t var_index=0) const =0
Accessor for retrieving either nodal or elemental information (unique grains or variable indicies)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const unsigned int invalid_uint