https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ReconPhaseVarIC.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
10#include "ReconPhaseVarIC.h"
11
13
16{
19 "Sets the initial condition of the phase weights from the EBSD reader");
20 params.addRequiredParam<UserObjectName>("ebsd_reader",
21 "The EBSDReader object holding the EBSD data");
22 params.addRequiredParam<unsigned int>("phase", "EBSD phase number this variable is to represent");
23 return params;
24}
25
27 : InitialCondition(parameters),
28 _mesh(_fe_problem.mesh()),
29 _ebsd_reader(getUserObject<EBSDReader>("ebsd_reader")),
30 _phase(getParam<unsigned int>("phase")),
31 _node_to_phase_weight_map(_ebsd_reader.getNodeToPhaseWeightMap())
32{
33}
34
35Real
36ReconPhaseVarIC::value(const Point & /*p*/)
37{
38 // Return error if current node is NULL
39 if (_current_node == nullptr)
40 mooseError("_current_node is reporting NULL");
41
42 // Make sure the _current_node is in the _node_to_phase_weight_map (return error if not in map)
43 std::map<dof_id_type, std::vector<Real>>::const_iterator it =
45 if (it == _node_to_phase_weight_map.end())
46 mooseError("The following node id is not in the node map: ", _current_node->id());
47
48 // make sure we have enough phase weights
49 if (_phase >= it->second.size())
50 mooseError("Requested an out-of-range phase number");
51
52 return it->second[_phase];
53}
registerMooseObject("PhaseFieldApp", ReconPhaseVarIC)
void ErrorVector unsigned int
A GeneralUserObject that reads an EBSD file and stores the centroid data in a data structure which in...
Definition EBSDReader.h:32
const Node * _current_node
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
ReconPhaseVarIC initializes a single order parameter to represent a phase obtained form an EBSDReader...
static InputParameters validParams()
const std::map< dof_id_type, std::vector< Real > > & _node_to_phase_weight_map
ReconPhaseVarIC(const InputParameters &parameters)
unsigned int _phase
virtual Real value(const Point &)
MeshBase & mesh