- variableThe name of the variable that this residual object operates on
C++ Type:NonlinearVariableName
Unit:(no unit assumed)
Controllable:No
Description:The name of the variable that this residual object operates on
KokkosDiffusion
This is the Kokkos version of Diffusion. See the original document for details.
Example Syntax
[diff]
type = KokkosDiffusion
variable = u
[](test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_test.i)Input Parameters
- blockThe list of blocks (ids or names) that this object will be applied
C++ Type:std::vector<SubdomainName>
Controllable:No
Description:The list of blocks (ids or names) that this object will be applied
- displacementsThe displacements
C++ Type:std::vector<VariableName>
Unit:(no unit assumed)
Controllable:No
Description:The displacements
- matrix_onlyFalseWhether this object is only doing assembly to matrices (no vectors)
Default:False
C++ Type:bool
Controllable:No
Description:Whether this object is only doing assembly to matrices (no vectors)
Optional Parameters
- absolute_value_vector_tagsThe tags for the vectors this residual object should fill with the absolute value of the residual contribution
C++ Type:std::vector<TagName>
Controllable:No
Description:The tags for the vectors this residual object should fill with the absolute value of the residual contribution
- extra_matrix_tagsThe extra tags for the matrices this Kernel should fill
C++ Type:std::vector<TagName>
Controllable:No
Description:The extra tags for the matrices this Kernel should fill
- extra_vector_tagsThe extra tags for the vectors this Kernel should fill
C++ Type:std::vector<TagName>
Controllable:No
Description:The extra tags for the vectors this Kernel should fill
- matrix_tagssystemThe tag for the matrices this Kernel should fill
Default:system
C++ Type:MultiMooseEnum
Options:nontime, system
Controllable:No
Description:The tag for the matrices this Kernel should fill
- vector_tagsnontimeThe tag for the vectors this Kernel should fill
Default:nontime
C++ Type:MultiMooseEnum
Options:nontime, time
Controllable:No
Description:The tag for the vectors this Kernel should fill
Contribution To Tagged Field Data Parameters
- control_tagsAdds user-defined labels for accessing object parameters via control logic.
C++ Type:std::vector<std::string>
Controllable:No
Description:Adds user-defined labels for accessing object parameters via control logic.
- enableTrueSet the enabled status of the MooseObject.
Default:True
C++ Type:bool
Controllable:Yes
Description:Set the enabled status of the MooseObject.
- implicitTrueDetermines whether this object is calculated using an implicit or explicit form
Default:True
C++ Type:bool
Controllable:No
Description:Determines whether this object is calculated using an implicit or explicit form
- seed0The seed for the master random number generator
Default:0
C++ Type:unsigned int
Controllable:No
Description:The seed for the master random number generator
- use_displaced_meshFalseWhether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Default:False
C++ Type:bool
Controllable:No
Description:Whether or not this object should use the displaced mesh for computation. Note that in the case this is true but no displacements are provided in the Mesh block the undisplaced mesh will still be used.
Advanced Parameters
- prop_getter_suffixAn optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
C++ Type:MaterialPropertyName
Unit:(no unit assumed)
Controllable:No
Description:An optional suffix parameter that can be appended to any attempt to retrieve/get material properties. The suffix will be prepended with a '_' character.
- use_interpolated_stateFalseFor the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Default:False
C++ Type:bool
Controllable:No
Description:For the old and older state use projected material properties interpolated at the quadrature points. To set up projection use the ProjectedStatefulMaterialStorageAction.
Material Property Retrieval Parameters
Input Files
- (test/tests/kokkos/bcs/misc_bcs/kokkos_vacuum_bc_test.i)
- (test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_test.i)
- (test/tests/kokkos/nodalkernels/constraint_enforcement/kokkos_lower_bound.i)
- (test/tests/kokkos/tag/kokkos_tag_neumann.i)
- (test/tests/kokkos/bcs/matched_value_bc/kokkos_matched_value_bc_test.i)
- (modules/heat_transfer/test/tests/kokkos/kokkos_coupled_convective_heat_flux.i)
- (test/tests/kokkos/materials/error/kokkos_multid.i)
- (test/tests/kokkos/tag/kokkos_tag_residual_call.i)
- (test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_bodyforce_test.i)
- (test/tests/kokkos/bcs/coupled_var_neumann/kokkos_coupled_var_neumann.i)
- (test/tests/kokkos/nodalkernels/constraint_enforcement/kokkos_upper_and_lower_bound.i)
- (test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_neumannbc_test.i)
- (test/tests/kokkos/coord_type/kokkos_diffusion_rspherical.i)
- (test/tests/kokkos/nodalkernels/constraint_enforcement/kokkos_upper_bound.i)
- (test/tests/kokkos/kernels/block_kernel/kokkos_block_vars.i)
- (test/tests/kokkos/tag/kokkos_2d_diffusion_tag_vector.i)
- (test/tests/kokkos/bcs/misc_bcs/kokkos_convective_flux_bc.i)
- (test/tests/kokkos/bcs/pp_neumann/kokkos_pp_neumann.i)
- (test/tests/kokkos/tag/kokkos_2d_diffusion_tag_matrix.i)
- (test/tests/kokkos/petsc_gpu/kokkos_2d_diffusion_tag_vector.i)
- (test/tests/kokkos/bcs/1d_neumann/kokkos_1d_neumann.i)
- (test/tests/kokkos/nodalkernels/multiple_subdomains/kokkos_test.i)
- (test/tests/kokkos/coord_type/kokkos_diffusion_rz.i)
- (test/tests/kokkos/kernels/material_coupled_force/kokkos_material_coupled_force.i)
- (test/tests/kokkos/bcs/coupled_var_neumann/kokkos_on_off.i)
- (test/tests/kokkos/tag/kokkos_tag_nodal_kernels.i)
- (test/tests/kokkos/bcs/coupled_dirichlet_bc/kokkos_coupled_dirichlet_bc.i)
- (test/tests/kokkos/kernels/block_kernel/kokkos_block_kernel_test.i)
- (test/tests/kokkos/kernels/coupled_time_derivative/kokkos_coupled_time_derivative_test.i)
- (test/tests/kokkos/bcs/coupled_var_neumann/kokkos_coupled_var_neumann_nl.i)
- (test/tests/kokkos/tag/kokkos_2d_diffusion_matrix_tag_test.i)
Child Objects
(test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_test.i)
###########################################################
# This is a simple test of the KokkosKernel System.
# It solves the Laplacian equation on a small 2x2 grid.
# The "KokkosDiffusion" kernel is used to calculate the
# residuals of the weak form of this operator.
#
# @Requirement F3.30
###########################################################
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
active = 'diff'
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
# BCs cannot be preset due to Jacobian test
active = 'left right'
[left]
type = KokkosDirichletBC
variable = u
preset = false
boundary = 3
value = 0
[]
[right]
type = KokkosDirichletBC
variable = u
preset = false
boundary = 1
value = 1
[]
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/misc_bcs/kokkos_vacuum_bc_test.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
nz = 0
zmin = 0
zmax = 0
elem_type = QUAD4
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
active = 'diff'
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
active = 'left right top'
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0.0
[]
[right]
type = KokkosNeumannBC
variable = u
boundary = 1
value = 2.0
[]
[top]
type = KokkosVacuumBC
variable = u
boundary = 2
alpha = 5.0
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_test.i)
###########################################################
# This is a simple test of the KokkosKernel System.
# It solves the Laplacian equation on a small 2x2 grid.
# The "KokkosDiffusion" kernel is used to calculate the
# residuals of the weak form of this operator.
#
# @Requirement F3.30
###########################################################
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
active = 'diff'
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
# BCs cannot be preset due to Jacobian test
active = 'left right'
[left]
type = KokkosDirichletBC
variable = u
preset = false
boundary = 3
value = 0
[]
[right]
type = KokkosDirichletBC
variable = u
preset = false
boundary = 1
value = 1
[]
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/nodalkernels/constraint_enforcement/kokkos_lower_bound.i)
l=10
nx=100
num_steps=10
[Mesh]
type = GeneratedMesh
dim = 1
xmax = ${l}
nx = ${nx}
[]
[Variables]
[u]
[]
[lm]
[]
[]
[ICs]
[u]
type = FunctionIC
variable = u
function = '${l} - x'
[]
[]
[Kernels]
[time]
type = KokkosTimeDerivative
variable = u
[]
[diff]
type = KokkosDiffusion
variable = u
[]
[ffn]
type = KokkosBodyForce
variable = u
value = -1
[]
[]
[NodalKernels]
[positive_constraint]
type = KokkosLowerBoundNodalKernel
variable = lm
v = u
exclude_boundaries = 'left right'
[]
[forces]
type = KokkosCoupledForceNodalKernel
variable = u
v = lm
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
boundary = left
value = ${l}
variable = u
[]
[right]
type = KokkosDirichletBC
boundary = right
value = 0
variable = u
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
num_steps = ${num_steps}
solve_type = NEWTON
dtmin = 1
petsc_options_iname = '-snes_max_linear_solve_fail -ksp_max_it -pc_type -sub_pc_factor_levels -snes_linesearch_type'
petsc_options_value = '0 30 asm 16 basic'
[]
[Outputs]
exodus = true
[csv]
type = CSV
execute_on = 'nonlinear timestep_end'
[]
[dof]
type = DOFMap
execute_on = 'initial'
[]
[]
[Debug]
show_var_residual_norms = true
[]
[Postprocessors]
[active_lm]
type = GreaterThanLessThanPostprocessor
variable = lm
execute_on = 'nonlinear timestep_end'
value = 1e-8
[]
[violations]
type = GreaterThanLessThanPostprocessor
variable = u
execute_on = 'nonlinear timestep_end'
value = -1e-8
comparator = 'less'
[]
[]
(test/tests/kokkos/tag/kokkos_tag_neumann.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 10
construct_side_list_from_node_list = true
[]
[Variables]
[u]
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[]
[AuxVariables]
[tag_variable1]
order = FIRST
family = LAGRANGE
[]
[tag_variable2]
order = FIRST
family = LAGRANGE
[]
[]
[AuxKernels]
[TagVectorAux1]
type = TagVectorAux
variable = tag_variable1
v = u
vector_tag = vec_tag2
[]
[TagVectorAux2]
type = TagMatrixAux
variable = tag_variable2
v = u
matrix_tag = mat_tag2
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = left
value = 0
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[right]
type = KokkosNeumannBC
variable = u
boundary = right
value = 2
extra_vector_tags = 'vec_tag1 vec_tag2'
[]
[]
[Problem]
type = TagTestProblem
test_tag_vectors = 'nontime residual vec_tag1 vec_tag2'
test_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_vectors = 'vec_tag1 vec_tag2'
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/matched_value_bc/kokkos_matched_value_bc_test.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
# Solves a pair of coupled diffusion equations where u=v on the boundary
[Variables]
active = 'u v'
[u]
order = FIRST
family = LAGRANGE
initial_condition = 3
[]
[v]
order = FIRST
family = LAGRANGE
initial_condition = 2
[]
[]
[Kernels]
active = 'diff_u diff_v'
[diff_u]
type = KokkosDiffusion
variable = u
[]
[diff_v]
type = KokkosDiffusion
variable = v
[]
[]
[BCs]
active = 'right_v left_u'
[right_v]
type = KokkosDirichletBC
variable = v
boundary = 1
value = 3
[]
[left_u]
type = KokkosMatchedValueBC
variable = u
boundary = 3
v = v
[]
[]
[Preconditioning]
[precond]
type = SMP
full = true
[]
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
nl_rel_tol = 1e-10
l_tol = 1e-12
[]
[Outputs]
exodus = true
[]
(modules/heat_transfer/test/tests/kokkos/kokkos_coupled_convective_heat_flux.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Functions]
[T_infinity_fn]
type = ParsedFunction
expression = (x*x+y*y)+500
[]
[Hw_fn]
type = ParsedFunction
expression = ((1-x)*(1-x)+(1-y)*(1-y))+1000
[]
[]
[Variables]
[u]
[]
[]
[AuxVariables]
[T_infinity]
[]
[Hw]
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[force]
type = KokkosBodyForce
variable = u
value = 1000
[]
[]
[AuxKernels]
[T_infinity_ak]
type = FunctionAux
variable = T_infinity
function = T_infinity_fn
execute_on = initial
[]
[Hw_ak]
type = FunctionAux
variable = Hw
function = Hw_fn
execute_on = initial
[]
[]
[BCs]
[right]
type = KokkosCoupledConvectiveHeatFluxBC
variable = u
boundary = right
htc = Hw
T_infinity = T_infinity
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/materials/error/kokkos_multid.i)
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 2
nx = 10
ny = 1
[]
[left_domain]
input = gen
type = SubdomainBoundingBoxGenerator
bottom_left = '0 0 0'
top_right = '0.5 1 0'
block_id = 10
[]
[]
[Variables]
[u]
initial_condition = 2
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = left
value = 2
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = right
value = 3
[]
[]
[Materials]
[left_real_1D]
type = Kokkos1DRealProperty
block = 0
name = 'prop_a'
dims = '1'
[]
[right_real_1D]
type = Kokkos1DRealProperty
block = 10
name = 'prop_a'
dims = '2'
[]
[right_real_1D_correct]
type = Kokkos1DRealProperty
block = 10
name = 'prop_a'
dims = '1'
[]
[right_real_2D]
type = Kokkos2DRealProperty
block = 10
name = 'prop_a'
dims = '1 1'
[]
[right_int_1D]
type = Kokkos1DIntProperty
block = 10
name = 'prop_a'
dims = '1'
[]
[]
[Executioner]
type = Steady
solve_type = PJFNK
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
print_linear_residuals = true
perf_graph = true
[]
(test/tests/kokkos/tag/kokkos_tag_residual_call.i)
[Mesh]
[gmg]
type = GeneratedMeshGenerator
dim = 1
nx = 10
[]
[]
[Problem]
solve = false
extra_tag_vectors = 'vec_tag1 vec_tag2'
[]
[Variables]
[u]
initial_condition = 1
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_vector_tags = 'vec_tag1'
[]
[react]
type = KokkosReaction
variable = u
extra_vector_tags = 'vec_tag1 vec_tag2'
[]
[]
[UserObjects]
[call_residual]
type = CallTaggedResidualsTest
residual_tags = 'vec_tag1 vec_tag2'
[]
[]
[Executioner]
type = Steady
[]
(test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_bodyforce_test.i)
###########################################################
# This is a simple test of the KokkosKernel System.
# It solves the Laplacian equation on a small 2x2 grid.
# The "KokkosDiffusion" kernel is used to calculate the
# residuals of the weak form of this operator. The
# "KokkosBodyForce" kernel is used to apply a time-dependent
# volumetric source.
###########################################################
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[bf]
type = KokkosBodyForce
variable = u
postprocessor = ramp
[]
[]
[Functions]
[ramp]
type = ParsedFunction
expression = 't'
[]
[]
[Postprocessors]
[ramp]
type = FunctionValuePostprocessor
function = ramp
execute_on = linear
[]
[]
[BCs]
active = 'left right'
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 0
[]
[]
[Executioner]
type = Transient
dt = 1.0
end_time = 1.0
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/coupled_var_neumann/kokkos_coupled_var_neumann.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[AuxVariables]
[coupled_bc_var]
[]
[]
[ICs]
[coupled_bc_var]
type = FunctionIC
variable = coupled_bc_var
function = set_coupled_bc_var
[]
[]
[Functions]
[set_coupled_bc_var]
type = ParsedFunction
expression = 'y - 0.5'
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = KokkosCoupledVarNeumannBC
variable = u
boundary = 1
v = coupled_bc_var
[]
[]
[Executioner]
type = Steady
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/nodalkernels/constraint_enforcement/kokkos_upper_and_lower_bound.i)
l=10
nx=100
num_steps=10
[Mesh]
type = GeneratedMesh
dim = 1
xmax = ${l}
nx = ${nx}
[]
[Variables]
[u]
[]
[lm_upper]
[]
[lm_lower]
[]
[]
[AuxVariables]
[force]
family = MONOMIAL
order = CONSTANT
[]
[]
[ICs]
[u]
type = FunctionIC
variable = u
function = 'x'
[]
[force]
type = FunctionIC
variable = force
function = 'if(x<5,-1,1)'
[]
[]
[Kernels]
[time]
type = KokkosTimeDerivative
variable = u
[]
[diff]
type = KokkosDiffusion
variable = u
[]
[ffn]
type = KokkosCoupledForce
variable = u
v = force
[]
[]
[NodalKernels]
[upper_bound]
type = KokkosUpperBoundNodalKernel
variable = lm_upper
v = u
exclude_boundaries = 'left right'
upper_bound = 10
[]
[forces_from_upper]
type = KokkosCoupledForceNodalKernel
variable = u
v = lm_upper
coef = -1
[]
[lower_bound]
type = KokkosLowerBoundNodalKernel
variable = lm_lower
v = u
exclude_boundaries = 'left right'
lower_bound = 0
[]
[forces_from_lower]
type = KokkosCoupledForceNodalKernel
variable = u
v = lm_lower
coef = 1
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
boundary = left
value = 0
variable = u
[]
[right]
type = KokkosDirichletBC
boundary = right
value = ${l}
variable = u
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
num_steps = ${num_steps}
solve_type = NEWTON
dtmin = 1
petsc_options_iname = '-snes_max_linear_solve_fail -ksp_max_it -pc_type -sub_pc_factor_levels -snes_linesearch_type'
petsc_options_value = '0 30 asm 16 basic'
[]
[Outputs]
exodus = true
hide = force
[csv]
type = CSV
execute_on = 'nonlinear timestep_end'
[]
[dof]
type = DOFMap
execute_on = 'initial'
[]
[]
[Debug]
show_var_residual_norms = true
[]
[Postprocessors]
[active_upper_lm]
type = GreaterThanLessThanPostprocessor
variable = lm_upper
execute_on = 'nonlinear timestep_end'
value = 1e-8
comparator = 'greater'
[]
[upper_violations]
type = GreaterThanLessThanPostprocessor
variable = u
execute_on = 'nonlinear timestep_end'
value = ${fparse 10+1e-8}
comparator = 'greater'
[]
[active_lower_lm]
type = GreaterThanLessThanPostprocessor
variable = lm_lower
execute_on = 'nonlinear timestep_end'
value = 1e-8
comparator = 'greater'
[]
[lower_violations]
type = GreaterThanLessThanPostprocessor
variable = u
execute_on = 'nonlinear timestep_end'
value = -1e-8
comparator = 'less'
[]
[nls]
type = NumNonlinearIterations
[]
[cum_nls]
type = CumulativeValuePostprocessor
postprocessor = nls
[]
[]
(test/tests/kokkos/kernels/2d_diffusion/kokkos_2d_diffusion_neumannbc_test.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
active = 'diff'
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
active = 'left right'
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = KokkosNeumannBC
variable = u
boundary = 1
value = 1
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/coord_type/kokkos_diffusion_rspherical.i)
[Mesh]
[sphere]
type = GeneratedMeshGenerator
nx = 10
dim = 1
[]
coord_type = RSPHERICAL
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 0
value = 1
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 0
[]
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/nodalkernels/constraint_enforcement/kokkos_upper_bound.i)
l=10
nx=100
num_steps=10
[Mesh]
type = GeneratedMesh
dim = 1
xmax = ${l}
nx = ${nx}
[]
[Variables]
[u]
[]
[lm]
[]
[]
[ICs]
[u]
type = FunctionIC
variable = u
function = '${l} - x'
[]
[]
[Kernels]
[time]
type = KokkosTimeDerivative
variable = u
[]
[diff]
type = KokkosDiffusion
variable = u
[]
[ffn]
type = KokkosBodyForce
variable = u
[]
[]
[NodalKernels]
[positive_constraint]
type = KokkosUpperBoundNodalKernel
variable = lm
v = u
exclude_boundaries = 'left right'
upper_bound = 10
[]
[forces]
type = KokkosCoupledForceNodalKernel
variable = u
v = lm
coef = -1
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
boundary = left
value = ${l}
variable = u
[]
[right]
type = KokkosDirichletBC
boundary = right
value = 0
variable = u
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Transient
num_steps = ${num_steps}
solve_type = NEWTON
dtmin = 1
petsc_options_iname = '-snes_max_linear_solve_fail -ksp_max_it -pc_type -sub_pc_factor_levels -snes_linesearch_type'
petsc_options_value = '0 30 asm 16 basic'
[]
[Outputs]
exodus = true
[csv]
type = CSV
execute_on = 'nonlinear timestep_end'
[]
[dof]
type = DOFMap
execute_on = 'initial'
[]
[]
[Debug]
show_var_residual_norms = true
[]
[Postprocessors]
[active_lm]
type = GreaterThanLessThanPostprocessor
variable = lm
execute_on = 'nonlinear timestep_end'
value = 1e-8
[]
[violations]
type = GreaterThanLessThanPostprocessor
variable = u
execute_on = 'nonlinear timestep_end'
value = ${fparse 10+1e-8}
comparator = 'greater'
[]
[]
(test/tests/kokkos/kernels/block_kernel/kokkos_block_vars.i)
[Mesh]
file = rect-2blk.e
[]
[Variables]
active = 'u v'
[u]
order = FIRST
family = LAGRANGE
block = 1
[]
[v]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
active = 'diff_u diff_v'
[diff_u]
type = KokkosDiffusion
variable = u
[]
[diff_v]
type = KokkosDiffusion
variable = v
[]
[]
[BCs]
active = 'left_u right_u left_v right_v'
[left_u]
type = KokkosDirichletBC
variable = u
boundary = 6
value = 0
[]
[right_u]
type = KokkosNeumannBC
variable = u
boundary = 8
value = 4
[]
[left_v]
type = KokkosDirichletBC
variable = v
boundary = 6
value = 1
[]
[right_v]
type = KokkosDirichletBC
variable = v
boundary = 3
value = 6
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
[]
[Outputs]
execute_on = 'timestep_end'
exodus = true
[]
(test/tests/kokkos/tag/kokkos_2d_diffusion_tag_vector.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[AuxVariables]
[tag_variable1]
order = FIRST
family = LAGRANGE
[]
[tag_variable2]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_vector_tags = 'vec_tag1 vec_tag2'
[]
[]
[AuxKernels]
[TagVectorAux1]
type = KokkosTagVectorAux
variable = tag_variable1
v = u
vector_tag = vec_tag1
[]
[TagVectorAux2]
type = KokkosTagVectorAux
variable = tag_variable2
v = u
vector_tag = vec_tag2
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
preset = false
extra_vector_tags = vec_tag1
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 1
preset = false
extra_vector_tags = vec_tag2
[]
[]
[Problem]
type = FEProblem
extra_tag_vectors = 'vec_tag1 vec_tag2'
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/misc_bcs/kokkos_convective_flux_bc.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
nz = 0
zmin = 0
zmax = 0
elem_type = QUAD4
[]
[Variables]
active = 'u'
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
active = 'diff'
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
active = 'left right'
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0.0
[]
[right]
type = KokkosConvectiveFluxBC
variable = u
boundary = 1
rate = 100
initial = 10
final = 20
duration = 10
[]
[]
[Executioner]
type = Transient
solve_type = 'PJFNK'
start_time = 0.0
num_steps = 10
dt = 1.0
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/pp_neumann/kokkos_pp_neumann.i)
# NOTE: This file is used within the documentation, so please do not change names within the file
# without checking that associated documentation is not affected, see syntax/Postprocessors/index.md.
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[u]
[]
[]
[AuxVariables]
[aux]
initial_condition = 5
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = left
value = 0
[]
[right]
type = KokkosPostprocessorNeumannBC
variable = u
boundary = right
postprocessor = right_pp
[]
[]
[Postprocessors]
[right_pp]
type = PointValue
point = '0.5 0.5 0'
variable = aux
execute_on = 'initial'
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
execute_on = 'timestep_end'
exodus = true
[]
(test/tests/kokkos/tag/kokkos_2d_diffusion_tag_matrix.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[AuxVariables]
[tag_variable1]
order = FIRST
family = LAGRANGE
[]
[tag_variable2]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_matrix_tags = 'mat_tag1 mat_tag2'
[]
[]
[AuxKernels]
[TagMatrixAux1]
type = TagMatrixAux
variable = tag_variable1
v = u
matrix_tag = mat_tag1
[]
[TagMatrixAux2]
type = TagMatrixAux
variable = tag_variable2
v = u
matrix_tag = mat_tag2
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
extra_matrix_tags = mat_tag1
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 1
extra_matrix_tags = mat_tag2
[]
[]
[Problem]
type = FEProblem
extra_tag_matrices = 'mat_tag1 mat_tag2'
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/petsc_gpu/kokkos_2d_diffusion_tag_vector.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[AuxVariables]
[tag_variable1]
order = FIRST
family = LAGRANGE
[]
[tag_variable2]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_vector_tags = 'vec_tag1 vec_tag2'
[]
[]
[AuxKernels]
[TagVectorAux1]
type = KokkosTagVectorAux
variable = tag_variable1
v = u
vector_tag = vec_tag1
[]
[TagVectorAux2]
type = KokkosTagVectorAux
variable = tag_variable2
v = u
vector_tag = vec_tag2
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
extra_vector_tags = vec_tag1
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 1
extra_vector_tags = vec_tag2
[]
[]
[Problem]
type = FEProblem
extra_tag_vectors = 'vec_tag1 vec_tag2'
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
petsc_options_iname = '-vec_type -nl0_mat_type'
petsc_options_value = 'kokkos hypre'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/1d_neumann/kokkos_1d_neumann.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 10
construct_side_list_from_node_list = true
[]
[Variables]
[u]
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = left
value = 0
[]
[right]
type = KokkosNeumannBC
variable = u
boundary = right
value = 2
[]
[]
[Executioner]
type = Steady
solve_type = 'PJFNK'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/nodalkernels/multiple_subdomains/kokkos_test.i)
[Mesh]
[gen]
type = GeneratedMeshGenerator
dim = 1
nx = 2
[]
[sub]
type = SubdomainBoundingBoxGenerator
bottom_left = '0.5 0 0'
top_right = '1 1 0'
input = 'gen'
block_id = '1'
[]
[]
[Variables]
[u]
block = '0 1'
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[rxn]
type = KokkosReaction
variable = u
[]
[]
[NodalKernels]
[source]
type = KokkosConstantRate
variable = u
block = '0 1'
rate = 1
[]
[]
[Executioner]
type = Steady
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/coord_type/kokkos_diffusion_rz.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 10
ny = 10
dim = 2
[]
coord_type = RZ
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 1
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 0
[]
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/kernels/material_coupled_force/kokkos_material_coupled_force.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
nx = 10
ymin = 0
ymax = 2
ny = 10
[]
[Variables]
[u]
[]
[v1]
initial_condition = 3
[]
[]
[AuxVariables]
[v2]
[]
[]
[ICs]
[v2_ic]
type = FunctionIC
variable = v2
function = v2_func
[]
[]
[Functions]
[v2_func]
type = ParsedFunction
expression = 'x + 2 * y'
[]
[reference]
type = ParsedFunction
expression = '3 * (-1) * 3.5 + (x + 2 * y) * 15 * 1.2'
[]
[]
[Materials]
[mat]
type = KokkosGenericConstantMaterial
prop_names = 'm1 m2'
prop_values = '-1 15'
[]
[]
[Kernels]
[reaction]
type = KokkosReaction
variable = u
[]
[coupled]
type = KokkosMatCoupledForce
variable = u
v = 'v1 v2'
coef = '3.5 1.2'
material_properties = 'm1 m2'
[]
[constant]
type = KokkosDiffusion
variable = v1
[]
[]
[Postprocessors]
[error]
type = ElementL2Error
function = reference
variable = u
[]
[]
[Executioner]
type = Steady
solve_type = NEWTON
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/coupled_var_neumann/kokkos_on_off.i)
[Mesh]
type = GeneratedMesh
dim = 2
xmin = 0
xmax = 1
ymin = 0
ymax = 1
nx = 10
ny = 10
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[]
[AuxVariables]
[coupled_bc_var]
[]
[active]
initial_condition = 1
[]
[]
[AuxKernels]
[active_right]
type = KokkosConstantAux
variable = active
value = 0.5
boundary = 1
[]
[]
[ICs]
[coupled_bc_var]
type = FunctionIC
variable = coupled_bc_var
function = set_coupled_bc_var
[]
[]
[Functions]
[set_coupled_bc_var]
type = ParsedFunction
expression = 'y - 0.5'
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
[]
[right]
type = KokkosCoupledVarNeumannBC
variable = u
boundary = 1
v = coupled_bc_var
scale_factor = active
[]
[]
[Executioner]
type = Steady
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/tag/kokkos_tag_nodal_kernels.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[u]
[]
[nodal_ode]
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[time]
type = KokkosTimeDerivative
variable = u
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[]
[NodalKernels]
[td]
type = KokkosTimeDerivativeNodalKernel
variable = nodal_ode
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[constant_rate]
type = KokkosConstantRate
variable = nodal_ode
rate = 1.0
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1 vec_tag2'
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = left
value = 0
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = right
value = 10
extra_matrix_tags = 'mat_tag1 mat_tag2'
extra_vector_tags = 'vec_tag1'
[]
[]
[Problem]
type = TagTestProblem
test_tag_vectors = 'time nontime residual vec_tag1 vec_tag2'
test_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_vectors = 'vec_tag1 vec_tag2'
[]
[AuxVariables]
[tag_variable1]
order = FIRST
family = LAGRANGE
[]
[tag_variable2]
order = FIRST
family = LAGRANGE
[]
[]
[AuxKernels]
[TagVectorAux1]
type = TagVectorAux
variable = tag_variable1
v = nodal_ode
vector_tag = vec_tag2
[]
[TagVectorAux2]
type = TagMatrixAux
variable = tag_variable2
v = u
matrix_tag = mat_tag2
[]
[]
[Executioner]
type = Transient
num_steps = 10
nl_rel_tol = 1e-08
dt = 0.01
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/coupled_dirichlet_bc/kokkos_coupled_dirichlet_bc.i)
[Mesh]
type = GeneratedMesh
dim = 2
nx = 10
ny = 10
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[v]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff_u]
type = KokkosDiffusion
variable = u
[]
[coupled_force_u]
type = KokkosCoupledForce
variable = u
v = v
[]
[diff_v]
type = KokkosDiffusion
variable = v
[]
[]
[BCs]
# BCs on left
# u: u=1
# v: v=2
[left_u]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 1
[]
[left_v]
type = KokkosDirichletBC
variable = v
boundary = 3
value = 2
[]
# BCs on right
# u: c*u + u^2 + v^2 = 9
# v: no flux
[right_u]
type = KokkosCoupledDirichletBC
variable = u
boundary = 1
value = 9
v=v
[]
[]
[Preconditioning]
[precond]
type = SMP
# 'full = true' is required for computeOffDiagJacobian() to get
# called. If you comment this out, you should see that this test
# requires a different number of linear and nonlinear iterations.
full = true
[]
[]
[Executioner]
type = Steady
# solve_type = 'PJFNK'
solve_type = 'NEWTON'
# Uncomment next line to disable line search. With line search enabled, you must use full=true with Newton or else it will fail.
# line_search = 'none'
petsc_options_iname = '-pc_type -pc_hypre_type'
petsc_options_value = 'hypre boomeramg'
nl_rel_tol = 1e-10
l_tol = 1e-12
nl_max_its = 10
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/kernels/block_kernel/kokkos_block_kernel_test.i)
[Mesh]
file = rectangle.e
# uniform_refine = 1
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
initial_condition = 1.0
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[body_force]
# Corresponds to BodyForce with function = 'x + y'
type = KokkosXYBodyForce
variable = u
block = 1
value = 10
[]
[time]
type = KokkosTimeDerivative
variable = u
[]
[]
[BCs]
[right]
type = KokkosDirichletBC
variable = u
boundary = 2
value = 1
[]
[]
[Executioner]
type = Transient
solve_type = 'PJFNK'
dt = 0.1
num_steps = 10
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/kernels/coupled_time_derivative/kokkos_coupled_time_derivative_test.i)
###########################################################
# This is a simple test of the CoupledTimeDerivative kernel.
# The expected solution for the variable v is
# v(x) = 1/2 * (x^2 + x)
###########################################################
[Mesh]
type = GeneratedMesh
nx = 5
ny = 5
dim = 2
[]
[Variables]
[u]
[]
[v]
[]
[]
[Kernels]
[time_u]
type = KokkosTimeDerivative
variable = u
[]
[fn_u]
type = KokkosBodyForce
variable = u
[]
[time_v]
type = KokkosCoupledTimeDerivative
variable = v
v = u
[]
[diff_v]
type = KokkosDiffusion
variable = v
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = v
boundary = 'left'
value = 0
[]
[right]
type = KokkosDirichletBC
variable = v
boundary = 'right'
value = 1
[]
[]
[Executioner]
type = Transient
num_steps = 1
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/bcs/coupled_var_neumann/kokkos_coupled_var_neumann_nl.i)
[Mesh]
type = GeneratedMesh
dim = 1
nx = 20
[]
[Variables]
[u][]
[v][]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
[]
[diff_v]
type = KokkosDiffusion
variable = v
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 'left'
value = 0
[]
[right]
type = KokkosCoupledVarNeumannBC
variable = u
boundary = 'right'
v = v
[]
[v_left]
type = KokkosDirichletBC
variable = v
boundary = 'left'
value = 0
[]
[v_right]
type = KokkosDirichletBC
variable = v
boundary = 'right'
value = 1
[]
[]
[Preconditioning]
[smp]
type = SMP
full = true
[]
[]
[Executioner]
type = Steady
[]
[Outputs]
exodus = true
[]
(test/tests/kokkos/tag/kokkos_2d_diffusion_matrix_tag_test.i)
[Mesh]
[square]
type = GeneratedMeshGenerator
nx = 2
ny = 2
dim = 2
[]
[]
[Variables]
[u]
order = FIRST
family = LAGRANGE
[]
[]
[AuxVariables]
[tag_variable]
order = FIRST
family = LAGRANGE
[]
[]
[Kernels]
[diff]
type = KokkosDiffusion
variable = u
extra_matrix_tags = 'mat_tag1 mat_tag2'
[]
[diff1]
type = KokkosDiffusion
variable = u
extra_matrix_tags = 'mat_tag2'
vector_tags = vec_tag1
[]
[diff2]
type = KokkosDiffusion
variable = u
vector_tags = vec_tag1
[]
[diff3]
type = KokkosDiffusion
variable = u
vector_tags = vec_tag1
[]
[]
[AuxKernels]
[TagMatrixAux]
type = TagMatrixAux
variable = tag_variable
v = u
matrix_tag = mat_tag2
[]
[]
[BCs]
[left]
type = KokkosDirichletBC
variable = u
boundary = 3
value = 0
extra_matrix_tags = mat_tag1
[]
[right]
type = KokkosDirichletBC
variable = u
boundary = 1
value = 1
extra_matrix_tags = mat_tag1
[]
[]
[Problem]
type = TagTestProblem
test_tag_vectors = 'nontime residual'
test_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_matrices = 'mat_tag1 mat_tag2'
extra_tag_vectors = 'vec_tag1'
[]
[Executioner]
type = Steady
solve_type = 'NEWTON'
[]
[Outputs]
exodus = true
[]
(modules/heat_transfer/include/kokkos/kernels/KokkosHeatConduction.h)
// This file is part of the MOOSE framework
// https://www.mooseframework.org
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "KokkosDiffusion.h"
class KokkosHeatConduction : public KokkosDiffusion
{
public:
static InputParameters validParams();
KokkosHeatConduction(const InputParameters & parameters);
KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i,
const unsigned int qp,
AssemblyDatum & datum) const;
KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int i,
const unsigned int j,
const unsigned int qp,
AssemblyDatum & datum) const;
private:
Moose::Kokkos::MaterialProperty<Real> _diffusion_coefficient;
Moose::Kokkos::MaterialProperty<Real> _diffusion_coefficient_dT;
};
KOKKOS_FUNCTION inline Real
KokkosHeatConduction::computeQpResidual(const unsigned int i,
const unsigned int qp,
AssemblyDatum & datum) const
{
return _diffusion_coefficient(datum, qp) * KokkosDiffusion::computeQpResidual(i, qp, datum);
}
KOKKOS_FUNCTION inline Real
KokkosHeatConduction::computeQpJacobian(const unsigned int i,
const unsigned int j,
const unsigned int qp,
AssemblyDatum & datum) const
{
Real jac =
_diffusion_coefficient(datum, qp) * KokkosDiffusion::computeQpJacobian(i, j, qp, datum);
if (_diffusion_coefficient_dT)
jac += _diffusion_coefficient_dT(datum, qp) * _phi(datum, j, qp) *
KokkosDiffusion::computeQpResidual(i, qp, datum);
return jac;
}
(test/include/kokkos/kernels/KokkosRestartDiffusion.h)
// This file is part of the MOOSE framework
// https://mooseframework.inl.gov
//
// All rights reserved, see COPYRIGHT for full restrictions
// https://github.com/idaholab/moose/blob/master/COPYRIGHT
//
// Licensed under LGPL 2.1, please see LICENSE for details
// https://www.gnu.org/licenses/lgpl-2.1.html
#pragma once
#include "KokkosDiffusion.h"
class KokkosRestartDiffusion : public KokkosDiffusion
{
public:
static InputParameters validParams();
KokkosRestartDiffusion(const InputParameters & parameters);
virtual void timestepSetup() override;
KOKKOS_FUNCTION Real computeQpResidual(const unsigned int i,
const unsigned int qp,
AssemblyDatum & datum) const;
KOKKOS_FUNCTION Real computeQpJacobian(const unsigned int i,
const unsigned int j,
const unsigned int qp,
AssemblyDatum & datum) const;
protected:
Moose::Kokkos::Scalar<unsigned int> _step;
Moose::Kokkos::ReferenceWrapper<Moose::Kokkos::Array<Real>> _coef;
int & _last_t_step;
};
KOKKOS_FUNCTION inline Real
KokkosRestartDiffusion::computeQpResidual(const unsigned int i,
const unsigned int qp,
AssemblyDatum & datum) const
{
return _coef(_step) * KokkosDiffusion::computeQpResidual(i, qp, datum);
}
KOKKOS_FUNCTION inline Real
KokkosRestartDiffusion::computeQpJacobian(const unsigned int i,
const unsigned int j,
const unsigned int qp,
AssemblyDatum & datum) const
{
return _coef(_step) * KokkosDiffusion::computeQpJacobian(i, j, qp, datum);
}