39 use json_module,
only : json_file
67 integer :: filter_modes = 0
69 real(kind=
rp) :: chi = 0.0_rp
78 procedure, pass(this) :: init_from_components => &
95 type(json_file),
intent(inout) :: json
97 type(
coef_t),
intent(in),
target :: coef
98 character(len=*),
intent(in) :: variable_name
99 real(kind=
rp) :: filter_weight, start_time, end_time
100 integer :: filter_modes
108 filter_weight, filter_modes, start_time, end_time, variable_name)
121 filter_weight, filter_modes, start_time, end_time, field_name)
124 type(
coef_t),
intent(in),
target :: coef
125 real(kind=
rp),
intent(in) :: filter_weight
126 integer,
intent(in) :: filter_modes
127 real(kind=
rp),
intent(in) :: start_time
128 real(kind=
rp),
intent(in) :: end_time
129 character(len=*),
intent(in) :: field_name
132 real(kind=
rp),
allocatable :: transfer(:)
133 type(
field_t),
pointer :: source_field
136 call this%init_base(fields, coef, start_time, end_time)
138 if (fields%size() .ne. 1 .and. fields%size() .ne. 3)
then
139 call neko_error(
"HPFRT source term expects either 1 or 3 fields.")
143 if (filter_modes .lt. 1 .or. filter_modes .gt. nx)
then
144 call neko_error(
"HPFRT filter_modes must be between 1 and lx.")
147 this%filter_modes = filter_modes
148 this%chi = -abs(filter_weight)
150 allocate(transfer(nx))
152 k0 = nx - filter_modes
154 amp =
real((i - k0) * (i - k0), kind=
rp) / &
155 real(filter_modes * filter_modes, kind=
rp)
156 transfer(i) = 1.0_rp - amp
159 call this%filter%init_from_components(coef,
"nonBoyd", transfer)
161 call this%source_fields%init(fields%size())
163 if (fields%size() .eq. 3)
then
164 call this%source_fields%assign(1,
neko_registry%get_field(
"u"))
165 call this%source_fields%assign(2,
neko_registry%get_field(
"v"))
166 call this%source_fields%assign(3,
neko_registry%get_field(
"w"))
169 call neko_error(
"HPFRT source field does not exist: " // &
173 call this%source_fields%assign(1, source_field)
184 call this%free_base()
185 call this%filter%free()
186 call this%source_fields%free()
188 this%filter_modes = 0
198 type(
field_t),
pointer :: rhs, source, work
199 integer :: i, work_idx
203 do i = 1, this%fields%size()
204 rhs => this%fields%get(i)
205 source => this%source_fields%get(i)
207 call this%filter%apply(work, source)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Implements elementwise_filter_t.
subroutine, public field_sub3(a, b, c, n)
Vector subtraction .
subroutine, public field_add2(a, b, n)
Vector addition .
subroutine, public field_cmult(a, c, n)
Multiplication by constant c .
Filter to be applied to a scalar field.
Implements the hpfrt_source_term_t type.
subroutine hpfrt_source_term_init_from_components(this, fields, coef, filter_weight, filter_modes, start_time, end_time, field_name)
The constructor from type components.
subroutine hpfrt_source_term_free(this)
Destructor.
subroutine hpfrt_source_term_compute(this, time)
Computes the source term and adds the result to fields.
subroutine hpfrt_source_term_init_from_json(this, json, fields, coef, variable_name)
The common constructor using a JSON object.
Utilities for retrieving parameters from the case files.
integer, parameter, public rp
Global precision used in computations.
Defines a registry for storing solution fields.
type(registry_t), target, public neko_registry
Global field registry.
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Module with things related to the simulation time.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Implements the elementwise filter for SEM.
field_list_t, To be able to group fields together
High-pass filter relaxation source term.
Base abstract type for source terms.
A struct that contains all info about the time, expand as needed.