https://mooseframework.inl.gov
Loading...
Searching...
No Matches
KokkosMatCoupledForce.h
Go to the documentation of this file.
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#pragma once
11
12#include "KokkosKernelValue.h"
13#include "KokkosMap.h"
14
22{
23public:
25
27
28 template <typename Derived>
29 KOKKOS_FUNCTION Real precomputeQpResidual(const unsigned int qp, AssemblyDatum & datum) const;
30 template <typename Derived>
31 KOKKOS_FUNCTION Real precomputeQpOffDiagJacobian(const unsigned int j,
32 const unsigned int jvar,
33 const unsigned int qp,
34 AssemblyDatum & datum) const;
35
36private:
37 const unsigned int _n_coupled;
38 const bool _coupled_props;
39 std::vector<unsigned int> _v_var;
44};
45
46template <typename Derived>
47KOKKOS_FUNCTION Real
49{
50 Real r = 0;
52 for (unsigned int j = 0; j < _n_coupled; ++j)
53 r += -_coef[j] * _mat_props[j](datum, qp) * _v(datum, qp, j);
54 else
55 for (unsigned int j = 0; j < _n_coupled; ++j)
56 r += -_coef[j] * _v(datum, qp, j);
57 return r;
58}
59
60template <typename Derived>
61KOKKOS_FUNCTION Real
63 const unsigned int jvar,
64 const unsigned int qp,
65 AssemblyDatum & datum) const
66{
67 if (!_v_var_to_index.exists(jvar))
68 return 0;
69
70 unsigned int p = _v_var_to_index[jvar];
71
73 return -_coef[p] * _mat_props[p](datum, qp) * _phi(datum, j, qp);
74 return -_coef[p] * _phi(datum, j, qp);
75}
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Represents a right hand side force term of the form Sum_j c_j * m_j * v_j, where c is a vector of rea...
KOKKOS_FUNCTION Real precomputeQpOffDiagJacobian(const unsigned int j, const unsigned int jvar, const unsigned int qp, AssemblyDatum &datum) const
Moose::Kokkos::Map< unsigned int, unsigned int > _v_var_to_index
std::vector< unsigned int > _v_var
static InputParameters validParams()
const Moose::Kokkos::VariableValue _v
Moose::Kokkos::Array< Moose::Kokkos::MaterialProperty< Real > > _mat_props
const unsigned int _n_coupled
KOKKOS_FUNCTION Real precomputeQpResidual(const unsigned int qp, AssemblyDatum &datum) const
KokkosMatCoupledForce(const InputParameters &parameters)
Moose::Kokkos::Array< Real > _coef
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
The Kokkos array class.
The Kokkos object that holds thread-private data in the parallel operations of Kokkos kernels.
The base class for a user to derive their own Kokkos kernels where the residual is of the form.
const VariablePhiValue _phi
Current shape function.
The Kokkos wrapper class for standard map.
Definition KokkosMap.h:72
The Kokkos wrapper classes for MOOSE-like variable value access.