-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcopy_particle.f90
115 lines (110 loc) · 4.01 KB
/
copy_particle.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
!------------------------------------------------------------------------------!
! NDSPMHD: A Smoothed Particle (Magneto)Hydrodynamics code for (astrophysical) !
! fluid dynamics simulations in 1, 2 and 3 spatial dimensions. !
! !
! (c) 2002-2015 Daniel Price !
! !
! http://users.monash.edu.au/~dprice/ndspmhd !
! daniel.price@monash.edu -or- dprice@cantab.net (forwards to current address) !
! !
! NDSPMHD comes with ABSOLUTELY NO WARRANTY. !
! This is free software; and you are welcome to redistribute !
! it under the terms of the GNU General Public License !
! (see LICENSE file for details) and the provision that !
! this notice remains intact. If you modify this file, please !
! note section 2a) of the GPLv2 states that: !
! !
! a) You must cause the modified files to carry prominent notices !
! stating that you changed the files and the date of any change. !
! !
! ChangeLog: !
!------------------------------------------------------------------------------!
!
!--copies all the particle properties from particle j to particle i
! just so you don't have to remember everything carried by the particles
! *does not copy particle position or velocity*
!
subroutine copy_particle(i,j)
use debug
use loguns
use eos
use derivB
use fmagarray
use hterms
use part
use rates
use xsph
use options, only:imhd,onef_dust
!use matrixcorr
implicit none
integer :: i,j
if (idebug(1:4).eq.'copy') write(iprint,*) 'copying particle ',j,' to particle ',i
! vel(:,i) = vel(:,j)
pmass(i) = pmass(j)
rho(i) = rho(j)
rhoalt(i) = rhoalt(j)
hh(i) = hh(j)
uu(i) = uu(j)
en(i) = en(j)
if (.not.(imhd.lt.0 .and. itype(i).gt.0)) Bevol(:,i) = Bevol(:,j)
Bfield(:,i) = Bfield(:,j)
alpha(:,i) = alpha(:,j)
psi(i) = psi(j)
gradh(i) = gradh(j)
gradhn(i) = gradhn(j)
gradsoft(i) = gradsoft(j)
gradgradh(i) = gradgradh(j)
if (allocated(zeta)) zeta(i) = zeta(j)
sqrtg(i) = sqrtg(j)
spsound(i) = spsound(j)
pr(i) = pr(j)
dens(i) = dens(j)
if (itype(i).ne.itypebnd .and. itype(i).ne.itypebnddust &
.and. itype(i).ne.itypebnd2 .and. itype(j).eq.itypegas) itype(i) = itype(j)
if (allocated(pmom)) pmom(:,i) = pmom(:,j)
force(:,i) = force(:,j)
drhodt(i) = drhodt(j)
dudt(i) = dudt(j)
dendt(i) = dendt(j)
dBevoldt(:,i) = dBevoldt(:,j)
gradpsi(:,i) = gradpsi(:,j)
dhdt(i) = dhdt(j)
daldt(:,i) = daldt(:,j)
dpsidt(i) = dpsidt(j)
xsphterm(:,i) = xsphterm(:,j) ! after here not crucial
fmag(:,i) = fmag(:,j)
divB(i) = divB(j)
curlB(:,i) = curlB(:,j)
!
! dust
!
if (onef_dust) then
dustfrac(:,i) = dustfrac(:,j)
dustevol(:,i) = dustevol(:,j)
ddustevoldt(:,i) = ddustevoldt(:,j)
deltav(:,i) = deltav(:,j)
ddeltavdt(:,i) = ddeltavdt(:,j)
rhodust(:,i) = rhodust(:,j)
rhogas(i) = rhogas(j)
endif
!
! quantum
!
if (allocated(P_Q)) then
P_Q(:,:,i) = P_Q(:,:,j)
endif
!
! viscosity
!
if (allocated(del2v)) del2v(:,i) = del2v(:,j)
if (allocated(graddivv)) graddivv(:,i) = graddivv(:,j)
if (allocated(rho0)) rho0(i) = rho0(j)
!gradmatrix(:,:,i) = gradmatrix(:,:,j)
!
! Note to self: don't forget, that if you *really*
! need to reassign particles, then you may also need
! to copy the part_in arrays used in the timestepping
! as well (I've spent a few days rediscovering this
! several times)
!
end subroutine copy_particle