44 use json_module,
only : json_file, json_core, json_value
77 type(json_file),
intent(inout) :: json
78 type(
field_t),
pointer,
intent(in) :: f
79 type(
coef_t),
intent(inout) :: coef
80 type(
user_t),
intent(in) :: user
84 type(json_core) :: core
86 type(json_value),
pointer :: source_object, source_pointer
88 character(len=:),
allocatable :: buffer
90 type(json_file) :: source_subdict
92 character(len=:),
allocatable :: type
94 real(kind=
rp) :: values(3)
96 integer :: n_sources, i
103 if (json%valid_path(
'case.scalar.source_terms'))
then
105 allocate(rhs_fields%fields(1))
106 rhs_fields%fields(1)%f => f
108 call json%get_core(core)
109 call json%get(
'case.scalar.source_terms', source_object, found)
111 n_sources = core%count(source_object)
112 allocate(this%source_terms(n_sources))
117 call core%get_child(source_object, i, source_pointer, found)
118 call core%print_to_string(source_pointer, buffer)
119 call source_subdict%load_from_string(buffer)
120 call json_get(source_subdict,
"type", type)
123 if ((trim(type) .eq.
"user_vector") .or. &
124 (trim(type) .eq.
"user_pointwise"))
then
125 if (source_subdict%valid_path(
"start_time") .or. &
126 source_subdict%valid_path(
"end_time"))
then
127 call neko_warning(
"The start_time and end_time parameters have&
128 & no effect on the scalar user source term")
132 rhs_fields, coef,
type, user)
136 source_subdict, rhs_fields, coef)
151 class(
source_term_t),
allocatable,
intent(inout) :: source_term
153 type(
coef_t),
intent(inout) :: coef
154 character(len=*) :: type
155 type(
user_t),
intent(in) :: user
161 call source_term%init_from_components(rhs_fields, coef,
type, &
162 user%scalar_user_f_vector, &
174 if (
allocated(this%source_terms))
then
175 do i=1,
size(this%source_terms)
176 call this%source_terms(i)%free()
178 deallocate(this%source_terms)
188 real(kind=
rp),
intent(in) :: t
189 integer,
intent(in) :: tstep
195 if (
allocated(this%source_terms))
then
196 do i=1,
size(this%source_terms)
197 call this%source_terms(i)%source_term%compute(t, tstep)
Retrieves a parameter by name or throws an error.
Utilities for retrieving parameters from the case files.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Implements the scalar_source_term_t type.
subroutine init_user_source(source_term, rhs_fields, coef, type, user)
Initialize the user source term.
subroutine scalar_source_term_init(this, json, f, coef, user)
Constructor.
subroutine scalar_source_term_free(this)
Destructor.
subroutine scalar_source_term_compute(this, t, tstep)
Add all the source term to the passed right-hand side fields.
Implements the scalar_user_source_term_t type.
Defines a factory subroutine for source terms.
subroutine, public source_term_factory(source_term, json, fields, coef)
Source term factory. Both constructs and initializes the object.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Interfaces for user interaction with NEKO.
subroutine neko_warning(warning_msg)
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
Wrapper contaning and executing the scalar source terms.
A source-term for the scalar, with procedure pointers pointing to the actual implementation in the us...
Base abstract type for source terms.
A helper type that is needed to have an array of polymorphic objects.