3 #include "sll_assert.h"
4 #include "sll_errors.h"
27 procedure(i_sub_velocity_field),
deferred :: velocity_field
28 procedure(i_fun_flow_field),
deferred :: flow_field
40 sll_pure
subroutine i_sub_velocity_field(self, x, a)
43 real(
wp),
intent(in) :: x(2)
44 real(
wp),
intent(out) :: a(2)
45 end subroutine i_sub_velocity_field
47 sll_pure
function i_fun_flow_field(self, x, h)
result(y)
50 real(
wp),
intent(in) :: x(2)
51 real(
wp),
intent(in) :: h
53 end function i_fun_flow_field
69 real(
wp),
intent(in) :: eta(2)
70 real(
wp),
intent(in) :: h
74 real(
wp) :: eta_new(2)
76 integer,
parameter :: maxiter = 100
77 real(
wp),
parameter :: tol = 1.0e-14_wp
79 real(
wp) :: x(2), tmp(2), k1(2), k2(2), k3(2)
85 k1(1) = spline_2d_a1%eval(eta(1), eta(2))
86 k1(2) = spline_2d_a2%eval(eta(1), eta(2))
89 tmp = mapping%eval_inverse(x + 0.5_wp*h*k1, eta, tol, maxiter)
91 k2(1) = spline_2d_a1%eval(tmp(1), tmp(2))
92 k2(2) = spline_2d_a2%eval(tmp(1), tmp(2))
95 tmp = mapping%eval_inverse(x + h*(2.0_wp*k2 - k1), eta, tol, maxiter)
97 k3(1) = spline_2d_a1%eval(tmp(1), tmp(2))
98 k3(2) = spline_2d_a2%eval(tmp(1), tmp(2))
101 x = x + h*(k1 + 4.0_wp*k2 + k3)/6.0_wp
103 eta_new = mapping%eval_inverse(x, eta, tol, maxiter)
110 real(
wp),
intent(in) :: eta(2)
111 real(
wp),
intent(in) :: h
115 real(
wp) :: eta_new(2)
176 real(
wp) :: a_x1, a_x2
177 real(
wp) :: x(2), tmp(2), k1(2), k2(2), k3(2)
178 real(
wp) :: jmat_comp(2, 2)
184 a_x1 = spline_2d_a1%eval(eta(1), eta(2))
185 a_x2 = spline_2d_a2%eval(eta(1), eta(2))
187 jmat_comp = jac_2d_pcart%eval(eta)
189 k1(1) = jmat_comp(1, 1)*a_x1 + jmat_comp(1, 2)*a_x2
190 k1(2) = jmat_comp(2, 1)*a_x1 + jmat_comp(2, 2)*a_x2
193 tmp = polar_map_inverse(x + 0.5_wp*h*k1)
195 a_x1 = spline_2d_a1%eval(tmp(1), tmp(2))
196 a_x2 = spline_2d_a2%eval(tmp(1), tmp(2))
198 jmat_comp = jac_2d_pcart%eval(tmp)
200 k2(1) = jmat_comp(1, 1)*a_x1 + jmat_comp(1, 2)*a_x2
201 k2(2) = jmat_comp(2, 1)*a_x1 + jmat_comp(2, 2)*a_x2
204 tmp = polar_map_inverse(x + h*(2.0_wp*k2 - k1))
206 a_x1 = spline_2d_a1%eval(tmp(1), tmp(2))
207 a_x2 = spline_2d_a2%eval(tmp(1), tmp(2))
209 jmat_comp = jac_2d_pcart%eval(tmp)
211 k3(1) = jmat_comp(1, 1)*a_x1 + jmat_comp(1, 2)*a_x2
212 k3(2) = jmat_comp(2, 1)*a_x1 + jmat_comp(2, 2)*a_x2
215 x = x + h*(k1 + 4.0_wp*k2 + k3)/6.0_wp
217 eta_new = polar_map_inverse(x)
223 sll_pure
function polar_map(eta)
result(y)
224 real(
wp),
intent(in) :: eta(2)
227 y(1) = eta(1)*cos(eta(2))
228 y(2) = eta(1)*sin(eta(2))
230 end function polar_map
232 sll_pure
function polar_map_inverse(y)
result(eta)
233 real(
wp),
intent(in) :: y(2)
239 if (eta(1) > 1.0_wp) eta(1) = 1.0_wp
241 end function polar_map_inverse
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_twopi
real(wp) function, dimension(2) f_singular_mapping_advector__advect_cart(self, eta, h, mapping, spline_2d_a1, spline_2d_a2)
real(wp) function, dimension(2) f_singular_mapping_advector__advect_pseudo_cart(self, eta, h, jac_2d_pcart, spline_2d_a1, spline_2d_a2)
Module for tensor-product 2D splines.
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
Abstract type, singular mapping.