Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
ext_cyl.f90
Go to the documentation of this file.
1module user
2 use neko
3 use ieee_arithmetic, only: ieee_is_nan
4
5 implicit none
6
7contains
8
9 ! Register user defined functions (see user_intf.f90)
10 subroutine user_setup(usr)
11 type(user_t), intent(inout) :: usr
12
13 usr%fluid_user_ic => user_ic
14
15 end subroutine user_setup
16
17 ! User defined initial condition
18 subroutine user_ic(u, v, w, p, params)
19 type(field_t), intent(inout) :: u
20 type(field_t), intent(inout) :: v
21 type(field_t), intent(inout) :: w
22 type(field_t), intent(inout) :: p
23 type(json_file), intent(inout) :: params
24 integer :: iel, ix, iy, iz
25 real(kind=rp) :: fcoeff(3), xl(2)
26
27
28
29 do iel = 1, u%msh%nelv
30 do iz = 1, u%Xh%lz
31 do iy = 1, u%Xh%ly
32 do ix = 1, u%Xh%lx
33 xl(1) = u%dof%x(ix, iy, iz, iel)
34 xl(2) = u%dof%y(ix, iy, iz, iel)
35 fcoeff(1) = 3.0e4_rp
36 fcoeff(2) = -1.5e3_rp
37 fcoeff(3) = 0.5e5_rp
38 u%x(ix, iy, iz, iel) = math_ran_dst(ix, iy, iz, iel, xl, &
39 fcoeff) * 1.0e-08_rp
40 fcoeff(1) = 2.3e4_rp
41 fcoeff(2) = 2.3e3_rp
42 fcoeff(3) = -2.0e5_rp
43 v%x(ix, iy, iz, iel) = math_ran_dst(ix, iy, iz, iel, xl, &
44 fcoeff) * 1.0e-08_rp
45 w%x(ix, iy, iz, iel) = 0.0_rp
46 end do
47 end do
48 end do
49 end do
50
51 call device_memcpy(u%x, u%x_d, u%size(), host_to_device, .true.)
52 call device_memcpy(v%x, v%x_d, v%size(), host_to_device, .true.)
53 call device_memcpy(w%x, w%x_d, w%size(), host_to_device, .true.)
54
55 end subroutine user_ic
56
57
58
59 !=======================================================================
72 real function math_ran_dst(ix, iy, iz, ieg, xl, fcoeff)
73 implicit none
74
75
76 ! argument list
77 integer ix, iy, iz, ieg
78 real(kind=rp) :: fcoeff(3), xl(2)
79!-----------------------------------------------------------------------
80 math_ran_dst = fcoeff(1)*(ieg+xl(1)*sin(xl(2))) + &
81 fcoeff(2)*ix*iy + fcoeff(3)*ix
82 math_ran_dst = 1.0e3_rp * sin(math_ran_dst)
83 math_ran_dst = 1.0e3_rp * sin(math_ran_dst)
85
86 return
87 end function math_ran_dst
88
89end module user
User defined user region.
Definition user.f90:2
real function math_ran_dst(ix, iy, iz, ieg, xl, fcoeff)
Give random distribution depending on position.
Definition ext_cyl.f90:73
subroutine user_ic(u, v, w, p, params)
Definition cylinder.f90:99
subroutine user_setup(user)
Register user defined functions (see nekos user_intf.f90)
Definition user.f90:22