44 use json_module,
only : json_file, json_core, json_value
81 type(json_file),
intent(inout) :: json
82 type(
field_t),
pointer,
intent(in) :: f_x, f_y, f_z
83 type(
coef_t),
intent(inout) :: coef
84 type(
user_t),
intent(in) :: user
88 type(json_core) :: core
90 type(json_value),
pointer :: source_object, source_pointer
92 character(len=:),
allocatable :: buffer
94 type(json_file) :: source_subdict
96 character(len=:),
allocatable :: type
98 real(kind=
rp) :: values(3)
100 integer :: n_sources, i
109 if (json%valid_path(
'case.fluid.source_terms'))
then
111 allocate(rhs_fields%fields(3))
112 rhs_fields%fields(1)%f => f_x
113 rhs_fields%fields(2)%f => f_y
114 rhs_fields%fields(3)%f => f_z
116 call json%get_core(core)
117 call json%get(
'case.fluid.source_terms', source_object, found)
119 n_sources = core%count(source_object)
120 allocate(this%source_terms(n_sources))
125 call core%get_child(source_object, i, source_pointer, found)
126 call core%print_to_string(source_pointer, buffer)
127 call source_subdict%load_from_string(buffer)
128 call json_get(source_subdict,
"type", type)
131 if ((trim(type) .eq.
"user_vector") .or. &
132 (trim(type) .eq.
"user_pointwise"))
then
134 if (source_subdict%valid_path(
"start_time") .or. &
135 source_subdict%valid_path(
"end_time"))
then
136 call neko_warning(
"The start_time and end_time parameters have&
137 & no effect on the fluid user source term")
141 rhs_fields, coef,
type, user)
145 source_subdict, rhs_fields, coef)
160 class(
source_term_t),
allocatable,
intent(inout) :: source_term
162 type(
coef_t),
intent(inout) :: coef
163 character(len=*) :: type
164 type(
user_t),
intent(in) :: user
170 call source_term%init_from_components(rhs_fields, coef,
type, &
171 user%fluid_user_f_vector, &
185 if (
allocated(this%source_terms))
then
186 do i=1,
size(this%source_terms)
187 call this%source_terms(i)%free()
189 deallocate(this%source_terms)
199 real(kind=
rp),
intent(in) :: t
200 integer,
intent(in) :: tstep
208 if (
allocated(this%source_terms))
then
209 do i=1,
size(this%source_terms)
210 call this%source_terms(i)%source_term%compute(t, tstep)
Retrieves a parameter by name or throws an error.
Implements the fluid_source_term_t type.
subroutine init_user_source(source_term, rhs_fields, coef, type, user)
Initialize the user source term.
subroutine fluid_source_term_init(this, json, f_x, f_y, f_z, coef, user)
Costructor.
subroutine fluid_source_term_compute(this, t, tstep)
Add all the source term to the passed right-hand side fields.
subroutine fluid_source_term_free(this)
Destructor.
Implements the fluid_user_source_term_t type.
Utilities for retrieving parameters from the case files.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
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 fluid source terms.
A source-term for the fluid, with procedure pointers pointing to the actual implementation in the use...
Base abstract type for source terms.
A helper type that is needed to have an array of polymorphic objects.