39 use json_module,
only : json_file
48 use,
intrinsic :: iso_c_binding
60 character(len=:),
allocatable :: scheme_name
73 procedure, pass(this) :: init_from_components => &
90 type(json_file),
intent(inout) :: json
92 type(
coef_t),
intent(in),
target :: coef
93 character(len=*),
intent(in) :: variable_name
95 call neko_error(
"The user fluid source term should be init from components")
105 user_proc, scheme_name)
108 type(
coef_t),
intent(in),
target :: coef
110 character(len=*),
intent(in) :: scheme_name
114 call this%init_base(fields, coef, 0.0_rp, huge(0.0_rp))
116 this%scheme_name = scheme_name
117 this%dof => fields%dof(1)
119 call this%user_fields%init(3)
121 do i = 1, this%fields%size()
122 allocate(this%user_fields%items(i)%ptr)
123 call this%user_fields%items(i)%ptr%init(this%dof)
126 this%compute_user_ => user_proc
133 call this%user_fields%free()
135 if (
allocated(this%scheme_name))
deallocate(this%scheme_name)
137 nullify(this%compute_user_)
140 call this%free_base()
150 if (time%t .ge. this%start_time .and. time%t .le. this%end_time)
then
151 call this%compute_user_(this%scheme_name, this%fields, time)
153 do i = 1, this%fields%size()
154 call this%user_fields%items(i)%ptr%init(this%dof)
156 this%user_fields%items(i)%ptr)
Map a Fortran array to a device (allocate and associate)
Abstract interface for user defined source term.
subroutine, public device_add2(a_d, b_d, n, strm)
Vector addition .
Device abstraction, common interface for various accelerators.
subroutine, public device_free(x_d)
Deallocate memory on the device.
Defines a mapping of the degrees of freedom.
subroutine, public field_add2(a, b, n)
Vector addition .
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Module with things related to the simulation time.
Interfaces for user interaction with NEKO.
Implements the user_source_term_t type.
subroutine user_source_term_init(this, json, fields, coef, variable_name)
Costructor from JSON.
subroutine user_source_term_init_from_components(this, fields, coef, user_proc, scheme_name)
Costructor from components.
subroutine user_source_term_free(this)
Destructor.
subroutine user_source_term_compute(this, time)
Computes the source term and adds the result to fields.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
field_list_t, To be able to group fields together
Base abstract type for source terms.
A struct that contains all info about the time, expand as needed.
A source term wrapping the user source term routine. Stores fields that are passed to the user routin...