DISPATCH
particle_mod.f90
1
!===============================================================================
2
!> Particle data type, extends a dll_node data type, so it can become part of
3
!> a particle_list_t data type
4
!===============================================================================
5
MODULE
particle_mod
6
USE
iso_fortran_env
, only
: int8
7
USE
io_unit_mod
8
USE
dll_mod
9
implicit none
10
private
11
integer
,
save
:: id=0
12
!-----------------------------------------------------------------------------
13
type
,
public
,
extends
(
dll_node_t
)::
particle_t
14
integer(8)
:: id=0
15
integer
:: it=1
16
real
:: ds=1.0
17
real
:: mass=1.0
18
real(8)
:: time=0d0, dtime=0d0
19
integer(kind=int8)
,
allocatable
:: iit(:)
20
real
,
allocatable
:: v(:,:)
21
real(8)
,
allocatable
:: r(:,:), t(:)
22
contains
23
procedure
:: init
24
end type
25
integer
,
save
:: verbose=0
26
integer
,
save
:: nt=4
27
type
(
particle_t
),
public
:: particle
28
!-----------------------------------------------------------------------------
29
CONTAINS
30
31
!===============================================================================
32
!> Read parameters, and initialize a particle with a unique ID
33
!===============================================================================
34
SUBROUTINE
init (self)
35
class(
particle_t
):: self
36
logical
,
save
:: first_time=.true.
37
namelist /particle_params/ verbose, nt
38
!-----------------------------------------------------------------------------
39
if
(first_time)
then
40
!$omp critical (input_cr)
41
if
(first_time)
then
42
first_time = .false.
43
rewind(io_unit%input)
44
read
(io_unit%input, particle_params)
45
write
(io_unit%output, particle_params)
46
end if
47
!$omp end critical (input_cr)
48
end if
49
!$omp atomic
50
id = id+1
51
self%id = id
52
allocate
(self%r(3,nt), self%v(3,nt), self%t(nt), self%iit(nt))
53
self%r = 0.0_8
54
self%v = 0.0_8
55
self%t = 0.0_8
56
self%iit = 1
57
END SUBROUTINE
init
58
59
END MODULE
particle_mod
particle_mod
Particle data type, extends a dll_node data type, so it can become part of a particle_list_t data typ...
Definition:
particle_mod.f90:5
dll_mod
Doubly linked list (DLL), carrying anything, as simply as possible.
Definition:
dll_mod.f90:4
particle_mod::particle_t
Definition:
particle_mod.f90:13
io_unit_mod
Definition:
io_unit_mod.f90:5
dll_mod::dll_node_t
Definition:
dll_mod.f90:7
solvers
particles
particle_mod.f90
Generated by
1.8.13