Line data Source code
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 : 10 : #include "ComputeBoundaryInitialConditionThread.h" 11 : 12 : // MOOSE includes 13 : #include "Assembly.h" 14 : #include "InitialCondition.h" 15 : #include "MooseVariableFE.h" 16 : #include "SystemBase.h" 17 : 18 55822 : ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread( 19 55822 : FEProblemBase & fe_problem) 20 55822 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem) 21 : { 22 55822 : } 23 : 24 5729 : ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread( 25 5729 : ComputeBoundaryInitialConditionThread & x, Threads::split split) 26 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split), 27 5729 : _target_vars(x._target_vars) 28 : { 29 5729 : } 30 : 31 2037 : ComputeBoundaryInitialConditionThread::ComputeBoundaryInitialConditionThread( 32 2037 : FEProblemBase & fe_problem, const std::set<VariableName> * target_vars) 33 : : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem), 34 2037 : _target_vars(target_vars) 35 : { 36 2037 : } 37 : 38 : void 39 4208351 : ComputeBoundaryInitialConditionThread::onNode(ConstBndNodeRange::const_iterator & nd) 40 : { 41 4208351 : const BndNode * bnode = *nd; 42 : 43 4208351 : Node * node = bnode->_node; 44 4208351 : BoundaryID boundary_id = bnode->_bnd_id; 45 : 46 8374065 : for (const auto nl_sys_num : make_range(_fe_problem.numNonlinearSystems())) 47 4165714 : _fe_problem.assembly(_tid, nl_sys_num).reinit(node); 48 : 49 4208351 : const InitialConditionWarehouse & warehouse = _fe_problem.getInitialConditionWarehouse(); 50 : 51 4208351 : if (warehouse.hasActiveBoundaryObjects(boundary_id, _tid)) 52 : { 53 100 : const auto & ics = warehouse.getActiveBoundaryObjects(boundary_id, _tid); 54 200 : for (const auto & ic : ics) 55 : { 56 : // Skip or include initial conditions based on target variable usage 57 100 : const auto & var_name = ic->variable().name(); 58 100 : if (_target_vars && !_target_vars->count(var_name)) 59 0 : continue; 60 : 61 100 : if (node->processor_id() == _fe_problem.processor_id()) 62 80 : ic->computeNodal(*node); 63 : } 64 : } 65 4208351 : } 66 : 67 : void 68 5729 : ComputeBoundaryInitialConditionThread::join(const ComputeBoundaryInitialConditionThread & /*y*/) 69 : { 70 5729 : }