https://mooseframework.inl.gov
CoupleableMooseVariableDependencyIntermediateInterface.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 
12 #include "FEProblemBase.h"
13 
16  bool nodal,
17  bool is_fv)
18  : Coupleable(moose_object, nodal, is_fv),
19  ScalarCoupleable(moose_object),
21 {
22  for (MooseVariableFEBase * coupled_var : getCoupledMooseVars())
23  addMooseVariableDependency(coupled_var);
24 }
25 
26 #ifdef MOOSE_KOKKOS_ENABLED
30  const Moose::Kokkos::FunctorCopy & key)
31  : Coupleable(object, key),
32  ScalarCoupleable(object, key),
34 {
35 }
36 #endif
37 
38 const VariableValue &
40  const std::string & var_name)
41 {
44  _coupled_moose_vars.push_back(moose_var);
46  _coupled_standard_moose_vars.push_back(var);
47 
48  addMooseVariableDependency(moose_var);
49 
51  {
52  if (_c_nodal)
53  return (_c_is_implicit) ? var->dofValues() : var->dofValuesOld();
54  else
55  return (_c_is_implicit) ? var->sln() : var->slnOld();
56  }
57  else
58  {
59  if (_c_nodal)
60  return (_c_is_implicit) ? var->dofValuesNeighbor() : var->dofValuesOldNeighbor();
61  else
62  return (_c_is_implicit) ? var->slnNeighbor() : var->slnOldNeighbor();
63  }
64 }
65 
66 const ArrayVariableValue &
68  const std::string & var_name)
69 {
72  _coupled_moose_vars.push_back(moose_var);
74  _coupled_array_moose_vars.push_back(var);
75 
76  addMooseVariableDependency(moose_var);
77 
79  {
80  if (_c_nodal)
81  return (_c_is_implicit) ? var->dofValues() : var->dofValuesOld();
82  else
83  return (_c_is_implicit) ? var->sln() : var->slnOld();
84  }
85  else
86  {
87  if (_c_nodal)
88  return (_c_is_implicit) ? var->dofValuesNeighbor() : var->dofValuesOldNeighbor();
89  else
90  return (_c_is_implicit) ? var->slnNeighbor() : var->slnOldNeighbor();
91  }
92 }
bool _c_nodal
True if we provide coupling to nodal values.
Definition: Coupleable.h:1441
std::vector< ArrayMooseVariable * > _coupled_array_moose_vars
Vector of array coupled variables.
Definition: Coupleable.h:1432
const FieldVariableValue & slnNeighbor() const override
neighbor solutions
THREAD_ID _c_tid
Thread ID of the thread using this object.
Definition: Coupleable.h:1450
This class provides an interface for common operations on field variables of both FE and FV types wit...
const DoFValue & dofValuesNeighbor() const override
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
std::vector< MooseVariable * > _coupled_standard_moose_vars
Vector of standard coupled variables.
Definition: Coupleable.h:1426
FEProblemBase & _c_fe_problem
Definition: Coupleable.h:1414
bool _c_is_implicit
True if implicit value is required.
Definition: Coupleable.h:1444
CoupleableMooseVariableDependencyIntermediateInterface(const MooseObject *moose_object, bool nodal, bool is_fv=false)
OutputTools< RealEigenVector >::VariableValue ArrayVariableValue
Definition: MooseTypes.h:349
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:27
const FieldVariableValue & sln() const override
element solutions
const DoFValue & dofValuesOld() const override
const DoFValue & dofValuesOldNeighbor() const override
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested MooseVariable which may be in any system.
const std::vector< MooseVariableFieldBase * > & getCoupledMooseVars() const
Get the list of all coupled variables.
Definition: Coupleable.h:81
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
Definition: Coupleable.h:1423
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:315
bool _coupleable_neighbor
Whether or not this object is a "neighbor" object: ie all of it&#39;s coupled values should be neighbor v...
Definition: Coupleable.h:1713
virtual const VariableValue & coupledValueByName(const std::string &var_name)
Returns value of a coupled variable give the variable name.
Interface for objects that needs coupling capabilities.
Definition: Coupleable.h:49
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
const DoFValue & dofValues() const override
dof values getters
virtual const ArrayVariableValue & coupledArrayValueByName(const std::string &var_name)
Returns value of a coupled array variable give the variable name.
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
Interface for objects that needs scalar coupling capabilities.
virtual ArrayMooseVariable & getArrayVariable(const THREAD_ID tid, const std::string &var_name) override
Returns the variable reference for requested ArrayMooseVariable which may be in any system...
const FieldVariableValue & slnOld() const override
const FieldVariableValue & slnOldNeighbor() const override