23 #include "sll_errors.h"
24 #include "sll_memory.h"
25 #include "sll_working_precision.h"
52 sll_real64 :: eta1_min
53 sll_real64 :: eta1_max
54 sll_real64 :: delta_eta1
55 sll_real64,
dimension(:),
pointer :: d_dx
56 sll_real64,
dimension(:),
pointer :: kx
59 sll_comp64,
dimension(:),
pointer :: fk
60 sll_comp64,
dimension(:),
pointer :: r0
61 sll_comp64,
dimension(:),
pointer :: r1
62 sll_comp64,
dimension(:),
pointer :: ek
87 sll_int32,
intent(in) :: nc_eta1
88 sll_real64,
intent(in) :: eta1_min
89 sll_real64,
intent(in) :: eta1_max
93 sll_allocate(adv, error)
95 call adv%init(nc_eta1, eta1_min, eta1_max)
102 sll_int32,
intent(in) :: nc_eta1
103 sll_real64,
intent(in) :: eta1_min
104 sll_real64,
intent(in) :: eta1_max
110 adv%eta1_min = eta1_min
111 adv%eta1_max = eta1_max
112 adv%nc_eta1 = nc_eta1
113 adv%delta_eta1 = (eta1_max - eta1_min)/real(nc_eta1, f64)
115 sll_clear_allocate(adv%d_dx(1:nc_eta1), error)
116 sll_allocate(adv%fk(1:nc_eta1/2 + 1), error)
117 sll_allocate(adv%ek(1:nc_eta1/2 + 1), error)
118 sll_allocate(adv%r0(1:nc_eta1/2 + 1), error)
119 sll_allocate(adv%r1(1:nc_eta1/2 + 1), error)
120 adv%fk = (0.0_f64, 0.0_f64)
121 adv%ek = (0.0_f64, 0.0_f64)
122 adv%r0 = (0.0_f64, 0.0_f64)
123 adv%r1 = (0.0_f64, 0.0_f64)
128 sll_clear_allocate(adv%kx(1:nc_eta1/2 + 1), error)
130 kx0 = 2._f64*
sll_p_pi/(eta1_max - eta1_min)
133 do i = 2, nc_eta1/2 + 1
134 adv%kx(i) = real(i - 1, f64)*kx0
142 sll_real64,
dimension(:),
intent(in) :: a
143 sll_real64,
intent(in) :: dt
144 sll_real64,
dimension(:),
intent(in) :: input
145 sll_real64,
dimension(:),
intent(out) :: output
147 character(len=*),
parameter :: this_sub_name =
'advect_1d'
148 sll_int32 :: num_cells
150 num_cells = adv%nc_eta1
151 output(1:num_cells) = a(1:num_cells)*input(1:num_cells)*dt
152 sll_error(this_sub_name,
"ampere advect_1d not implemented.")
168 sll_real64,
intent(in) :: a
169 sll_real64,
intent(in) :: dt
170 sll_real64,
dimension(:),
intent(in) :: input
171 sll_real64,
dimension(:),
intent(out) :: output
177 adv%d_dx = input(1:nc_x)
180 adv%fk(i) = adv%fk(i)*cmplx(cos(adv%kx(i)*a*dt), -sin(adv%kx(i)*a*dt), kind=f64)
184 output(1:nc_x) = adv%d_dx/real(nc_x, f64)
185 output(nc_x + 1) = output(1)
subroutine advect_1d(adv, a, dt, input, output)
subroutine advector_1d_ampere_init(adv, nc_eta1, eta1_min, eta1_max)
type(sll_t_advector_1d_ampere) function, pointer, public sll_f_new_advector_1d_ampere(nc_eta1, eta1_min, eta1_max)
subroutine advect_1d_constant(adv, a, dt, input, output)
Abstract class for advection.
Fortran module where set some physical and mathematical constants.
real(kind=f64), parameter, public sll_p_pi
subroutine, public sll_s_fft_exec_r2c_1d(plan, array_in, array_out)
Compute fast Fourier transform in real to complex mode.
subroutine, public sll_s_fft_free(plan)
Delete a plan.
subroutine, public sll_s_fft_init_r2c_1d(plan, nx, array_in, array_out, normalized, aligned, optimization)
Create new 1d real to complex plan for forward FFT.
subroutine, public sll_s_fft_exec_c2r_1d(plan, array_in, array_out)
Compute fast Fourier transform in complex to real mode.
subroutine, public sll_s_fft_init_c2r_1d(plan, nx, array_in, array_out, normalized, aligned, optimization)
Create new 1d complex to real plan for backward FFT.
Type for FFT plan in SeLaLib.