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 : #pragma once 11 : 12 : #include "KokkosKernelValue.h" 13 : 14 : /** 15 : * Implements a source term proportional to the value of a coupled variable. Weak form: $(\\psi_i, 16 : * -\\sigma v)$. 17 : */ 18 : class KokkosCoupledForce : public Moose::Kokkos::KernelValue 19 : { 20 : public: 21 : static InputParameters validParams(); 22 : 23 : KokkosCoupledForce(const InputParameters & parameters); 24 : 25 : template <typename Derived> 26 : KOKKOS_FUNCTION Real computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const; 27 : 28 : private: 29 : /// Coupled variable number 30 : const unsigned int _v_var; 31 : /// Coupled variable 32 : const Moose::Kokkos::VariableValue _v; 33 : /// Multiplier for the coupled force term 34 : const Real _coef; 35 : }; 36 : 37 : template <typename Derived> 38 : KOKKOS_FUNCTION Real 39 248640 : KokkosCoupledForce::computeQpResidual(const unsigned int qp, AssemblyDatum & datum) const 40 : { 41 248640 : return -_coef * _v(datum, qp); 42 : }