39 use json_module,
only : json_file
52 real(kind=
rp) :: omega(3)
54 real(kind=
rp) :: u_geo(3) = 0
59 procedure, pass(this) :: init_from_compenents => &
74 type(json_file),
intent(inout) :: json
76 type(
coef_t),
intent(in),
target :: coef
78 real(kind=
rp),
allocatable :: rotation_vec(:), u_geo(:)
80 real(kind=
rp) :: omega, phi, f, pi
81 real(kind=
rp) :: start_time, end_time
86 if (json%valid_path(
"geostrophic_wind"))
then
87 call json_get(json,
"geostrophic_wind", u_geo)
93 if (json%valid_path(
"rotation_vector"))
then
94 call json_get(json,
"rotation_vector", rotation_vec)
95 else if (json%valid_path(
"omega") .and. json%valid_path(
"phi"))
then
99 allocate(rotation_vec(3))
100 pi = 4 * atan(1.0_rp)
101 rotation_vec(1) = 0.0_rp
102 rotation_vec(2) = omega * cos(phi * pi / 180 )
103 rotation_vec(3) = omega * sin(phi * pi / 180)
104 else if (json%valid_path(
"f"))
then
107 allocate(rotation_vec(3))
108 rotation_vec(1) = 0.0_rp
109 rotation_vec(2) = 0.0_rp
110 rotation_vec(3) = 0.5_rp * f
112 call neko_error(
"Specify either rotation_vector, phi and omega, or f &
113 & for the Coriolis source term.")
119 u_geo, coef, start_time, end_time)
131 u_geo, coef, start_time, end_time)
134 real(kind=
rp),
intent(in) :: omega(3)
135 real(kind=
rp),
intent(in) :: u_geo(3)
137 real(kind=
rp),
intent(in) :: start_time
138 real(kind=
rp),
intent(in) :: end_time
141 call this%init_base(fields, coef, start_time, end_time)
143 if (fields%size() .ne. 3)
then
144 call neko_error(
"Number of fields for the Coriolis force must be 3.")
155 call this%free_base()
163 real(kind=
rp),
intent(in) :: t
164 integer,
intent(in) :: tstep
167 call neko_error(
"The Coriolis force is only implemented on the CPU")
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.
Implements the cpu kernel for the coriolis_source_term_t type. Maintainer: Timofey Mukha.
subroutine, public coriolis_source_term_compute_cpu(fields, omega, u_geo)
Computes the generic Coriolis source term on the cpu.
Implements the coriolis_source_term_t type. Maintainer: Timofey Mukha.
subroutine coriolis_source_term_init_from_components(this, fields, omega, u_geo, coef, start_time, end_time)
The constructor from type components.
subroutine coriolis_source_term_init_from_json(this, json, fields, coef)
The common constructor using a JSON object.
subroutine coriolis_source_term_free(this)
Destructor.
subroutine coriolis_source_term_compute(this, t, tstep)
Computes the source term and adds the result to fields.
Utilities for retrieving parameters from the case files.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Implements the source_term_t type and a wrapper source_term_wrapper_t.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
This source term adds the Coriolis force.
field_list_t, To be able to group fields together
Base abstract type for source terms.