예제 #1
0
std::set<SubdomainID>
BlockRestrictable::variableSubdomainIDs(const InputParameters & parameters) const
{
  // This method may be called before initializing the object. It doesn't use
  // any information from the class state.

  // Return an empty set if _sys is not defined
  if (!parameters.isParamValid("_sys"))
    return std::set<SubdomainID>();

  // Get the SystemBase and the thread id
  SystemBase* sys = parameters.get<SystemBase *>("_sys");
  THREAD_ID tid = parameters.get<THREAD_ID>("_tid");

  // Pointer to MooseVariable
  MooseVariable * var = NULL;

  // Get the variable based on the type
  if (parameters.have_parameter<NonlinearVariableName>("variable"))
    var = &_blk_feproblem->getVariable(tid, parameters.get<NonlinearVariableName>("variable"));
  else if (parameters.have_parameter<AuxVariableName>("variable"))
    var = &_blk_feproblem->getVariable(tid, parameters.get<AuxVariableName>("variable"));
  else
    mooseError("Unknown variable.");

  // Return the block ids for the variable
  return sys->getSubdomainsForVar(var->number());
}
예제 #2
0
/// Free function used for a libMesh callback
void extraSparsity(SparsityPattern::Graph & sparsity,
                   std::vector<dof_id_type> & n_nz,
                   std::vector<dof_id_type> & n_oz,
                   void * context)
{
  SystemBase * sys = static_cast<SystemBase *>(context);
  sys->augmentSparsity(sparsity, n_nz, n_oz);
}
예제 #3
0
MooseVariableBase::MooseVariableBase(unsigned int var_num, SystemBase & sys, Assembly & assembly, Moose::VarKindType var_kind) :
    _var_num(var_num),
    _var_kind(var_kind),
    _subproblem(sys.subproblem()),
    _sys(sys),
    _variable(sys.system().variable(_var_num)),
    _assembly(assembly),
    _dof_map(sys.dofMap()),
    _scaling_factor(1.0)
{
}
예제 #4
0
void
dataLoad(std::istream & stream, SystemBase & system_base, void * context)
{
  System & libmesh_system = system_base.system();

  NumericVector<Real> & solution = *(libmesh_system.solution.get());

  dataLoad(stream, solution, context);

  for (System::vectors_iterator it = libmesh_system.vectors_begin();
       it != libmesh_system.vectors_end();
       it++)
    dataLoad(stream, *(it->second), context);

  system_base.update();
}
예제 #5
0
MooseVariableBase::MooseVariableBase(unsigned int var_num,
                                     const FEType & fe_type,
                                     SystemBase & sys,
                                     Moose::VarKindType var_kind,
                                     THREAD_ID tid)
  : _var_num(var_num),
    _fe_type(fe_type),
    _var_kind(var_kind),
    _subproblem(sys.subproblem()),
    _sys(sys),
    _variable(sys.system().variable(_var_num)),
    _dof_map(sys.dofMap()),
    _mesh(_subproblem.mesh()),
    _scaling_factor(1.0),
    _computing_jacobian(false),
    _tid(tid)
{
}
예제 #6
0
파일: Assembly.C 프로젝트: Jieun2/moose
Assembly::Assembly(SystemBase & sys, CouplingMatrix * & cm, THREAD_ID tid) :
    _sys(sys),
    _cm(cm),
    _dof_map(_sys.dofMap()),
    _tid(tid),
    _mesh(sys.mesh()),
    _mesh_dimension(_mesh.dimension()),
    _current_qrule(NULL),
    _current_qrule_volume(NULL),
    _current_qrule_arbitrary(NULL),
    _current_qrule_face(NULL),
    _current_qface_arbitrary(NULL),
    _current_qrule_neighbor(NULL),

    _current_elem(NULL),
    _current_side(0),
    _current_side_elem(NULL),
    _current_neighbor_elem(NULL),
    _current_neighbor_side(0),
    _current_node(NULL),
    _current_neighbor_node(NULL),

    _should_use_fe_cache(false),
    _currently_fe_caching(true),

    _cached_residual_values(2), // The 2 is for TIME and NONTIME
    _cached_residual_rows(2), // The 2 is for TIME and NONTIME

    _max_cached_residuals(0),
    _max_cached_jacobians(0),
    _block_diagonal_matrix(false)
{
  // Build fe's for the helpers
  getFE(FEType(FIRST, LAGRANGE));
  getFEFace(FEType(FIRST, LAGRANGE));

  // Build an FE helper object for this type for each dimension up to the dimension of the current mesh
  for(unsigned int dim=1; dim<=_mesh_dimension; dim++)
  {
    _holder_fe_helper[dim] = &_fe[dim][FEType(FIRST, LAGRANGE)];
    (*_holder_fe_helper[dim])->get_phi();
    (*_holder_fe_helper[dim])->get_dphi();
    (*_holder_fe_helper[dim])->get_xyz();
    (*_holder_fe_helper[dim])->get_JxW();

    _holder_fe_face_helper[dim] = &_fe_face[dim][FEType(FIRST, LAGRANGE)];
    (*_holder_fe_face_helper[dim])->get_phi();
    (*_holder_fe_face_helper[dim])->get_dphi();
    (*_holder_fe_face_helper[dim])->get_xyz();
    (*_holder_fe_face_helper[dim])->get_JxW();
    (*_holder_fe_face_helper[dim])->get_normals();
  }
}
예제 #7
0
void
CopyNodalVarsAction::act()
{
  if (isParamValid("initial_from_file_var"))
  {
    SystemBase * system;

    if (_current_task == "check_copy_nodal_vars")
      _app.setFileRestart() = true;
    else
    {
      // Is this a NonlinearSystem variable or an AuxiliarySystem variable?
      if (_current_task == "copy_nodal_vars")
        system = &_problem->getNonlinearSystem();
      else
        system = &_problem->getAuxiliarySystem();

      system->addVariableToCopy(getShortName(), getParam<std::string>("initial_from_file_var"), getParam<int>("initial_from_file_timestep"));
    }
  }
}
예제 #8
0
ComputeUserObjectsThread::ComputeUserObjectsThread(
    FEProblemBase & problem,
    SystemBase & sys,
    const MooseObjectWarehouse<ElementUserObject> & elemental_user_objects,
    const MooseObjectWarehouse<SideUserObject> & side_user_objects,
    const MooseObjectWarehouse<InternalSideUserObject> & internal_side_user_objects)
  : ThreadedElementLoop<ConstElemRange>(problem),
    _soln(*sys.currentSolution()),
    _elemental_user_objects(elemental_user_objects),
    _side_user_objects(side_user_objects),
    _internal_side_user_objects(internal_side_user_objects)
{
}
예제 #9
0
		void SystemBase::ComponentMakeupChanged(Entity *e, uint64 oldFlags, uint64 newFlags)
		{
			const uint32 count = systems.size();
			for(uint32 i = 0; i < count; i++) {
				SystemBase *s = systems[i];
				if(s->CompatibleWith(newFlags)) {
					if(!s->CompatibleWith(oldFlags)) {
						// Became compatible
						s->Add(e);
					}
				} else {
					if(s->CompatibleWith(oldFlags)) {
						// Became incompatible
						s->Remove(e);
					}
				}
			}
		}
예제 #10
0
/// Free function used for a libMesh callback
void extraSendList(std::vector<dof_id_type> & send_list, void * context)
{
  SystemBase * sys = static_cast<SystemBase *>(context);
  sys->augmentSendList(send_list);
}