-
Notifications
You must be signed in to change notification settings - Fork 0
/
tranx2.src
148 lines (148 loc) · 4.46 KB
/
tranx2.src
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include "zeus2d.def"
c=======================================================================
c////////////////////////// SUBROUTINE TRANX2 \\\\\\\\\\\\\\\\\\\\\\\\
c
subroutine tranx2(mflx2,s3)
c
c PURPOSE: Transports all zone centered variables in the 2-direction
c only. Currently transported are: density
c energy density
c 3-momentum
c 3-magnetic field.
c radiation energy density
c The consistent transport algorithm is used, including the effects of
c grid compression. The transported fluxes are thus given by the mass
c fluxes times the time centered area of the control volume faces times
c the interpolated variable. Interpolations are performed in X2INTZC.
c
c INPUT ARGUMENTS:
c s3 = momentum density in 3-direction
c
c OUTPUT ARGUMENTS:
c mflx2 = mass flux in 2-direction
c s3 = "half"-updated momentum density in 3-direction
c
c EXTERNALS: X2INTZC
c
c LOCALS:
c-----------------------------------------------------------------------
implicit NONE
#include "param.h"
#include "root.h"
#include "grid.h"
#include "field.h"
#include "scratch.h"
REAL mflx2(in,jn),s3(in,jn)
c
integer i,j
REAL atwid(in),vel2(jn),td(jn),eod2(jn),pr(jn),esc
& ,dtwid2(jn),etwid2(jn)
& ,dflx2(jn) ,eflx2(jn)
equivalence (atwid,wi0) , (vel2,wj1) , (eod2,eflx2,wj2)
& ,(dtwid2,wj3)
& ,(etwid2,wj4) , (td,dflx2,wj5),(pr,wj13)
#ifdef ROTATE
REAL tv3(jn),v3twid2(jn),s3flx2(jn)
equivalence (v3twid2,wj7) , (tv3,s3flx2,wj8)
#endif
#ifdef MHD
REAL b3od2(jn),b3twid2(jn),b3flx2(jn)
equivalence (b3od2,b3flx2,wj9) , (b3twid2,wj0)
#endif
#ifdef RAD
REAL erod2(jn),ertwid2(jn),erflx2(jn),ersc,sasum
external sasum
equivalence (erod2,erflx2,wj11),(ertwid2,wj12)
#endif
c
external x2intzc
c\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///////////////////////////////////
c=======================================================================
c Check for 1-D problem in 1-direction
c Compute time-centered area factor
c
if (nx2z .le. 1) return
do 10 i=is,ie
atwid(i) = g31b(i)*dx1a(i)/dvl1a(i)
10 continue
e sc = 1.0
#ifdef RAD
ersc = sasum(in*jn,er,1)/float(nx1z*nx2z)
e sc = sasum(in*jn,e ,1)/float(nx1z*nx2z)
#endif
c
c Interpolate quantities to zone faces in the 2-direction.
c vel is the relative fluid velocity at interpolation points.
c
do 100 i=is,ie
do 20 j=ji(i),jop1(i)
vel2(j) = v2(i,j) - vg2(j)
20 continue
do 30 j=jim2(i),jop2(i)
td (j) = d (i,j)
eod2 (j) = e (i,j)/d(i,j)/esc
if (gamma-1.0.eq.0.0) then
pr (j) = ciso**2*d(i,j)
else
pr (j) = (gamma-1.0)*e(i,j)
endif
#ifdef ROTATE
tv3 (j) = v3(i,j)
#endif
#ifdef MHD
b3od2(j) = b3(i,j)/d(i,j)
#endif
#ifdef RAD
erod2(j) = er(i,j)/d(i,j)/ersc
#endif
30 continue
call x2intzc(td ,vel2,pr,i,g2b,iordd ,istpd ,d twid2)
call x2intzc(e od2,vel2,pr,i,g2b,iorde , 0 ,e twid2)
#ifdef ROTATE
call x2intzc(tv3 ,vel2,pr,i,g2b,iords3, 0 ,v3twid2)
#endif
#ifdef MHD
call x2intzc(b3od2,vel2,pr,i,g2b,iordb3, 0 ,b3twid2)
#endif
#ifdef RAD
call x2intzc(erod2,vel2,pr,i,g2b,iorder, 0 ,ertwid2)
#endif
c
c Construct fluxes at interfaces, including the mass flux which is
c passed to MOMX1
c
do 40 j=ji(i),jop1(i)
m flx2(i,j) = vel2(j)*dt*dtwid2(j)
d flx2(j) = mflx2(i,j)*atwid(i)*g32ah(j)
e flx2(j) = dflx2( j)*e twid2(j)*esc
#ifdef ROTATE
s3flx2(j) = dflx2( j)*v3twid2(j)*g31b(i)*g32a(j)
#endif
#ifdef MHD
b3flx2(j) = mflx2(i,j)*b3twid2(j)/g2b(i)
#endif
#ifdef RAD
erflx2(j) = dflx2( j)*ertwid2(j)*ersc
#endif
40 continue
c
c Perform advection using fluxes. Note timestep dt is hidden in the
c fluxes via the mass fluxes.
c
do 50 j=ji(i),jo(i)
d (i,j) = (d (i,j)*dvl2a(j)-(d flx2(j+1)-d flx2(j)))/dvl2an(j)
e (i,j) = (e (i,j)*dvl2a(j)-(e flx2(j+1)-e flx2(j)))/dvl2an(j)
#ifdef ROTATE
s3(i,j) = (s3(i,j)*dvl2a(j)-(s3flx2(j+1)-s3flx2(j)))/dvl2an(j)
#endif
#ifdef MHD
b3(i,j) = (b3(i,j)*d x2a(j)-(b3flx2(j+1)-b3flx2(j)))/d x2an(j)
#endif
#ifdef RAD
er(i,j) = (er(i,j)*dvl2a(j)-(erflx2(j+1)-erflx2(j)))/dvl2an(j)
#endif
50 continue
100 continue
c
return
end