本文整理汇总了C++中MooseVariable类的典型用法代码示例。如果您正苦于以下问题:C++ MooseVariable类的具体用法?C++ MooseVariable怎么用?C++ MooseVariable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MooseVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: coupledCallback
VariableSecond &
Coupleable::coupledSecondOld(const std::string & var_name, unsigned int comp)
{
coupledCallback(var_name, true);
if (_nodal)
mooseError("Nodal variables do not have second derivatives");
validateExecutionerType(var_name);
MooseVariable * var = getVar(var_name, comp);
return (_c_is_implicit) ? var->secondSlnOld() : var->secondSlnOlder();
}
示例2:
void
SystemBase::reinitNodesNeighbor(const std::vector<dof_id_type> & nodes, THREAD_ID tid)
{
const std::vector<MooseVariable *> & vars = _vars[tid].variables();
for (std::vector<MooseVariable *>::const_iterator it = vars.begin(); it != vars.end(); ++it)
{
MooseVariable *var = *it;
var->reinitNodesNeighbor(nodes);
var->computeNodalNeighborValues();
}
}
示例3: validateExecutionerType
const VariableValue &
NeighborCoupleable::coupledNeighborValueOld(const std::string & var_name, unsigned int comp)
{
validateExecutionerType(var_name, "coupledNeighborValueOld");
MooseVariable * var = getVar(var_name, comp);
if (_neighbor_nodal)
return (_c_is_implicit) ? var->nodalValueOldNeighbor() : var->nodalValueOlderNeighbor();
else
return (_c_is_implicit) ? var->slnOldNeighbor() : var->slnOlderNeighbor();
}
示例4: getVar
VariableValue &
Coupleable::coupledDotDu(const std::string & var_name, unsigned int comp)
{
MooseVariable * var = getVar(var_name, comp);
if (var->kind() == Moose::VAR_AUXILIARY)
mooseError("Coupling time derivative of an auxiliary variable is not allowed.");
if (_nodal)
return var->nodalSlnDuDotDu();
else
return var->duDotDu();
}
示例5: coupledCallback
VariableSecond &
Coupleable::coupledSecond(const std::string & var_name, unsigned int comp)
{
if (!isCoupled(var_name)) // Return default 0
return _default_second;
coupledCallback(var_name, false);
if (_nodal)
mooseError("Nodal variables do not have second derivatives");
MooseVariable * var = getVar(var_name, comp);
return (_c_is_implicit) ? var->secondSln() : var->secondSlnOlder();
}
示例6: mooseError
const VariableGradient &
NeighborCoupleable::coupledNeighborGradientOlder(const std::string & var_name, unsigned int comp)
{
if (_neighbor_nodal)
mooseError("Nodal variables do not have gradients");
validateExecutionerType(var_name, "coupledNeighborGradientOlder");
MooseVariable * var = getVar(var_name, comp);
if (_c_is_implicit)
return var->gradSlnOlderNeighbor();
else
mooseError("Older values not available for explicit schemes");
}
示例7: getVar
VariableValue &
Coupleable::coupledDotDu(const std::string & var_name, unsigned int comp)
{
if (!isCoupled(var_name)) // Return default 0
return _default_value_zero;
MooseVariable * var = getVar(var_name, comp);
if (_nodal)
return var->nodalSlnDuDotDu();
else
return var->duDotDu();
}
示例8: coupledCallback
const VariableValue &
Coupleable::coupledNodalValue(const std::string & var_name, unsigned int comp)
{
if (!isCoupled(var_name))
return *getDefaultValue(var_name);
coupledCallback(var_name, false);
MooseVariable * var = getVar(var_name, comp);
if (!_coupleable_neighbor)
return (_c_is_implicit) ? var->nodalValue() : var->nodalValueOld();
else
return (_c_is_implicit) ? var->nodalValueNeighbor() : var->nodalValueOldNeighbor();
}
示例9: lock
void
ComputeElemAuxBcsThread::operator() (const ConstBndElemRange & range)
{
ParallelUniqueId puid;
_tid = puid.id;
for (ConstBndElemRange::const_iterator elem_it = range.begin() ; elem_it != range.end(); ++elem_it)
{
const BndElement * belem = *elem_it;
const Elem * elem = belem->_elem;
unsigned short int side = belem->_side;
BoundaryID boundary_id = belem->_bnd_id;
if (elem->processor_id() == _problem.processor_id())
{
// prepare variables
for (std::map<std::string, MooseVariable *>::iterator it = _sys._elem_vars[_tid].begin(); it != _sys._elem_vars[_tid].end(); ++it)
{
MooseVariable * var = it->second;
var->prepareAux();
}
if (_auxs[_tid].elementalBCs(boundary_id).size() > 0)
{
_problem.prepare(elem, _tid);
_problem.reinitElemFace(elem, side, boundary_id, _tid);
_problem.reinitMaterialsBoundary(boundary_id, _tid);
const std::vector<AuxKernel*> & bcs = _auxs[_tid].elementalBCs(boundary_id);
for (std::vector<AuxKernel*>::const_iterator element_bc_it = bcs.begin(); element_bc_it != bcs.end(); ++element_bc_it)
(*element_bc_it)->compute();
_problem.swapBackMaterialsFace(_tid);
}
// update the solution vector
{
Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
for (std::map<std::string, MooseVariable *>::iterator it = _sys._elem_vars[_tid].begin(); it != _sys._elem_vars[_tid].end(); ++it)
{
MooseVariable * var = it->second;
var->insert(_sys.solution());
}
}
}
}
}
示例10:
void
AuxiliarySystem::addVariable(const std::string & var_name, const FEType & type, Real scale_factor, const std::set< SubdomainID > * const active_subdomains/* = NULL*/)
{
SystemTempl<TransientExplicitSystem>::addVariable(var_name, type, scale_factor, active_subdomains);
for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
{
MooseVariable * var = dynamic_cast<MooseVariable *>(_vars[tid].getVariable(var_name));
if (var != NULL)
{
if (var->feType().family == LAGRANGE)
_nodal_vars[tid][var_name] = var;
else
_elem_vars[tid][var_name] = var;
}
}
}
示例11:
void
AuxiliarySystem::reinitElem(const Elem * /*elem*/, THREAD_ID tid)
{
for (const auto & it : _nodal_vars[tid])
{
MooseVariable * var = it.second;
var->computeElemValues();
}
for (const auto & it : _elem_vars[tid])
{
MooseVariable * var = it.second;
var->reinitAux();
var->computeElemValues();
}
}
示例12: mooseError
unsigned int
PolycrystalICTools::assignPointToGrain(const Point & p,
const std::vector<Point> & centerpoints,
const MooseMesh & mesh,
const MooseVariable & var,
const Real maxsize)
{
unsigned int grain_num = centerpoints.size();
Real min_distance = maxsize;
unsigned int min_index = grain_num;
// Loops through all of the grain centers and finds the center that is closest to the point p
for (unsigned int grain = 0; grain < grain_num; grain++)
{
Real distance = mesh.minPeriodicDistance(var.number(), centerpoints[grain], p);
if (min_distance > distance)
{
min_distance = distance;
min_index = grain;
}
}
if (min_index >= grain_num)
mooseError("ERROR in PolycrystalVoronoiVoidIC: didn't find minimum values in grain_value_calc");
return min_index;
}
示例13: validateExecutionerType
const VariableValue &
Coupleable::coupledValueOlder(const std::string & var_name, unsigned int comp)
{
if (!isCoupled(var_name))
return *getDefaultValue(var_name);
validateExecutionerType(var_name);
coupledCallback(var_name, true);
MooseVariable * var = getVar(var_name, comp);
if (!_coupleable_neighbor)
{
if (_nodal)
{
if (_c_is_implicit)
return var->nodalSlnOlder();
else
mooseError("Older values not available for explicit schemes");
}
else
{
if (_c_is_implicit)
return var->slnOlder();
else
mooseError("Older values not available for explicit schemes");
}
}
else
{
if (_nodal)
{
if (_c_is_implicit)
return var->nodalSlnOlderNeighbor();
else
mooseError("Older values not available for explicit schemes");
}
else
{
if (_c_is_implicit)
return var->slnOlderNeighbor();
else
mooseError("Older values not available for explicit schemes");
}
}
}
示例14:
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);
}
}
示例15: VariableValue
VariableValue &
Coupleable::coupledNodalValue(const std::string & var_name, unsigned int comp)
{
if (!isCoupled(var_name)) // Need to generate a "default value" filled VariableValue
{
VariableValue * value = _default_value[var_name];
if (value == NULL)
{
value = new VariableValue(_coupleable_max_qps, _coupleable_params.defaultCoupledValue(var_name));
_default_value[var_name] = value;
}
return *_default_value[var_name];
}
coupledCallback(var_name, false);
MooseVariable * var = getVar(var_name, comp);
return (_c_is_implicit) ? var->nodalValue() : var->nodalValueOld();
}