Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_distribution_function.F90
Go to the documentation of this file.
1 
4 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 #include "sll_memory.h"
6 #include "sll_working_precision.h"
7 
8  use sll_m_cartesian_meshes, only: &
10 
13 
14  use sll_m_interpolators_1d_base, only: &
16 
17  use sll_m_scalar_field_2d_old, only: &
21 
26 
27  implicit none
28 
29  public :: &
31  sll_t_distribution_function_2d
32 
33  private
34 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
35 
36 #define NEW_TYPE_FOR_DF( new_df_type, extended_type) \
37  type, extends(extended_type) :: new_df_type; \
38  sll_real64 :: pmass; \
39  sll_real64 :: pcharge; \
40  sll_real64 :: average; \
41  end type new_df_type
42 
43 !NEW_TYPE_FOR_DF(sll_distribution_function_2D_t, sll_t_scalar_field_2d)
44 !NEW_TYPE_FOR_DF(sll_distribution_function_4D_t, scalar_field_4d)
45 
46  new_type_for_df(sll_t_distribution_function_2d, sll_t_scalar_field_2d)
47 
48 !!$ interface write_distribution_function
49 !!$ module procedure write_distribution_function_2D, &
50 !!$ write_distribution_function_4D
51 !!$ end interface
52 
53 #undef NEW_TYPE_FOR_DF
54 
55 contains
56 
57 #if 1
59  this, &
60  transf, &
61  data_position, &
62  name, &
63  data_func)
64 
65  class(sll_t_distribution_function_2d) :: this
66  class(sll_c_coordinate_transformation_2d_base), pointer :: transf
67  procedure(sll_i_scalar_function_2d_old) :: data_func
68  sll_int32, intent(in) :: data_position
69  character(len=*), intent(in) :: name
70  sll_int32 :: ierr
71  sll_int32 :: i1, i2
72  sll_real64 :: eta1, eta2
73  sll_real64 :: delta1, delta2
74 
75  this%transf => transf
76  this%plot_counter = 0
77  this%name = name
78  this%data_position = data_position
79  this%pcharge = 1.0_f64
80  this%pmass = 1.0_f64
81  associate(mesh => transf%mesh)
82 
83  if (data_position == sll_p_node_centered_field) then
84  sll_allocate(this%data(mesh%num_cells1 + 1, mesh%num_cells2 + 1), ierr)
85  do i2 = 1, mesh%num_cells2 + 1
86  do i1 = 1, mesh%num_cells1 + 1
87  this%data(i1, i2) = data_func(transf%x1_at_node(i1, i2), &
88  transf%x2_at_node(i1, i2))
89  end do
90  end do
91  else if (data_position == sll_p_cell_centered_field) then
92  sll_allocate(this%data(mesh%num_cells1 + 1, mesh%num_cells2 + 1), ierr)
93  delta1 = 1.0_f64/mesh%num_cells1
94  delta2 = 1.0_f64/mesh%num_cells2
95  eta2 = 0.5_f64*delta2
96  do i2 = 1, mesh%num_cells2
97  eta1 = 0.5_f64*delta1
98  do i1 = 1, mesh%num_cells1
99  this%data(i1, i2) = data_func(transf%x1(eta1, eta2), &
100  transf%x2(eta1, eta2))*transf%jacobian(eta1, eta2)
101  eta1 = eta1 + delta1
102  end do
103  eta2 = eta2 + delta2
104  end do
105  end if
106 
107  end associate
108  end subroutine sll_new_distribution_function_2d
109 
111  this, &
112  mass, &
113  charge, &
114  field_name, &
115  transf, &
116  data_position, &
117  eta1_interpolator, &
118  eta2_interpolator, &
119  initializer)
120 
121  class(sll_c_coordinate_transformation_2d_base), pointer :: transf
122  class(sll_c_interpolator_1d), pointer :: eta1_interpolator
123  class(sll_c_interpolator_1d), pointer :: eta2_interpolator
124  class(sll_c_scalar_field_2d_initializer_base), pointer, optional :: initializer
125  type(sll_t_distribution_function_2d), intent(inout) :: this
126  sll_real64, intent(in) :: mass
127  sll_real64, intent(in) :: charge
128  character(len=*), intent(in) :: field_name
129  sll_int32, intent(in) :: data_position
130 
131  this%pmass = mass
132  this%pcharge = charge
133 
134  call sll_s_scalar_field_2d_init( &
135  this, &
136  field_name, &
137  transf, &
138  data_position, &
139  eta1_interpolator, &
140  eta2_interpolator, &
141  initializer)
143 #endif
144 
145 !!$ function sll_new_distribution_function_4D( mesh_descriptor_x, &
146 !!$ mesh_descriptor_v, &
147 !!$ center, name )
148 !!$
149 !!$ type(sll_distribution_function_4D_t), pointer :: &
150 !!$ sll_new_distribution_function_4D
151 !!$ type(mesh_descriptor_2D), pointer :: mesh_descriptor_x
152 !!$ type(mesh_descriptor_2D), pointer :: mesh_descriptor_v
153 !!$ sll_int32, intent(in) :: center
154 !!$ character(len=*), intent(in) :: name
155 !!$ sll_int32 :: ierr
156 !!$ !
157 !!$ SLL_ASSERT(associated(mesh_descriptor_x))
158 !!$ SLL_ASSERT(associated(mesh_descriptor_v))
159 !!$ SLL_ALLOCATE(sll_new_distribution_function_4D, ierr)
160 !!$ sll_new_distribution_function_4D%field => &
161 !!$ new_field_4D_vec1( mesh_descriptor_x, mesh_descriptor_v )
162 !!$ sll_new_distribution_function_4D%pcharge = 1.0_f64
163 !!$ sll_new_distribution_function_4D%pmass = 1.0_f64
164 !!$ sll_new_distribution_function_4D%plot_counter = 0
165 !!$ sll_new_distribution_function_4D%center = center
166 !!$ sll_new_distribution_function_4D%name = name
167 !!$
168 !!$ end function sll_new_distribution_function_4D
169 
170 !!$ subroutine sll_delete_distribution_function( f )
171 !!$ type(sll_distribution_function_2D_t), pointer :: f
172 !!$ sll_int32 :: ierr
173 !!$ call delete_field_2D_vec1(f%field)
174 !!$ SLL_DEALLOCATE(f, ierr)
175 !!$ end subroutine sll_delete_distribution_function
176 
177 !!$#define NEW_ACCESS_FUNCTION( func_name, typ, slot ) \
178 !!$ function func_name( f ) ; \
179 !!$ typ :: func_name ;\
180 !!$ type(sll_distribution_function_2D_t), pointer :: f ;\
181 !!$ func_name = f%field%descriptor%slot ;\
182 !!$ end function func_name
183 !!$
184 !!$ NEW_ACCESS_FUNCTION(get_df_nc_eta1, sll_int32, nc_eta1)
185 !!$ NEW_ACCESS_FUNCTION(get_df_eta1_min, sll_real64, eta1_min)
186 !!$ NEW_ACCESS_FUNCTION(get_df_eta1_max, sll_real64, eta1_max)
187 !!$ NEW_ACCESS_FUNCTION(get_df_delta_eta1, sll_real64, delta_eta1)
188 !!$ NEW_ACCESS_FUNCTION(get_df_nc_eta2, sll_int32, nc_eta2)
189 !!$ NEW_ACCESS_FUNCTION(get_df_eta2_min, sll_real64, eta2_min)
190 !!$ NEW_ACCESS_FUNCTION(get_df_eta2_max, sll_real64, eta2_max)
191 !!$ NEW_ACCESS_FUNCTION(get_df_delta_eta2, sll_real64, delta_eta2)
192 !!$ NEW_ACCESS_FUNCTION(get_df_boundary1_type, sll_int32, boundary1_type)
193 !!$ NEW_ACCESS_FUNCTION(get_df_boundary2_type, sll_int32, boundary2_type)
194 !!$#undef NEW_ACCESS_FUNCTION
195 !!$
196 !!$ function get_df_x1 ( f )
197 !!$ procedure(scalar_function_2D), pointer :: get_df_x1
198 !!$ type(sll_distribution_function_2D_t), pointer :: f
199 !!$ get_df_x1 => f%mesh%x1
200 !!$ end function get_df_x1
201 !!$
202 !!$ function get_df_x2 ( f )
203 !!$ procedure(scalar_function_2D), pointer :: get_df_x2
204 !!$ type(sll_distribution_function_2D_t), pointer :: f
205 !!$ get_df_x2 => f%field%descriptor%geom%x2
206 !!$ end function get_df_x2
207 !!$
208 !!$ function get_df_eta1 ( f )
209 !!$ procedure(scalar_function_2D), pointer :: get_df_eta1
210 !!$ type(sll_distribution_function_2D_t), pointer :: f
211 !!$ get_df_eta1 => f%field%descriptor%geom%eta1
212 !!$ end function get_df_eta1
213 !!$
214 !!$ function get_df_eta2 ( f )
215 !!$ procedure(scalar_function_2D), pointer :: get_df_eta2
216 !!$ type(sll_distribution_function_2D_t), pointer :: f
217 !!$ get_df_eta2 => f%field%descriptor%geom%eta2
218 !!$ end function get_df_eta2
219 !!$
220 !!$ function get_df_jac11 ( f )
221 !!$ procedure(scalar_function_2D), pointer :: get_df_jac11
222 !!$ type(sll_distribution_function_2D_t), pointer :: f
223 !!$ get_df_jac11 => f%field%descriptor%geom%Jacobian11
224 !!$ end function get_df_jac11
225 !!$
226 !!$ function get_df_jac12 ( f )
227 !!$ procedure(scalar_function_2D), pointer :: get_df_jac12
228 !!$ type(sll_distribution_function_2D_t), pointer :: f
229 !!$ get_df_jac12 => f%field%descriptor%geom%Jacobian12
230 !!$ end function get_df_jac12
231 !!$
232 !!$ function get_df_jac21 ( f )
233 !!$ procedure(scalar_function_2D), pointer :: get_df_jac21
234 !!$ type(sll_distribution_function_2D_t), pointer :: f
235 !!$ get_df_jac21 => f%field%descriptor%geom%Jacobian21
236 !!$ end function get_df_jac21
237 !!$
238 !!$ function get_df_jac22 ( f )
239 !!$ procedure(scalar_function_2D), pointer :: get_df_jac22
240 !!$ type(sll_distribution_function_2D_t), pointer :: f
241 !!$ get_df_jac22 => f%field%descriptor%geom%Jacobian22
242 !!$ end function get_df_jac22
243 !!$
244 !!$ function get_df_jac ( f )
245 !!$ procedure(scalar_function_2D), pointer :: get_df_jac
246 !!$ type(sll_distribution_function_2D_t), pointer :: f
247 !!$ get_df_jac => f%field%descriptor%geom%Jacobian
248 !!$ end function get_df_jac
249 !!$
250 !!$ function get_df_x1_at_i ( f )
251 !!$ sll_real64, dimension(:,:), pointer :: get_df_x1_at_i
252 !!$ type(sll_distribution_function_2D_t), pointer :: f
253 !!$ get_df_x1_at_i => f%field%descriptor%geom%x1_at_i
254 !!$ end function get_df_x1_at_i
255 !!$
256 !!$ function get_df_x2_at_i ( f )
257 !!$ sll_real64, dimension(:,:), pointer :: get_df_x2_at_i
258 !!$ type(sll_distribution_function_2D_t), pointer :: f
259 !!$ get_df_x2_at_i => f%field%descriptor%geom%x2_at_i
260 !!$ end function get_df_x2_at_i
261 !!$
262 !!$ function get_df_x1c_at_i ( f )
263 !!$ sll_real64, dimension(:,:), pointer :: get_df_x1c_at_i
264 !!$ type(sll_distribution_function_2D_t), pointer :: f
265 !!$ get_df_x1c_at_i => f%field%descriptor%geom%x1c_at_i
266 !!$ end function get_df_x1c_at_i
267 !!$
268 !!$ function get_df_x2c_at_i ( f )
269 !!$ sll_real64, dimension(:,:), pointer :: get_df_x2c_at_i
270 !!$ type(sll_distribution_function_2D_t), pointer :: f
271 !!$ get_df_x2c_at_i => f%field%descriptor%geom%x2c_at_i
272 !!$ end function get_df_x2c_at_i
273 !!$
274 !!$ function get_df_jac_at_i ( f )
275 !!$ sll_real64, dimension(:,:), pointer :: get_df_jac_at_i
276 !!$ type(sll_distribution_function_2D_t), pointer :: f
277 !!$ get_df_jac_at_i => f%field%descriptor%geom%Jacobian_at_i
278 !!$ end function get_df_jac_at_i
279 !!$
280 !!$
281 !!$ function sll_get_df_val( f, i, j )
282 !!$ sll_real64 :: sll_get_df_val
283 !!$ type(sll_distribution_function_2D_t), pointer :: f
284 !!$ sll_int32 :: i, j
285 !!$ sll_get_df_val = f%field%data(i,j)
286 !!$ end function sll_get_df_val
287 !!$
288 !!$ subroutine sll_set_df_val( f, i, j, val )
289 !!$ type(sll_distribution_function_2D_t), pointer :: f
290 !!$ sll_int32 :: i, j
291 !!$ sll_real64 :: val
292 !!$ f%field%data(i,j) = val
293 !!$ end subroutine sll_set_df_val
294 !!$
295 !!$ subroutine sll_init_distribution_function_2D( dist_func_2D, test_case)
296 !!$ type(sll_distribution_function_2D_t), pointer :: dist_func_2D
297 !!$ sll_int32 :: test_case
298 !!$ ! local variables
299 !!$ procedure(scalar_function_2D), pointer :: x1, x2, jac
300 !!$ sll_real64, dimension(:,:), pointer :: x1c_at_i, x2c_at_i, jac_at_i
301 !!$ sll_int32 :: nc_eta1, nc_eta2, i1, i2
302 !!$ sll_real64 :: delta_eta1, delta_eta2, eta1_min, eta2_min
303 !!$ sll_real64 :: x, vx, xx, vv, eps, kx, xi, v0, fval, xoffset, voffset
304 !!$ sll_real64 :: eta1
305 !!$ sll_real64 :: eta2
306 !!$ sll_real64 :: avg, avg_jac
307 !!$
308 !!$ nc_eta1 = get_df_nc_eta1( dist_func_2D )
309 !!$ delta_eta1 = get_df_delta_eta1( dist_func_2D )
310 !!$ eta1_min = get_df_eta1_min( dist_func_2D )
311 !!$ nc_eta2 = get_df_nc_eta2( dist_func_2D )
312 !!$ delta_eta2 = get_df_delta_eta2( dist_func_2D )
313 !!$ eta2_min = get_df_eta2_min( dist_func_2D )
314 !!$ x1 => get_df_x1 ( dist_func_2D )
315 !!$ x2 => get_df_x2 ( dist_func_2D )
316 !!$ jac => get_df_jac ( dist_func_2D )
317 !!$ x1c_at_i => get_df_x1c_at_i ( dist_func_2D )
318 !!$ x2c_at_i => get_df_x2c_at_i ( dist_func_2D )
319 !!$ jac_at_i => get_df_jac_at_i ( dist_func_2D )
320 !!$
321 !!$ if (dist_func_2D%center==CELL_CENTERED_DF) then ! half cell offset
322 !!$ eta1_min = eta1_min + 0.5_f64 * delta_eta1
323 !!$ eta2_min = eta2_min + 0.5_f64 * delta_eta2
324 !!$ end if
325 !!$
326 !!$
327 !!$ end subroutine sll_init_distribution_function_2D
328 !!$
329 !!$ subroutine sll_init_distribution_function_4D( dist_func_4D, test_case)
330 !!$
331 !!$ type(sll_distribution_function_4D_t), pointer :: dist_func_4D
332 !!$ sll_int32 :: test_case
333 !!$
334 !!$ sll_int32 :: nnode_x1, nnode_x2, nnode_v1, nnode_v2
335 !!$ sll_real64 :: delta_x1, delta_x2, x1_min, x2_min
336 !!$ sll_real64 :: delta_v1, delta_v2, v1_min, v2_min
337 !!$ sll_real64 :: x1, v1, x2, v2, eps, kx, ky, xi, vsq
338 !!$ sll_int32 :: ix, jx, iv, jv
339 !!$
340 !!$ x1_min = dist_func_4D%field%descriptor_x%eta1_min
341 !!$ nnode_x1 = dist_func_4D%field%descriptor_x%nc_eta1+1
342 !!$ delta_x1 = dist_func_4D%field%descriptor_x%delta_eta1
343 !!$
344 !!$ x2_min = dist_func_4D%field%descriptor_x%eta2_min
345 !!$ nnode_x2 = dist_func_4D%field%descriptor_x%nc_eta2+1
346 !!$ delta_x2 = dist_func_4D%field%descriptor_x%delta_eta2
347 !!$
348 !!$ v1_min = dist_func_4D%field%descriptor_v%eta1_min
349 !!$ nnode_v1 = dist_func_4D%field%descriptor_v%nc_eta1+1
350 !!$ delta_v1 = dist_func_4D%field%descriptor_v%delta_eta1
351 !!$
352 !!$ v2_min = dist_func_4D%field%descriptor_v%eta2_min
353 !!$ nnode_v2 = dist_func_4D%field%descriptor_v%nc_eta2+1
354 !!$ delta_v2 = dist_func_4D%field%descriptor_v%delta_eta2
355 !!$
356 !!$ select case (test_case)
357 !!$ case (LANDAU)
358 !!$ xi = 0.9
359 !!$ eps = 0.05
360 !!$ kx = 2.0_f64*sll_p_pi/(nnode_x1*nnode_x2)
361 !!$ ky = 2.0_f64*sll_p_pi/(nnode_v1*nnode_v2)
362 !!$ do jv=1, nnode_v2
363 !!$ v2 = v2_min+(jv-1)*delta_v2
364 !!$ do iv=1, nnode_v1
365 !!$ v1 = v1_min+(iv-1)*delta_v1
366 !!$ vsq = v1*v1+v2*v2
367 !!$ do jx=1, nnode_x2
368 !!$ x2=x2_min+(jx-1)*delta_x2
369 !!$ do ix=1, nnode_x1
370 !!$ x1=x1_min+(ix-1)*delta_x1
371 !!$ dist_func_4D%field%data(ix,jx,iv,jv)= &
372 !!$ (1+eps*cos(kx*x1))*1/(2.*sll_p_pi)*exp(-.5*vsq)
373 !!$ end do
374 !!$ end do
375 !!$ end do
376 !!$ end do
377 !!$ end select
378 !!$ end subroutine sll_init_distribution_function_4D
379 !!$
380 !!$ ! compute integral of f with respect to x2 (-> rho)
381 !!$ ! using a trapezoidal rule on a uniform grid of physical space
382 !!$ subroutine compute_rho(dist_func_2D,rho,npoints)
383 !!$ type(sll_distribution_function_2D_t), pointer :: dist_func_2D
384 !!$ type(field_1D_vec1), pointer :: rho
385 !!$ sll_int32 :: npoints ! number of integration points
386 !!$
387 !!$ ! local variables
388 !!$ procedure(scalar_function_2D), pointer :: x1f
389 !!$ procedure(scalar_function_2D), pointer :: x2f
390 !!$ procedure(scalar_function_2D), pointer :: eta1f
391 !!$ procedure(scalar_function_2D), pointer :: eta2f
392 !!$ sll_int32 :: nc_eta1
393 !!$ sll_int32 :: nc_eta2
394 !!$ sll_int32 :: nc_rho
395 !!$ sll_real64 :: eta1_min
396 !!$ sll_real64 :: eta2_min
397 !!$ sll_real64 :: delta_eta1
398 !!$ sll_real64 :: delta_eta2
399 !!$ sll_real64 :: x1min_rho
400 !!$ sll_real64 :: delta_rho
401 !!$ sll_int32 :: i
402 !!$ sll_int32 :: i1
403 !!$ sll_int32 :: i2
404 !!$ sll_real64 :: x2min
405 !!$ sll_real64 :: x2max
406 !!$ sll_real64 :: x1
407 !!$ sll_real64 :: x2
408 !!$ sll_real64 :: delta_int
409 !!$ sll_real64 :: sum
410 !!$ sll_real64 :: eta1
411 !!$ sll_real64 :: eta2
412 !!$
413 !!$ ! get mesh data attached to f
414 !!$ nc_eta1 = get_df_nc_eta1( dist_func_2D )
415 !!$ delta_eta1 = get_df_delta_eta1( dist_func_2D )
416 !!$ eta1_min = get_df_eta1_min( dist_func_2D )
417 !!$ nc_eta2 = get_df_nc_eta2( dist_func_2D )
418 !!$ delta_eta2 = get_df_delta_eta2( dist_func_2D )
419 !!$ eta2_min = get_df_eta2_min( dist_func_2D )
420 !!$ x1f => get_df_x1 ( dist_func_2D )
421 !!$ x2f => get_df_x2 ( dist_func_2D )
422 !!$ eta1f => get_df_eta1 ( dist_func_2D )
423 !!$ eta2f => get_df_eta2 ( dist_func_2D )
424 !!$
425 !!$ ! get mesh data attached to rho
426 !!$ nc_rho = GET_FIELD_NC_ETA1( rho )
427 !!$ x1min_rho = GET_FIELD_ETA1_MIN( rho )
428 !!$ delta_rho = GET_FIELD_DELTA_ETA1( rho )
429 !!$
430 !!$ ! find minimal and maximal values of x2
431 !!$ x2min = x2f(1.0_f64,1.0_f64)
432 !!$ x2max = x2min
433 !!$ eta1 = eta1_min
434 !!$ do i1 = 1, nc_eta1 + 1
435 !!$ eta2 = eta2_min
436 !!$ do i2 = 1, nc_eta2 + 1
437 !!$ x2 = x2f(eta1,eta2)
438 !!$ if ( x2 > x2max ) then
439 !!$ x2max = x2
440 !!$ else if ( x2 < x2min ) then
441 !!$ x2min = x2
442 !!$ end if
443 !!$ eta2 = eta2 + delta_eta2
444 !!$ end do
445 !!$ eta1 = eta1 + delta_eta1
446 !!$ end do
447 !!$ ! set delta_int the subdivision step
448 !!$ delta_int = (x2max-x2min)/npoints
449 !!$ x1 = x1min_rho
450 !!$ do i1 = 1, nc_rho + 1
451 !!$ sum = 0.0_f64
452 !!$ x2 = x2min
453 !!$ do i2 = 1, npoints
454 !!$ !sum = sum + FIELD_2D_AT_X( dist_func_2D, eta1f(x1, x2), eta2f(x1,x2) )
455 !!$ ! FIELD_2D_AT_X needs to be defined and implemented using linear or 2D cubic spline interpolation
456 !!$ ! beware of case where eta1f and eta2f fall outside the grid (in this case 0 should be returned)
457 !!$ x2 = x2 + delta_int
458 !!$ end do
459 !!$ SET_FIELD_1D_VALUE_AT_I( rho, i1, delta_int * sum )
460 !!$ x1 = x1 + delta_rho
461 !!$ end do
462 !!$
463 !!$ end subroutine compute_rho
464 !!$
465 !!$ subroutine write_distribution_function_2D ( f )
466 !!$ type(sll_distribution_function_2D_t), pointer :: f
467 !!$ character(len=4) :: counter
468 !!$ character(64) :: name
469 !!$ logical, parameter :: jacobian = .true.
470 !!$ call int2string(f%plot_counter,counter)
471 !!$ name = trim(f%name)//counter
472 !!$ call write_field_2d_vec1 ( f%field, name, jacobian, f%average, f%center )
473 !!$ f%plot_counter = f%plot_counter + 1
474 !!$ end subroutine write_distribution_function_2D
475 !!$
476 !!$
477 !!$ subroutine write_distribution_function_4D ( f )
478 !!$ type(sll_distribution_function_4D_t), pointer :: f
479 !!$ character(len=4) :: counter
480 !!$ character(64) :: name
481 !!$ type(mesh_descriptor_2D), pointer :: mesh_x
482 !!$ type(mesh_descriptor_2D), pointer :: mesh_v
483 !!$ sll_int32 :: nnode_x1, nnode_x2
484 !!$ sll_int32 :: nnode_v1, nnode_v2
485 !!$ sll_real64, dimension(:,:), pointer :: val
486 !!$ sll_int32 :: error
487 !!$ sll_int32 :: ix
488 !!$ sll_int32 :: jx
489 !!$
490 !!$ call int2string(f%plot_counter,counter)
491 !!$ name = trim(f%name)//counter
492 !!$
493 !!$ mesh_x => f%field%descriptor_x
494 !!$ mesh_v => f%field%descriptor_v
495 !!$
496 !!$ SLL_ASSERT(associated(mesh_x))
497 !!$ SLL_ASSERT(associated(mesh_v))
498 !!$
499 !!$ nnode_x1 = mesh_x%nc_eta1 + 1
500 !!$ nnode_x2 = mesh_x%nc_eta2 + 1
501 !!$ nnode_v1 = mesh_v%nc_eta1 + 1
502 !!$ nnode_v2 = mesh_v%nc_eta2 + 1
503 !!$
504 !!$ SLL_ALLOCATE(val(nnode_x1,nnode_x2), error)
505 !!$ do ix = 1, nnode_x1
506 !!$ do jx = 1, nnode_x2
507 !!$ val(ix,jx) = sum(f%field%data(ix,jx,:,:))
508 !!$ end do
509 !!$ end do
510 !!$
511 !!$ call write_vec1d(val,nnode_x1,nnode_x2,name,"mesh_x",f%center)
512 !!$
513 !!$ f%plot_counter = f%plot_counter + 1
514 !!$ end subroutine write_distribution_function_4D
515 
Cartesian mesh basic types.
Abstract class for coordinate transformations.
Implements the distribution function types.
subroutine sll_new_distribution_function_2d(this, transf, data_position, name, data_func)
subroutine, public sll_s_distribution_function_2d_init(this, mass, charge, field_name, transf, data_position, eta1_interpolator, eta2_interpolator, initializer)
Module for 1D interpolation and reconstruction.
Scalar field on mesh with coordinate transformation.
subroutine, public sll_s_scalar_field_2d_init(this, field_name, transf, data_position, eta1_interpolator, eta2_interpolator, initializer)
Abstract class for 1D interpolation and reconstruction.
    Report Typos and Errors