38 use json_module,
only: json_file
61 procedure,
public, pass(this) :: init => &
91 use json_module,
only: json_core, json_value
95 type(json_file),
intent(inout) :: json
97 type(
coef_t),
intent(inout),
target :: coef
98 real(kind=
rp) :: start_time, end_time
100 character(len=:),
allocatable :: filter_type
101 real(kind=
rp),
dimension(:),
allocatable :: brinkman_limits
102 real(kind=
rp) :: brinkman_penalty
104 type(json_value),
pointer :: json_object_list
105 type(json_core) :: core
107 character(len=:),
allocatable :: object_type
108 type(json_file) :: object_settings
117 call json_get(json,
'brinkman.limits', brinkman_limits)
118 call json_get(json,
'brinkman.penalty', brinkman_penalty)
120 if (
size(brinkman_limits) .ne. 2)
then
121 call neko_error(
'brinkman_limits must be a 2 element array of reals')
125 call this%init_base(fields, coef, start_time, end_time)
132 call neko_error(
'Brinkman field already exists.')
135 call this%indicator%init(coef%dof)
136 call this%brinkman%init(coef%dof)
141 call json%get(
'objects', json_object_list)
142 call json%info(
'objects', n_children = n_regions)
143 call json%get_core(core)
149 select case (object_type)
150 case (
'boundary_mesh')
151 call this%init_boundary_mesh(object_settings)
153 call this%init_point_zone(object_settings)
156 call object_settings%print()
157 call neko_error(
'Brinkman source term objects require a region type')
159 call neko_error(
'Brinkman source term unknown region type')
167 select case (filter_type)
171 call neko_error(
'Brinkman source term unknown filter type')
178 & brinkman_limits(1), brinkman_limits(2), brinkman_penalty)
192 call this%indicator%free()
193 call this%brinkman%free()
194 call this%free_base()
202 real(kind=
rp),
intent(in) :: t
203 integer,
intent(in) :: tstep
204 type(
field_t),
pointer :: u, v, w, fu, fv, fw
207 n = this%fields%item_size(1)
213 fu => this%fields%get(1)
214 fv => this%fields%get(2)
215 fw => this%fields%get(3)
239 type(json_file),
intent(inout) :: json
242 character(len=:),
allocatable :: mesh_file_name
243 character(len=:),
allocatable :: distance_transform
244 character(len=:),
allocatable :: filter_type
245 character(len=:),
allocatable :: mesh_transform
250 real(kind=
rp) :: scalar_r
251 real(kind=
dp) :: scalar_d
254 real(kind=
dp),
dimension(:),
allocatable :: box_min, box_max
255 logical :: keep_aspect_ratio
256 real(kind=
dp),
dimension(3) :: scaling
257 real(kind=
dp),
dimension(3) :: translation
259 type(
aabb_t) :: mesh_box, target_box
265 call json_get(json,
'name', mesh_file_name)
268 call json_get(json,
'distance_transform.type', distance_transform)
273 mesh_file =
file_t(mesh_file_name)
274 call mesh_file%read(boundary_mesh)
276 if (boundary_mesh%nelv .eq. 0)
then
277 call neko_error(
'No elements in the boundary mesh')
284 mesh_transform,
'none')
286 select case (mesh_transform)
289 case (
'bounding_box')
290 call json_get(json,
'mesh_transform.box_min', box_min)
291 call json_get(json,
'mesh_transform.box_max', box_max)
293 keep_aspect_ratio, .true.)
295 if (
size(box_min) .ne. 3 .or.
size(box_max) .ne. 3)
then
297 &box_min and box_max must be 3 element arrays of reals')
300 call target_box%init(box_min, box_max)
304 scaling = target_box%get_diagonal() / mesh_box%get_diagonal()
305 if (keep_aspect_ratio)
then
306 scaling = minval(scaling)
309 translation = - scaling * mesh_box%get_min() + target_box%get_min()
311 do idx_p = 1, boundary_mesh%mpts
312 boundary_mesh%points(idx_p)%x = &
313 scaling * boundary_mesh%points(idx_p)%x + translation
328 call temp_field%init(this%indicator%dof)
331 select case (distance_transform)
333 call json_get(json,
'distance_transform.value', scalar_d)
334 scalar_r =
real(scalar_d, kind=
rp)
341 call json_get(json,
'distance_transform.value', scalar_d)
354 select case (filter_type)
362 this%indicator%x =
max(this%indicator%x, temp_field%x)
378 type(json_file),
intent(inout) :: json
381 character(len=:),
allocatable :: zone_name
382 character(len=:),
allocatable :: filter_type
391 call json_get(json,
'name', zone_name)
396 call temp_field%init(this%indicator%dof)
400 do i = 1, my_point_zone%size
401 temp_field%x(my_point_zone%mask(i), 1, 1, 1) = 1.0_rp
406 select case (filter_type)
414 this%indicator%x =
max(this%indicator%x, temp_field%x)
Copy data between host and device (or device and device)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Axis Aligned Bounding Box (aabb) implementation in Fortran.
type(aabb_t) function, public get_aabb(object, padding)
Construct the aabb of a predefined object.
Implements the brinkman_source_term_t type.
subroutine init_point_zone(this, json)
Initializes the source term from a point zone.
subroutine init_boundary_mesh(this, json)
Initializes the source term from a boundary mesh.
subroutine brinkman_source_term_compute(this, t, tstep)
Computes the source term and adds the result to fields.
subroutine brinkman_source_term_free(this)
Destructor.
subroutine brinkman_source_term_init_from_json(this, json, fields, coef)
The common constructor using a JSON object.
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
subroutine, public field_subcol3(a, b, c, n)
Returns .
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Module for file I/O operations.
A module containing filter functions and subroutines. These functions are used to modify fields in a ...
subroutine, public smooth_step_field(F, edge0, edge1)
Apply a smooth step function to a field.
subroutine, public step_function_field(F, x0, value0, value1)
Apply a step function to a field.
subroutine, public permeability_field(F_out, x, k_0, k_1, q)
Apply a permeability function to a field.
Utilities for retrieving parameters from the case files.
integer, parameter neko_bcknd_device
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
type(point_zone_registry_t), target, public neko_point_zone_registry
Global point_zone registry.
subroutine, public profiler_start_region(name, region_id)
Started a named (name) profiler region.
subroutine, public profiler_end_region(name, region_id)
End the most recently started profiler region.
Module containing Signed Distance Functions.
subroutine signed_distance_field(field_data, object, max_distance)
Signed distance field.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Defines a triangular surface mesh.
Axis Aligned Bounding Box (aabb) data structure.
A Brinkman source term. The region and strength are controlled by assigning regions types and brinkma...
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
A wrapper around a polymorphic generic_file_t that handles its init. This is essentially a factory fo...
Base abstract type for point zones.
Base abstract type for source terms.