www.mooseframework.org
LevelSetBiMaterialBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 "LevelSetBiMaterialBase.h"
11 #include "AuxiliarySystem.h"
12 #include "MooseVariable.h"
13 #include "XFEM.h"
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<Material>();
20  params.addClassDescription("Compute a material property for bi-materials (consisting of two "
21  "different materials) defined by a level set function.");
22  params.addRequiredParam<VariableName>(
23  "level_set_var", "The name of level set variable used to represent the interface");
24  params.addRequiredParam<std::string>("levelset_positive_base",
25  "Base name for the material in level set positive region.");
26  params.addRequiredParam<std::string>("levelset_negative_base",
27  "Base name for the material in level set negative region.");
28  params.addParam<std::string>("base_name",
29  "Base name for the computed material property (optional)");
30  params.addRequiredParam<std::string>("prop_name", "Name for the computed material property.");
31  return params;
32 }
33 
34 LevelSetBiMaterialBase::LevelSetBiMaterialBase(const InputParameters & parameters)
35  : Material(parameters),
36  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
37  _prop_name(getParam<std::string>("prop_name")),
38  _level_set_var_number(_subproblem
39  .getVariable(_tid,
40  parameters.get<VariableName>("level_set_var"),
41  Moose::VarKindType::VAR_ANY,
42  Moose::VarFieldType::VAR_FIELD_STANDARD)
43  .number()),
44  _system(_subproblem.getSystem(getParam<VariableName>("level_set_var"))),
45  _solution(_system.current_local_solution.get()),
46  _use_positive_property(false)
47 {
48  FEProblemBase * fe_problem = dynamic_cast<FEProblemBase *>(&_subproblem);
49 
50  if (fe_problem == NULL)
51  mooseError("Problem casting _subproblem to FEProblemBase in XFEMMaterialStateMarkerBase");
52 
53  _xfem = MooseSharedNamespace::dynamic_pointer_cast<XFEM>(fe_problem->getXFEM());
54 }
55 
56 void
58 {
59  const Node * node = _current_elem->node_ptr(0);
60 
61  dof_id_type ls_dof_id = node->dof_number(_system.number(), _level_set_var_number, 0);
62  Number ls_node_value = (*_solution)(ls_dof_id);
63 
64  _use_positive_property = false;
65 
66  if (_xfem->isPointInsidePhysicalDomain(_current_elem, *node))
67  {
68  if (ls_node_value > 0.0)
70  }
71  else
72  {
73  if (ls_node_value < 0.0)
75  }
76 
77  Material::computeProperties();
78 }
79 
80 void
82 {
85  else
87 }
LevelSetBiMaterialBase::_use_positive_property
bool _use_positive_property
use the positive level set region's material properties
Definition: LevelSetBiMaterialBase.h:63
LevelSetBiMaterialBase::computeProperties
virtual void computeProperties()
Definition: LevelSetBiMaterialBase.C:57
LevelSetBiMaterialBase::_xfem
std::shared_ptr< XFEM > _xfem
shared pointer to XFEM
Definition: LevelSetBiMaterialBase.h:51
LevelSetBiMaterialBase::LevelSetBiMaterialBase
LevelSetBiMaterialBase(const InputParameters &parameters)
Definition: LevelSetBiMaterialBase.C:34
LevelSetBiMaterialBase::assignQpPropertiesForLevelSetNegative
virtual void assignQpPropertiesForLevelSetNegative()=0
assign the material properties for the negative level set region.
LevelSetBiMaterialBase.h
XFEM.h
LevelSetBiMaterialBase::computeQpProperties
virtual void computeQpProperties()
Definition: LevelSetBiMaterialBase.C:81
LevelSetBiMaterialBase::_system
const System & _system
system reference
Definition: LevelSetBiMaterialBase.h:57
LevelSetBiMaterialBase::_level_set_var_number
const unsigned int _level_set_var_number
The variable number of the level set variable we are operating on.
Definition: LevelSetBiMaterialBase.h:54
LevelSetBiMaterialBase::assignQpPropertiesForLevelSetPositive
virtual void assignQpPropertiesForLevelSetPositive()=0
assign the material properties for the positive level set region.
validParams< LevelSetBiMaterialBase >
InputParameters validParams< LevelSetBiMaterialBase >()
Definition: LevelSetBiMaterialBase.C:17