https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
36#endif
37
38const 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
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
68 const std::string & var_name)
69{
72 _coupled_moose_vars.push_back(moose_var);
74 _coupled_array_moose_vars.push_back(var);
75
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}
OutputTools< RealEigenVector >::VariableValue ArrayVariableValue
Definition MooseTypes.h:382
OutputTools< Real >::VariableValue VariableValue
Definition MooseTypes.h:348
Intermediate base class that ties together all the interfaces for getting MooseVariableFEBases with t...
virtual const ArrayVariableValue & coupledArrayValueByName(const std::string &var_name)
Returns value of a coupled array variable give the variable name.
CoupleableMooseVariableDependencyIntermediateInterface(const MooseObject *moose_object, bool nodal, bool is_fv=false)
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:53
bool _c_is_implicit
True if implicit value is required.
std::vector< ArrayMooseVariable * > _coupled_array_moose_vars
Vector of array coupled variables.
bool _c_nodal
True if we provide coupling to nodal values.
const std::vector< MooseVariableFieldBase * > & getCoupledMooseVars() const
Get the list of all coupled variables.
Definition Coupleable.h:84
FEProblemBase & _c_fe_problem
THREAD_ID _c_tid
Thread ID of the thread using this object.
std::vector< MooseVariable * > _coupled_standard_moose_vars
Vector of standard coupled variables.
std::vector< MooseVariableFieldBase * > _coupled_moose_vars
Vector of all coupled variables.
bool _coupleable_neighbor
Whether or not this object is a "neighbor" object: ie all of it's coupled values should be neighbor v...
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.
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.
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...
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
const DofValues & dofValues() const override
dof values getters
const FieldVariableValue & slnOldNeighbor() const override
const FieldVariableValue & slnNeighbor() const override
neighbor solutions
const FieldVariableValue & slnOld() const override
const FieldVariableValue & sln() const override
element solutions
const DofValues & dofValuesNeighbor() const override
const DofValues & dofValuesOldNeighbor() const override
const DofValues & dofValuesOld() const override
This class provides an interface for common operations on field variables of both FE and FV types wit...
Interface for objects that needs scalar coupling capabilities.
@ VAR_FIELD_ANY
Definition MooseTypes.h:781
@ VAR_ANY
Definition MooseTypes.h:772