Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "KokkosResidualObject.h" 11 : 12 : #include "FEProblemBase.h" 13 : 14 : namespace Moose::Kokkos 15 : { 16 : 17 : InputParameters 18 104354 : ResidualObject::validParams() 19 : { 20 104354 : auto params = ::ResidualObject::validParams(); 21 : 22 320032 : params.addParam<bool>("use_displaced_mesh", 23 194768 : false, 24 : "Whether or not this object should use the " 25 : "displaced mesh for computation. Note that in " 26 : "the case this is true but no displacements " 27 : "are provided in the Mesh block the " 28 : "undisplaced mesh will still be used."); 29 : 30 417416 : params.addParamNamesToGroup("use_displaced_mesh", "Advanced"); 31 313062 : params.addCoupledVar("displacements", "The displacements"); 32 : 33 104354 : params.addPrivateParam<bool>(MooseBase::kokkos_object_param, true); 34 : 35 104354 : return params; 36 0 : } 37 : 38 7553 : ResidualObject::ResidualObject(const InputParameters & parameters, 39 : Moose::VarFieldType field_type, 40 14467 : bool nodal) 41 : : ::ResidualObject(parameters, nodal), 42 4096 : MeshHolder(*_fe_problem.mesh().getKokkosMesh()), 43 4096 : AssemblyHolder(_fe_problem.kokkosAssembly()), 44 4096 : FESystemHolder(_fe_problem.getKokkosFESystems()), 45 12288 : _var(_subproblem.getVariable(_tid, 46 4096 : getParam<NonlinearVariableName>("variable"), 47 : Moose::VarKindType::VAR_SOLVER, 48 : field_type)), 49 4096 : _t(TransientInterface::_t), 50 4096 : _t_old(TransientInterface::_t_old), 51 4096 : _t_step(TransientInterface::_t_step), 52 4096 : _dt(TransientInterface::_dt), 53 16384 : _dt_old(TransientInterface::_dt_old) 54 : { 55 7553 : if (_var.isVector()) 56 0 : paramError("variable", "Kokkos residual objects do not support vector variables yet."); 57 : 58 7553 : _kokkos_var.init(_var); 59 7553 : } 60 : 61 390296 : ResidualObject::ResidualObject(const ResidualObject & object) 62 : : ::ResidualObject(object, {}), 63 : MeshHolder(object), 64 : AssemblyHolder(object), 65 : FESystemHolder(object), 66 221225 : _var(object._var), 67 221225 : _kokkos_var(object._kokkos_var), 68 221225 : _thread(object._thread), 69 221225 : _t(object._t), 70 221225 : _t_old(object._t_old), 71 221225 : _t_step(object._t_step), 72 221225 : _dt(object._dt), 73 221225 : _dt_old(object._dt_old), 74 221225 : _vector_tags(object._vector_tags), 75 442450 : _matrix_tags(object._matrix_tags) 76 : { 77 : // Tags may be added to the governing tag sets held by the TaggingInterface later than the time 78 : // that the primary constructor is run. So it's more robust to build our tag set, immediately 79 : // before being dispatched to device, from the governing TaggingInterface set instead of relying 80 : // on copying the tag set from object's \p _vector_tags and \p _matrix_tags arrays 81 390296 : _vector_tags = object.getVectorTags({}); 82 390296 : _matrix_tags = object.getMatrixTags({}); 83 390296 : } 84 : 85 : } // namespace Moose::Kokkos