Esempio n. 1
0
void
AuxiliarySystem::jacobianSetup()
{
  for (unsigned int i=0; i<libMesh::n_threads(); i++)
  {
    _auxs(EXEC_JACOBIAN)[i].jacobianSetup();
    _auxs(EXEC_RESIDUAL)[i].jacobianSetup();
  }
}
void
AuxiliarySystem::jacobianSetup()
{
  for (unsigned int i=0; i<libMesh::n_threads(); i++)
  {
    _auxs(EXEC_NONLINEAR)[i].jacobianSetup();
    _auxs(EXEC_LINEAR)[i].jacobianSetup();
  }
}
bool
AuxiliarySystem::needMaterialOnSide(BoundaryID bnd_id)
{
  for (unsigned int i=0; i < Moose::exec_types.size(); ++i)
    if (!_auxs(Moose::exec_types[i])[0].elementalBCs(bnd_id).empty() ||
        !_auxs(Moose::exec_types[i])[0].elementalBCs(Moose::ANY_BOUNDARY_ID).empty())
      return true;

  return false;
}
void
AuxiliarySystem::timestepSetup()
{
  for (unsigned int i=0; i<libMesh::n_threads(); i++)
  {
    _auxs(EXEC_TIMESTEP_BEGIN)[i].timestepSetup();
    _auxs(EXEC_TIMESTEP_END)[i].timestepSetup();
    _auxs(EXEC_NONLINEAR)[i].timestepSetup();
    _auxs(EXEC_LINEAR)[i].timestepSetup();
  }
}
Esempio n. 5
0
void
AuxiliarySystem::timestepSetup()
{
  for (unsigned int i=0; i<libMesh::n_threads(); i++)
  {
    _auxs(EXEC_TIMESTEP_BEGIN)[i].timestepSetup();
    _auxs(EXEC_TIMESTEP)[i].timestepSetup();
    _auxs(EXEC_JACOBIAN)[i].timestepSetup();
    _auxs(EXEC_RESIDUAL)[i].timestepSetup();
  }
}
void
AuxiliarySystem::computeScalarVars(ExecFlagType type)
{
  Moose::perf_log.push("update_aux_vars_scalar()","Solve");

  std::vector<AuxWarehouse> & auxs = _auxs(type);
  PARALLEL_TRY {
    // FIXME: run multi-threaded
    THREAD_ID tid = 0;
    if (auxs[tid].scalars().size() > 0)
    {
      _mproblem.reinitScalars(tid);

      const std::vector<AuxScalarKernel *> & scalars = auxs[tid].scalars();
      for (std::vector<AuxScalarKernel *>::const_iterator it = scalars.begin(); it != scalars.end(); ++it)
      {
        AuxScalarKernel * kernel = *it;
        kernel->compute();
      }

      const std::vector<MooseVariableScalar *> & scalar_vars = getScalarVariables(tid);
      for (std::vector<MooseVariableScalar *>::const_iterator it = scalar_vars.begin(); it != scalar_vars.end(); ++it)
      {
        MooseVariableScalar * var = *it;
        var->insert(solution());
      }
    }
  }
  PARALLEL_CATCH;
  Moose::perf_log.pop("update_aux_vars_scalar()","Solve");

  solution().close();
  _sys.update();
}
void
AuxiliarySystem::addKernel(const std::string & kernel_name, const std::string & name, InputParameters parameters)
{
  parameters.set<AuxiliarySystem *>("_aux_sys") = this;
  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
  {
    parameters.set<THREAD_ID>("_tid") = tid;

    MooseSharedPointer<AuxKernel> kernel = MooseSharedNamespace::static_pointer_cast<AuxKernel>(_factory.create(kernel_name, name, parameters));

    // Add this AuxKernel to multiple ExecStores
    const std::vector<ExecFlagType> & exec_flags = kernel->execFlags();
    for (unsigned int i=0; i<exec_flags.size(); ++i)
      _auxs(exec_flags[i])[tid].addAuxKernel(kernel);

    _mproblem._objects_by_name[tid][name].push_back(kernel.get());

    if (kernel->boundaryRestricted())
    {
      const std::set<BoundaryID> & boundary_ids = kernel->boundaryIDs();
      for (std::set<BoundaryID>::const_iterator it = boundary_ids.begin(); it != boundary_ids.end(); ++it)
        _vars[tid].addBoundaryVar(*it, &kernel->variable());
    }
  }
}
std::set<std::string>
AuxiliarySystem::getDependObjects(ExecFlagType type)
{
  std::set<std::string> depend_objects;

  const std::vector<AuxKernel *> & auxs = _auxs(type)[0].all();
  for (std::vector<AuxKernel *>::const_iterator it = auxs.begin(); it != auxs.end(); ++it)
  {
    const std::set<std::string> & uo = (*it)->getDependObjects();
    depend_objects.insert(uo.begin(), uo.end());
  }
  return depend_objects;
}
void
AuxiliarySystem::addScalarKernel(const std::string & kernel_name, const std::string & name, InputParameters parameters)
{
  for (THREAD_ID tid = 0; tid < libMesh::n_threads(); tid++)
  {
    parameters.set<THREAD_ID>("_tid") = tid;

    MooseSharedPointer<AuxScalarKernel> kernel = MooseSharedNamespace::static_pointer_cast<AuxScalarKernel>(_factory.create(kernel_name, name, parameters));

    // Add this AuxKernel to multiple ExecStores
    const std::vector<ExecFlagType> & exec_flags = kernel->execFlags();
    for (unsigned int i=0; i<exec_flags.size(); ++i)
      _auxs(exec_flags[i])[tid].addScalarKernel(kernel);

    _mproblem._objects_by_name[tid][name].push_back(kernel.get());
  }
}
Esempio n. 10
0
void
AuxiliarySystem::computeNodalVars(ExecFlagType type)
{
  std::vector<AuxWarehouse> & auxs = _auxs(type);

  // Do we have some kernels to evaluate?
  bool have_block_kernels = false;
  for (std::set<SubdomainID>::const_iterator subdomain_it = _mesh.meshSubdomains().begin();
      subdomain_it != _mesh.meshSubdomains().end();
      ++subdomain_it)
  {
    have_block_kernels |= (auxs[0].activeBlockNodalKernels(*subdomain_it).size() > 0);
  }

  Moose::perf_log.push("update_aux_vars_nodal()","Solve");
  PARALLEL_TRY {
    if (have_block_kernels)
    {
      ConstNodeRange & range = *_mesh.getLocalNodeRange();
      ComputeNodalAuxVarsThread navt(_mproblem, *this, auxs);
      Threads::parallel_reduce(range, navt);

      solution().close();
      _sys.update();
    }
  }
  PARALLEL_CATCH;
  Moose::perf_log.pop("update_aux_vars_nodal()","Solve");

  //Boundary AuxKernels
  Moose::perf_log.push("update_aux_vars_nodal_bcs()","Solve");
  PARALLEL_TRY {
    // after converting this into NodeRange, we can run it in parallel
    ConstBndNodeRange & bnd_nodes = *_mesh.getBoundaryNodeRange();
    ComputeNodalAuxBcsThread nabt(_mproblem, *this, auxs);
    Threads::parallel_reduce(bnd_nodes, nabt);

    solution().close();
    _sys.update();
  }
  PARALLEL_CATCH;
  Moose::perf_log.pop("update_aux_vars_nodal_bcs()","Solve");
}
Esempio n. 11
0
void
AuxiliarySystem::computeElementalVars(ExecFlagType type)
{
  Moose::perf_log.push("update_aux_vars_elemental()","Solve");

  std::vector<AuxWarehouse> & auxs = _auxs(type);
  bool need_materials = true; //type != EXEC_INITIAL;

  PARALLEL_TRY {
    bool element_auxs_to_compute = false;

    for (unsigned int i=0; i<auxs.size(); i++)
      element_auxs_to_compute |= auxs[i].allElementKernels().size();

    if (element_auxs_to_compute)
    {
      ConstElemRange & range = *_mesh.getActiveLocalElementRange();
      ComputeElemAuxVarsThread eavt(_mproblem, *this, auxs, need_materials);
      Threads::parallel_reduce(range, eavt);

      solution().close();
      _sys.update();
    }

    bool bnd_auxs_to_compute = false;
    for (unsigned int i=0; i<auxs.size(); i++)
      bnd_auxs_to_compute |= auxs[i].allElementalBCs().size();
    if (bnd_auxs_to_compute)
    {
      ConstBndElemRange & bnd_elems = *_mesh.getBoundaryElementRange();
      ComputeElemAuxBcsThread eabt(_mproblem, *this, auxs, need_materials);
      Threads::parallel_reduce(bnd_elems, eabt);

      solution().close();
      _sys.update();
    }

  }
  PARALLEL_CATCH;
  Moose::perf_log.pop("update_aux_vars_elemental()","Solve");
}
Esempio n. 12
0
void
AuxiliarySystem::residualSetup()
{
  for (unsigned int i=0; i<libMesh::n_threads(); i++)
    _auxs(EXEC_LINEAR)[i].residualSetup();
}