-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_unifdis_cyl.f90
85 lines (80 loc) · 1.74 KB
/
setup_unifdis_cyl.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
!-------------------------------------------------------------------------
! Set up a uniform density grid of particles in cylindrical co-ordinates
!-------------------------------------------------------------------------
subroutine setup
!
!--include relevant global variables
!
use dimen_mhd
use debug
use loguns
use bound
use options
use part
use setup_params
!
!--define local variables
!
implicit none
integer :: i
real :: massp,volume,totmass
real :: denszero
!
!--allow for tracing flow
!
if (trace) write(iprint,*) ' Entering subroutine setup(unifdis)'
!
!--set co-ordinate system
!
igeom = 2
!
!--set boundaries
!
nbpts = 0 ! use ghosts not fixed
ibound(1) = 2 ! reflective in r
xmin(1) = 0.0 ! rmin
xmax(1) = 0.5*pi ! rmax
if (ndim.ge.2)then
ibound(2) = 3 ! periodic in phi
xmin(2) = 0.0 ! phi_min
xmax(2) = 2.*pi ! phi_max
endif
if (ndim.ge.3) then
ibound(3) = 0 ! nothing in z
endif
!
!--set up the uniform density grid
!
call set_uniform_cartesian(1,psep,xmin,xmax,.false.)
ntotal = npart
!
!--determine particle mass (WORK THIS OUT)
!
denszero = 1.0
volume = product(xmax(:)-xmin(:))
totmass = denszero*volume
massp = totmass/FLOAT(ntotal) ! average particle mass
!
!--now assign particle properties
! (note *do not* setup smoothing length as it depends on the conservative
! density rho which has not yet been calculated)
!
do i=1,ntotal
vel(:,i) = 0.
dens(i) = denszero
pmass(i) = massp
uu(i) = 1.0 ! isothermal
Bfield(:,i) = 0.
enddo
!
!--allow for tracing flow
!
if (trace) write(iprint,*) ' Exiting subroutine setup'
return
end
!
! use this routine to modify the dump upon code restart
!
subroutine modify_dump()
implicit none
end subroutine modify_dump