-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_clareshk1D.f90
83 lines (77 loc) · 1.8 KB
/
setup_clareshk1D.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
!----------------------------------------------------------------
! Set up a uniform density cartesian grid of particles in ND
!----------------------------------------------------------------
subroutine setup
!
!--include relevant global variables
!
use dimen_mhd, only:ndim
use debug, only:trace
use loguns, only:iprint
use bound,only:xmin,xmax,pext
use options, only:ibound
use part
use setup_params
use uniform_distributions
!
!--define local variables
!
implicit none
integer :: i
real :: massp,volume,totmass
real :: denszero,spsound,betamhd,theta,Bzero
!
!--allow for tracing flow
!
if (trace) write(iprint,*) ' entering subroutine setup(unifdis)'
!
!--set boundaries
!
ibound = 0 ! boundaries
nbpts = 0 ! use ghosts not fixed
xmin(:) = -1.5 ! set position of boundaries
xmax(:) = 1.5
spsound = 0.3
betamhd = 1.0
theta = pi/4. ! angle of magnetic field to shock
!
!--set up the uniform density grid
!
call set_uniform_cartesian(1,psep,xmin,xmax,.false.)
npart = ntotal
print*,'npart =',npart
!
!--determine particle mass
!
!!!denszero = 0.1
volume = product(xmax(:)-xmin(:))
totmass = 1.0 !!!denszero*volume
denszero = totmass/volume
massp = totmass/float(ntotal) ! average particle mass
! betamhd = pr/0.5*Bzero**2
Bzero = sqrt(2.*spsound**2*denszero/betamhd)
Bconst(1) = Bzero*cos(theta)
Bconst(2) = Bzero*sin(theta)
!
!--now assign particle properties
!
do i=1,ntotal
vel(1,i) = 50.*spsound
dens(i) = denszero
pmass(i) = massp
uu(i) = 1.5*spsound**2 ! isothermal
Bfield(:,i) = Bconst(:)
enddo
pext = spsound**2*denszero
!
!--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