本文整理汇总了C++中MooseVariable::sys方法的典型用法代码示例。如果您正苦于以下问题:C++ MooseVariable::sys方法的具体用法?C++ MooseVariable::sys怎么用?C++ MooseVariable::sys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MooseVariable
的用法示例。
在下文中一共展示了MooseVariable::sys方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MooseObject
NodalKernel::NodalKernel(const InputParameters & parameters) :
MooseObject(parameters),
BlockRestrictable(parameters),
SetupInterface(parameters),
FunctionInterface(parameters),
UserObjectInterface(parameters),
TransientInterface(parameters, "bcs"),
PostprocessorInterface(parameters),
GeometricSearchInterface(parameters),
Restartable(parameters, "BCs"),
ZeroInterface(parameters),
MeshChangedInterface(parameters),
RandomInterface(parameters, *parameters.get<FEProblem *>("_fe_problem"), parameters.get<THREAD_ID>("_tid"), true),
CoupleableMooseVariableDependencyIntermediateInterface(parameters, true),
_subproblem(*parameters.get<SubProblem *>("_subproblem")),
_fe_problem(*parameters.get<FEProblem *>("_fe_problem")),
_sys(*parameters.get<SystemBase *>("_sys")),
_tid(parameters.get<THREAD_ID>("_tid")),
_assembly(_subproblem.assembly(_tid)),
_var(_sys.getVariable(_tid, parameters.get<NonlinearVariableName>("variable"))),
_mesh(_subproblem.mesh()),
_current_node(_var.node()),
_u(_var.nodalSln()),
_u_dot(_var.nodalSlnDot()),
_du_dot_du(_var.nodalSlnDuDotDu()),
_save_in_strings(parameters.get<std::vector<AuxVariableName> >("save_in")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName> >("diag_save_in"))
{
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i=0; i<_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
mooseError("Error in " + name() + ". When saving residual values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i=0; i<_diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
mooseError("Error in " + name() + ". When saving diagonal Jacobian values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例2: KernelBase
Kernel::Kernel(const InputParameters & parameters)
: KernelBase(parameters),
MooseVariableInterface<Real>(this, false),
_var(*mooseVariable()),
_test(_var.phi()),
_grad_test(_var.gradPhi()),
_phi(_assembly.phi(_var)),
_grad_phi(_assembly.gradPhi(_var)),
_u(_is_implicit ? _var.sln() : _var.slnOld()),
_grad_u(_is_implicit ? _var.gradSln() : _var.gradSlnOld()),
_u_dot(_var.uDot()),
_du_dot_du(_var.duDotDu())
{
addMooseVariableDependency(mooseVariable());
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i = 0; i < _save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _save_in_strings[i]);
if (_fe_problem.getNonlinearSystemBase().hasVariable(_save_in_strings[i]))
paramError("save_in", "cannot use solution variable as save-in variable");
if (var->feType() != _var.feType())
paramError(
"save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i = 0; i < _diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _diag_save_in_strings[i]);
if (_fe_problem.getNonlinearSystemBase().hasVariable(_diag_save_in_strings[i]))
paramError("diag_save_in", "cannot use solution variable as diag save-in variable");
if (var->feType() != _var.feType())
paramError(
"diag_save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例3: IntegratedBCBase
ADIntegratedBCTempl<T, compute_stage>::ADIntegratedBCTempl(const InputParameters & parameters)
: IntegratedBCBase(parameters),
MooseVariableInterface<T>(this,
false,
"variable",
Moose::VarKindType::VAR_NONLINEAR,
std::is_same<T, Real>::value ? Moose::VarFieldType::VAR_FIELD_STANDARD
: Moose::VarFieldType::VAR_FIELD_VECTOR),
_var(*this->mooseVariable()),
_normals(_assembly.adNormals<compute_stage>()),
_ad_q_points(_assembly.adQPointsFace<compute_stage>()),
_test(_var.phiFace()),
_grad_test(_var.template adGradPhiFace<compute_stage>()),
_u(_var.template adSln<compute_stage>()),
_grad_u(_var.template adGradSln<compute_stage>()),
_ad_JxW(_assembly.adJxWFace<compute_stage>())
{
addMooseVariableDependency(this->mooseVariable());
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i = 0; i < _save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i = 0; i < _diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"diag_save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例4: IntegratedBCBase
IntegratedBC::IntegratedBC(const InputParameters & parameters)
: IntegratedBCBase(parameters),
MooseVariableInterface<Real>(this,
false,
"variable",
Moose::VarKindType::VAR_NONLINEAR,
Moose::VarFieldType::VAR_FIELD_STANDARD),
_var(*mooseVariable()),
_normals(_var.normals()),
_phi(_assembly.phiFace(_var)),
_grad_phi(_assembly.gradPhiFace(_var)),
_test(_var.phiFace()),
_grad_test(_var.gradPhiFace()),
_u(_is_implicit ? _var.sln() : _var.slnOld()),
_grad_u(_is_implicit ? _var.gradSln() : _var.gradSlnOld())
{
addMooseVariableDependency(mooseVariable());
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i = 0; i < _save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i = 0; i < _diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"diag_save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例5: NodalBCBase
NodalBC::NodalBC(const InputParameters & parameters)
: NodalBCBase(parameters),
MooseVariableInterface<Real>(this,
true,
"variable",
Moose::VarKindType::VAR_NONLINEAR,
Moose::VarFieldType::VAR_FIELD_STANDARD),
_var(*mooseVariable()),
_current_node(_var.node()),
_u(_var.dofValues())
{
addMooseVariableDependency(mooseVariable());
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i = 0; i < _save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i = 0; i < _diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"diag_save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例6:
void
SystemBase::prepareFace(THREAD_ID tid, bool resize_data)
{
if (_subproblem.hasActiveElementalMooseVariables(tid)) // We only need to do something if the element prepare was restricted
{
const std::set<MooseVariable *> & active_elemental_moose_variables = _subproblem.getActiveElementalMooseVariables(tid);
std::vector<MooseVariable *> newly_prepared_vars;
const std::vector<MooseVariable *> & vars = _vars[tid].variables();
for (std::vector<MooseVariable *>::const_iterator it = vars.begin(); it != vars.end(); ++it)
{
MooseVariable *var = *it;
if (&var->sys() == this && !active_elemental_moose_variables.count(var)) // If it wasnt in the active list we need to prepare it
{
var->prepare();
newly_prepared_vars.push_back(var);
}
}
// Make sure to resize the residual and jacobian datastructures for all the new variables
if (resize_data)
for (unsigned int i=0; i<newly_prepared_vars.size(); i++)
_subproblem.assembly(tid).prepareVariable(newly_prepared_vars[i]);
}
}
示例7: BoundaryCondition
NodalBC::NodalBC(const InputParameters & parameters) :
BoundaryCondition(parameters),
RandomInterface(parameters, _fe_problem, _tid, true),
CoupleableMooseVariableDependencyIntermediateInterface(parameters, true),
_current_node(_var.node()),
_u(_var.nodalSln()),
_save_in_strings(parameters.get<std::vector<AuxVariableName> >("save_in")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName> >("diag_save_in"))
{
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i=0; i<_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
mooseError("Error in " + name() + ". When saving residual values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i=0; i<_diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
mooseError("Error in " + name() + ". When saving diagonal Jacobian values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例8:
void
MultiAppCopyTransfer::transferDofObject(libMesh::DofObject * to_object,
libMesh::DofObject * from_object,
MooseVariable & to_var,
MooseVariable & from_var)
{
if (to_object->n_dofs(to_var.sys().number(), to_var.number()) >
0) // If this variable has dofs at this node
for (unsigned int comp = 0; comp < to_object->n_comp(to_var.sys().number(), to_var.number());
++comp)
{
dof_id_type dof = to_object->dof_number(to_var.sys().number(), to_var.number(), comp);
dof_id_type from_dof =
from_object->dof_number(from_var.sys().number(), from_var.number(), comp);
Real from_value = from_var.sys().solution()(from_dof);
to_var.sys().solution().set(dof, from_value);
}
}
示例9: BoundaryCondition
IntegratedBC::IntegratedBC(const std::string & name, InputParameters parameters) :
BoundaryCondition(name, parameters),
RandomInterface(name, parameters, _fe_problem, _tid, false),
CoupleableMooseVariableDependencyIntermediateInterface(parameters, false),
MaterialPropertyInterface(parameters),
_current_elem(_assembly.elem()),
_current_elem_volume(_assembly.elemVolume()),
_current_side(_assembly.side()),
_current_side_elem(_assembly.sideElem()),
_current_side_volume(_assembly.sideElemVolume()),
_normals(_var.normals()),
_qrule(_assembly.qRuleFace()),
_q_point(_assembly.qPointsFace()),
_JxW(_assembly.JxWFace()),
_coord(_assembly.coordTransformation()),
_phi(_assembly.phiFace()),
_grad_phi(_assembly.gradPhiFace()),
_test(_var.phiFace()),
_grad_test(_var.gradPhiFace()),
_u(_is_implicit ? _var.sln() : _var.slnOld()),
_grad_u(_is_implicit ? _var.gradSln() : _var.gradSlnOld()),
_save_in_strings(parameters.get<std::vector<AuxVariableName> >("save_in")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName> >("diag_save_in"))
{
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i=0; i<_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
mooseError("Error in " + _name + ". When saving residual values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i=0; i<_diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
mooseError("Error in " + _name + ". When saving diagonal Jacobian values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例10: MooseObject
KernelBase::KernelBase(const InputParameters & parameters) :
MooseObject(parameters),
BlockRestrictable(parameters),
SetupInterface(this),
CoupleableMooseVariableDependencyIntermediateInterface(parameters, false),
FunctionInterface(this),
UserObjectInterface(this),
TransientInterface(this),
PostprocessorInterface(this),
MaterialPropertyInterface(this, blockIDs()),
RandomInterface(parameters, *parameters.get<FEProblem *>("_fe_problem"), parameters.get<THREAD_ID>("_tid"), false),
GeometricSearchInterface(this),
Restartable(parameters, "Kernels"),
ZeroInterface(parameters),
MeshChangedInterface(parameters),
_subproblem(*parameters.get<SubProblem *>("_subproblem")),
_fe_problem(*parameters.get<FEProblem *>("_fe_problem")),
_sys(*parameters.get<SystemBase *>("_sys")),
_tid(parameters.get<THREAD_ID>("_tid")),
_assembly(_subproblem.assembly(_tid)),
_var(_sys.getVariable(_tid, parameters.get<NonlinearVariableName>("variable"))),
_mesh(_subproblem.mesh()),
_current_elem(_var.currentElem()),
_current_elem_volume(_assembly.elemVolume()),
_q_point(_assembly.qPoints()),
_qrule(_assembly.qRule()),
_JxW(_assembly.JxW()),
_coord(_assembly.coordTransformation()),
_test(_var.phi()),
_grad_test(_var.gradPhi()),
_phi(_assembly.phi()),
_grad_phi(_assembly.gradPhi()),
_save_in_strings(parameters.get<std::vector<AuxVariableName> >("save_in")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName> >("diag_save_in"))
{
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i=0; i<_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _save_in_strings[i]);
if (_fe_problem.getNonlinearSystem().hasVariable(_save_in_strings[i]))
mooseError("Trying to use solution variable "+_save_in_strings[i]+" as a save_in variable in "+name());
if (var->feType() != _var.feType())
mooseError("Error in " + name() + ". When saving residual values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i=0; i<_diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getVariable(_tid, _diag_save_in_strings[i]);
if (_fe_problem.getNonlinearSystem().hasVariable(_diag_save_in_strings[i]))
mooseError("Trying to use solution variable "+_diag_save_in_strings[i]+" as a diag_save_in variable in "+name());
if (var->feType() != _var.feType())
mooseError("Error in " + name() + ". When saving diagonal Jacobian values in an Auxiliary variable the AuxVariable must be the same type as the nonlinear variable the object is acting on.");
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}
示例11: MooseObject
NodalKernel::NodalKernel(const InputParameters & parameters)
: MooseObject(parameters),
BlockRestrictable(this),
BoundaryRestrictable(this, true), // true for applying to nodesets
SetupInterface(this),
FunctionInterface(this),
UserObjectInterface(this),
TransientInterface(this),
PostprocessorInterface(this),
GeometricSearchInterface(this),
Restartable(this, "BCs"),
MeshChangedInterface(parameters),
RandomInterface(parameters,
*parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"),
parameters.get<THREAD_ID>("_tid"),
true),
CoupleableMooseVariableDependencyIntermediateInterface(this, true),
MooseVariableInterface<Real>(this,
true,
"variable",
Moose::VarKindType::VAR_NONLINEAR,
Moose::VarFieldType::VAR_FIELD_STANDARD),
TaggingInterface(this),
_subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
_fe_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
_sys(*getCheckedPointerParam<SystemBase *>("_sys")),
_tid(parameters.get<THREAD_ID>("_tid")),
_assembly(_subproblem.assembly(_tid)),
_var(*mooseVariable()),
_mesh(_subproblem.mesh()),
_current_node(_var.node()),
_u(_var.dofValues()),
_save_in_strings(parameters.get<std::vector<AuxVariableName>>("save_in")),
_diag_save_in_strings(parameters.get<std::vector<AuxVariableName>>("diag_save_in"))
{
_save_in.resize(_save_in_strings.size());
_diag_save_in.resize(_diag_save_in_strings.size());
for (unsigned int i = 0; i < _save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_save_in[i] = var;
var->sys().addVariableToZeroOnResidual(_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_save_in = _save_in.size() > 0;
for (unsigned int i = 0; i < _diag_save_in_strings.size(); i++)
{
MooseVariable * var = &_subproblem.getStandardVariable(_tid, _diag_save_in_strings[i]);
if (var->feType() != _var.feType())
paramError(
"diag_save_in",
"saved-in auxiliary variable is incompatible with the object's nonlinear variable: ",
moose::internal::incompatVarMsg(*var, _var));
_diag_save_in[i] = var;
var->sys().addVariableToZeroOnJacobian(_diag_save_in_strings[i]);
addMooseVariableDependency(var);
}
_has_diag_save_in = _diag_save_in.size() > 0;
}