52 template <
typename Derived>
192 template <
typename Derived>
200 template <
typename Derived>
213 template <
typename Derived>
217 ::Kokkos::RangePolicy<ResidualLoop, ExecSpace, ::Kokkos::IndexType<ThreadID>> policy(
218 0, numKokkosBoundarySides());
219 ::Kokkos::parallel_for(policy, *static_cast<Derived *>(
this));
223 template <
typename Derived>
227 if (!defaultJacobian())
229 ::Kokkos::RangePolicy<JacobianLoop, ExecSpace, ::Kokkos::IndexType<ThreadID>> policy(
230 0, numKokkosBoundarySides());
231 ::Kokkos::parallel_for(policy, *static_cast<Derived *>(
this));
235 if (!defaultOffDiagJacobian())
237 auto & sys = kokkosSystem(_kokkos_var.sys());
239 _thread.resize({sys.getCoupling(_kokkos_var.var()).size(), numKokkosBoundarySides()});
241 ::Kokkos::RangePolicy<OffDiagJacobianLoop, ExecSpace, ::Kokkos::IndexType<ThreadID>> policy(
243 ::Kokkos::parallel_for(policy, *static_cast<Derived *>(
this));
248 template <
typename Derived>
252 auto bc =
static_cast<const Derived *
>(
this);
253 auto [elem, side] = kokkosBoundaryElementSideID(tid);
256 elem, side, kokkosAssembly(), kokkosSystems(), _kokkos_var, _kokkos_var.var());
258 bc->computeResidualInternal(bc, datum);
261 template <
typename Derived>
265 auto bc =
static_cast<const Derived *
>(
this);
266 auto [elem, side] = kokkosBoundaryElementSideID(tid);
269 elem, side, kokkosAssembly(), kokkosSystems(), _kokkos_var, _kokkos_var.var());
271 bc->computeJacobianInternal(bc, datum);
274 template <
typename Derived>
278 auto bc =
static_cast<const Derived *
>(
this);
279 auto [elem, side] = kokkosBoundaryElementSideID(_thread(tid, 1));
281 auto & sys = kokkosSystem(_kokkos_var.sys());
282 auto jvar = sys.getCoupling(_kokkos_var.var())[_thread(tid, 0)];
284 if (!sys.isVariableActive(jvar, kokkosMesh().getElementInfo(elem).subdomain))
287 ResidualDatum datum(elem, side, kokkosAssembly(), kokkosSystems(), _kokkos_var, jvar);
289 bc->computeOffDiagJacobianInternal(bc, datum);
292 template <
typename Derived>
296 ResidualObject::computeResidualInternal(
298 [&](
Real * local_re,
const unsigned int ib,
const unsigned int ie)
300 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
304 for (
unsigned int i = ib; i < ie; ++i)
305 local_re[i] += datum.
JxW(qp) * bc->computeQpResidual(i, qp, datum);
310 template <
typename Derived>
314 ResidualObject::computeJacobianInternal(
316 [&](
Real * local_ke,
const unsigned int ijb,
const unsigned int ije)
318 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
322 for (
unsigned int ij = ijb; ij < ije; ++ij)
324 unsigned int i = ij % datum.
n_jdofs();
325 unsigned int j = ij / datum.
n_jdofs();
327 local_ke[ij] += datum.
JxW(qp) * bc->computeQpJacobian(i, j, qp, datum);
333 template <
typename Derived>
338 ResidualObject::computeJacobianInternal(
340 [&](
Real * local_ke,
const unsigned int ijb,
const unsigned int ije)
342 for (
unsigned int qp = 0; qp < datum.
n_qps(); ++qp)
346 for (
unsigned int ij = ijb; ij < ije; ++ij)
348 unsigned int i = ij % datum.
n_jdofs();
349 unsigned int j = ij / datum.
n_jdofs();
352 datum.
JxW(qp) * bc->computeQpOffDiagJacobian(i, j, datum.
jvar(), qp, datum);
361 #define usingKokkosIntegratedBCMembers(T) \ 362 usingKokkosIntegratedBCBaseMembers; \ 365 using Moose::Kokkos::IntegratedBC<T>::_test; \ 366 using Moose::Kokkos::IntegratedBC<T>::_grad_test; \ 367 using Moose::Kokkos::IntegratedBC<T>::_phi; \ 368 using Moose::Kokkos::IntegratedBC<T>::_grad_phi; \ 369 using Moose::Kokkos::IntegratedBC<T>::_u; \ 370 using Moose::Kokkos::IntegratedBC<T>::_grad_u; \ 373 using Moose::Kokkos::IntegratedBC<T>::operator()
KOKKOS_FUNCTION unsigned int n_jdofs() const
Get the number of local DOFs for the coupled variable.
const VariableGradient _grad_u
Gradient of the current solution at quadrature points.
KOKKOS_FUNCTION Real computeQpOffDiagJacobian(const unsigned int, const unsigned int, const unsigned int, const unsigned int, ResidualDatum &) const
Compute off-diagonal Jacobian contribution on a quadrature point.
The base class for a user to derive their own Kokkos integrated boundary conditions.
KOKKOS_FUNCTION void computeOffDiagJacobianInternal(const Derived *bc, ResidualDatum &datum) const
Compute off-diagonal Jacobian.
const InputParameters & parameters() const
Get the parameters of the object.
KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int, const unsigned int, const unsigned int, ResidualDatum &) const
Default methods to prevent compile errors even when these methods were not defined in the derived cla...
The base class for Kokkos integrated boundary conditions.
IntegratedBC(const InputParameters ¶meters)
Constructor.
const VariableTestValue _test
Current test function.
The Kokkos wrapper classes for MOOSE-like shape function access.
const VariablePhiValue _phi
Current shape function.
virtual void computeJacobian() override
Compute this object's contribution to the diagonal Jacobian entries.
virtual bool defaultJacobian() const
Get whether computeQpJacobian() was not defined in the derived class.
virtual void computeResidual() override
Dispatch residual calculation.
virtual void computeJacobian() override
Dispatch diagonal and off-diagonal Jacobian calculation.
KOKKOS_FUNCTION unsigned int n_qps() const
Get the number of local quadrature points.
static InputParameters validParams()
KOKKOS_FUNCTION void computeResidualInternal(const Derived *bc, ResidualDatum &datum) const
The parallel computation bodies that can be customized in the derived class by defining them in the d...
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
const VariableTestGradient _grad_test
Gradient of the current test function.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
KOKKOS_FUNCTION void computeJacobianInternal(const Derived *bc, ResidualDatum &datum) const
Compute diagonal Jacobian.
virtual void computeResidual() override
Compute this object's contribution to the residual.
KOKKOS_FUNCTION Real JxW(const unsigned int qp)
Get the transformed Jacobian weight.
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
static InputParameters validParams()
const VariablePhiGradient _grad_phi
Gradient of the current shape function.
virtual bool defaultOffDiagJacobian() const
Get whether computeQpOffDiagJacobian() was not defined in the derived class.
The Kokkos wrapper classes for MOOSE-like variable value access.
const VariableValue _u
Current solution at quadrature points.
KOKKOS_FUNCTION unsigned int jvar() const
Get the coupled variable number.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos residual object...
KOKKOS_FUNCTION void reinit()
Reset the reinit flag.
KOKKOS_FUNCTION void operator()(ResidualLoop, const ThreadID tid) const
The parallel computation entry functions called by Kokkos.