38  use json_module, 
only: json_file
 
   64     procedure, 
public, pass(this) :: init => &
 
 
   94    use json_module, 
only: json_core, json_value
 
   98    type(json_file), 
intent(inout) :: json
 
  100    type(
coef_t), 
intent(inout), 
target :: coef
 
  101    real(kind=
rp) :: start_time, end_time
 
  103    character(len=:), 
allocatable :: filter_type
 
  104    real(kind=
rp), 
dimension(:), 
allocatable :: brinkman_limits
 
  105    real(kind=
rp) :: brinkman_penalty
 
  107    type(json_value), 
pointer :: json_object_list
 
  108    type(json_core) :: core
 
  110    character(len=:), 
allocatable :: object_type
 
  111    type(json_file) :: object_settings
 
  120    call json_get(json, 
'brinkman.limits', brinkman_limits)
 
  121    call json_get(json, 
'brinkman.penalty', brinkman_penalty)
 
  123    if (
size(brinkman_limits) .ne. 2) 
then 
  124       call neko_error(
'brinkman_limits must be a 2 element array of reals')
 
  128    call this%init_base(fields, coef, start_time, end_time)
 
  135       call neko_error(
'Brinkman field already exists.')
 
  138    call this%indicator%init(coef%dof)
 
  139    call this%brinkman%init(coef%dof)
 
  144    call json%get(
'objects', json_object_list)
 
  145    call json%info(
'objects', n_children = n_regions)
 
  146    call json%get_core(core)
 
  152       select case (object_type)
 
  153         case (
'boundary_mesh')
 
  154          call this%init_boundary_mesh(object_settings)
 
  156          call this%init_point_zone(object_settings)
 
  159          call object_settings%print()
 
  160          call neko_error(
'Brinkman source term objects require a region type')
 
  162          call neko_error(
'Brinkman source term unknown region type')
 
  170    select case (filter_type)
 
  174       call neko_error(
'Brinkman source term unknown filter type')
 
  180    this%brinkman = this%indicator
 
  182         brinkman_limits(1), brinkman_limits(2), brinkman_penalty)
 
 
  190    call this%indicator%free()
 
  191    call this%brinkman%free()
 
  192    call this%free_base()
 
 
  200    real(kind=
rp), 
intent(in) :: t
 
  201    integer, 
intent(in) :: tstep
 
  202    type(
field_t), 
pointer :: u, v, w, fu, fv, fw
 
  205    n = this%fields%item_size(1)
 
  211    fu => this%fields%get(1)
 
  212    fv => this%fields%get(2)
 
  213    fw => this%fields%get(3)
 
 
  237    type(json_file), 
intent(inout) :: json
 
  240    character(len=:), 
allocatable :: mesh_file_name
 
  241    character(len=:), 
allocatable :: distance_transform
 
  242    character(len=:), 
allocatable :: filter_type
 
  243    character(len=:), 
allocatable :: mesh_transform
 
  248    real(kind=
rp) :: scalar_r
 
  249    real(kind=
dp) :: scalar_d
 
  252    real(kind=
dp), 
dimension(:), 
allocatable :: box_min, box_max
 
  253    logical :: keep_aspect_ratio
 
  254    real(kind=
dp), 
dimension(3) :: scaling
 
  255    real(kind=
dp), 
dimension(3) :: translation
 
  257    type(
aabb_t) :: mesh_box, target_box
 
  263    call json_get(json, 
'name', mesh_file_name)
 
  266    call json_get(json, 
'distance_transform.type', distance_transform)
 
  271    mesh_file = 
file_t(mesh_file_name)
 
  272    call mesh_file%read(boundary_mesh)
 
  274    if (boundary_mesh%nelv .eq. 0) 
then 
  275       call neko_error(
'No elements in the boundary mesh')
 
  282         mesh_transform, 
'none')
 
  284    select case (mesh_transform)
 
  287      case (
'bounding_box')
 
  288       call json_get(json, 
'mesh_transform.box_min', box_min)
 
  289       call json_get(json, 
'mesh_transform.box_max', box_max)
 
  291            keep_aspect_ratio, .true.)
 
  293       if (
size(box_min) .ne. 3 .or. 
size(box_max) .ne. 3) 
then 
  295               &box_min and box_max must be 3 element arrays of reals')
 
  298       call target_box%init(box_min, box_max)
 
  302       scaling = target_box%get_diagonal() / mesh_box%get_diagonal()
 
  303       if (keep_aspect_ratio) 
then 
  304          scaling = minval(scaling)
 
  307       translation = - scaling * mesh_box%get_min() + target_box%get_min()
 
  309       do idx_p = 1, boundary_mesh%mpts
 
  310          boundary_mesh%points(idx_p)%x = &
 
  311               scaling * boundary_mesh%points(idx_p)%x + translation
 
  326    call temp_field%init(this%coef%dof)
 
  329    select case (distance_transform)
 
  331       call json_get(json, 
'distance_transform.value', scalar_d)
 
  332       scalar_r = 
real(scalar_d, kind=
rp)
 
  339       call json_get(json, 
'distance_transform.value', scalar_d)
 
  340       scalar_r = 
real(scalar_d, kind=
rp)
 
  353    select case (filter_type)
 
  363            this%indicator%size())
 
  365       this%indicator%x = 
max(this%indicator%x, temp_field%x)
 
 
  382    type(json_file), 
intent(inout) :: json
 
  385    character(len=:), 
allocatable :: zone_name
 
  386    character(len=:), 
allocatable :: filter_type
 
  395    call json_get(json, 
'name', zone_name)
 
  399    call temp_field%init(this%coef%dof)
 
  403    do i = 1, my_point_zone%size
 
  404       temp_field%x(my_point_zone%mask(i), 1, 1, 1) = 1.0_rp
 
  409    select case (filter_type)
 
  417    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 permeability_field(f, k_0, k_1, q)
Apply a permeability function to a field.
 
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.
 
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, public 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.