1 #ifndef DOXYGEN_SHOULD_SKIP_THIS
21 module sll_m_poisson_1d_polar
23 #include "sll_memory.h"
24 #include "sll_working_precision.h"
25 #include "sll_errors.h"
33 sll_f_new_poisson_1d_polar, &
34 sll_t_poisson_1d_polar
45 procedure, pass(poisson) :: init => &
46 initialize_poisson_1d_polar
47 procedure, pass(poisson) :: compute_phi_from_rho => &
48 compute_phi_from_rho_1d_polar
49 procedure, pass(poisson) :: compute_E_from_rho => &
50 compute_e_from_rho_1d_polar
54 end type sll_t_poisson_1d_polar
57 function sll_f_new_poisson_1d_polar( &
64 type(sll_t_poisson_1d_polar),
pointer :: poisson
65 sll_real64,
intent(in) :: eta1_min
66 sll_real64,
intent(in) :: eta1_max
67 sll_int32,
intent(in) :: nc_eta1
68 sll_int32,
intent(in),
optional :: bc
71 sll_allocate(poisson, ierr)
72 call initialize_poisson_1d_polar( &
79 end function sll_f_new_poisson_1d_polar
81 subroutine initialize_poisson_1d_polar( &
87 class(sll_t_poisson_1d_polar) :: poisson
88 sll_real64,
intent(in) :: eta1_min
89 sll_real64,
intent(in) :: eta1_max
90 sll_int32,
intent(in) :: nc_eta1
91 sll_int32,
intent(in),
optional :: bc
95 print *,
'#Warning bc=', bc,
'present but not used'
97 poisson%length = eta1_max - eta1_min
98 poisson%nc_eta1 = nc_eta1
100 end subroutine initialize_poisson_1d_polar
103 subroutine compute_phi_from_rho_1d_polar(poisson, phi, rho)
104 class(sll_t_poisson_1d_polar) :: poisson
105 sll_real64,
dimension(:),
intent(in) :: rho
106 sll_real64,
dimension(:),
intent(out) :: phi
108 sll_error(
'compute_phi_from_rho_1d_polar',
'#not implemented yet')
110 end subroutine compute_phi_from_rho_1d_polar
113 subroutine compute_e_from_rho_1d_polar(poisson, E, rho)
114 class(sll_t_poisson_1d_polar) :: poisson
115 sll_real64,
dimension(:),
intent(in) :: rho
116 sll_real64,
dimension(:),
intent(out) :: e
123 e(1:n + 1) = rho(1:n + 1)
125 call poisson1dpolar(e, l, n)
127 end subroutine compute_e_from_rho_1d_polar
129 subroutine poisson1dpolar(E, L, N)
130 integer,
intent(in)::N
132 sll_real64,
dimension(:),
intent(inout) :: e
133 sll_real64,
intent(in) :: l
141 dx = l/(2._f64*real(n, f64))
147 enew = e(1 + n/2 + i)*dx
148 tmp = (tmp - eold)*(1._f64 - 1._f64/real(i, f64)) - enew
151 e(1 + n/2 - i) = -tmp
154 end subroutine poisson1dpolar
156 end module sll_m_poisson_1d_polar
157 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
Module interface to solve Poisson equation in 1D.