https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SolutionAuxMisorientationBoundary.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 "MooseError.h"
12#include "SolutionUserObject.h"
13#include "BndsCalculator.h"
14
16
19{
22 "Calculate location of grain boundaries by using information from a SolutionUserObject.");
24 "v", "var_name_base", "op_num", "Array of coupled variables");
25 params.addRequiredParam<Real>("gb_type_order",
26 "The grain boundary type to calculate bnds parameter");
27 return params;
28}
29
31 const InputParameters & parameters)
32 : SolutionAux(parameters),
33 _gb_type_order(getParam<Real>("gb_type_order")),
34 _op_num(coupledComponents("v")),
35 _vals(coupledValues("v"))
36{
37}
38
39Real
41{
42 // The value to output
43 Real output_gb_type;
44
45 // _direct=true, extract the values using the dof
46 if (_direct)
47 {
48 if (isNodal())
50 else
52 }
53 // _direct=false, extract the values using time and point
54 else
55 {
56 if (isNodal())
58 else
59 output_gb_type = _solution_object.pointValue(_t, _current_elem->vertex_average(), _var_name);
60 }
61
62 // generate different GB boundary parameters
63 auto gb_type_shift = abs(output_gb_type - _gb_type_order);
64 if (abs(output_gb_type - 0) < 1e-3)
65 return 1.0;
66 else if (gb_type_shift < 1e-3)
68 else
69 return gb_type_shift + (1 - gb_type_shift) * BndsCalculator::computeBndsVariable(_vals, _qp);
70}
registerMooseObject("PhaseFieldApp", SolutionAuxMisorientationBoundary)
bool isNodal() const
const Elem *const & _current_elem
const Node *const & _current_node
unsigned int _qp
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addRequiredCoupledVarWithAutoBuild(const std::string &name, const std::string &base_name, const std::string &num_name, const std::string &doc_string)
AuxKernel for reading a solution from file and visualizing the location of grain boundaries for speci...
virtual Real computeValue() override
Computes a value for a node or element depending on the type of kernel, it also uses the 'direct' fla...
SolutionAuxMisorientationBoundary(const InputParameters &parameters)
const std::vector< const VariableValue * > _vals
Real _gb_type_order
The grain boundary type to calculate bnds parameter.
static InputParameters validParams()
const SolutionUserObjectBase & _solution_object
std::string _var_name
Real pointValue(Real t, const Point &p, const unsigned int local_var_index, const std::set< subdomain_id_type > *subdomain_ids=nullptr) const
Real directValue(const Node *node, const std::string &var_name) const
Real computeBndsVariable(const std::vector< T * > &var, unsigned int qp)