13 real:: eta_ohm, gamma_ad, rho_ions
14 logical:: mhd_ohm, mhd_ad, is_used
25 SUBROUTINE init (self)
28 real:: gamma_ad=75., rho_ions=1.0, eta_ohm=0.0
29 logical:: mhd_ad=.false., mhd_ohm=.false.
30 namelist /non_ideal_params/mhd_ad, mhd_ohm, gamma_ad, eta_ohm, rho_ions
33 read (io_unit%input, non_ideal_params,iostat=iostat)
34 if (io%master)
write (*, non_ideal_params)
35 self%mhd_Ohm = mhd_ohm
36 self%eta_Ohm = eta_ohm
38 self%gamma_AD = gamma_ad
39 self%rho_ions = rho_ions
40 self%is_used = mhd_ohm .or. mhd_ad
46 SUBROUTINE update (self, gn, ds, d, Jx, Jy, Jz, Bx, By, Bz, Q, E, u_max)
50 real:: u_max, gamma_ad
51 logical::mhd_ad, mhd_ohm
52 real,
dimension(:,:,:,:):: e
53 real,
dimension(:,:,:):: d, jx, jy, jz, bx, by, bz, q
54 real,
dimension(:,:,:),
allocatable:: ud_x, ud_y, ud_z
55 real,
dimension(:,:,:),
allocatable:: ambi
56 integer,
save:: itimer=0
81 if (.not.self%is_used)
return 82 call trace%begin (
'non_ideal_t%update', itimer=itimer)
84 call allocate_scalars_a (gn, ambi, ud_x, ud_y, ud_z)
85 ambi = 1./(self%gamma_AD*d*self%rho_ions)
86 ud_x = xdn(ambi) * (zup(jy)*xdn(zup(bz)) - yup(jz)*xdn(yup(by)))
87 ud_y = ydn(ambi) * (xup(jz)*ydn(xup(bx)) - zup(jx)*ydn(zup(bz)))
88 ud_z = zdn(ambi) * (yup(jx)*zdn(yup(by)) - xup(jy)*zdn(xup(bx)))
89 e(:,:,:,1) = e(:,:,:,1) - (ud_y*bz - ud_z*by)
90 e(:,:,:,2) = e(:,:,:,2) - (ud_z*bx - ud_x*bz)
91 e(:,:,:,3) = e(:,:,:,3) - (ud_x*by - ud_y*bx)
92 q = q + self%rho_ions*d*self%gamma_AD*(xup(ud_x)**2+yup(ud_y)**2+zup(ud_z)**2)
93 call deallocate_scalars_a (ambi, ud_x, ud_y, ud_z)
94 u_max = max(u_max,maxval((xup(bx)**2+yup(by)**2+zup(bz)**2)/(self%gamma_AD*self%rho_ions*d*ds)))
96 if (self%mhd_Ohm)
then 97 e(:,:,:,1) = e(:,:,:,1) + self%eta_Ohm*jx
98 e(:,:,:,2) = e(:,:,:,2) + self%eta_Ohm*jy
99 e(:,:,:,3) = e(:,:,:,3) + self%eta_Ohm*jz
100 q = q + yup(zup(self%eta_Ohm*jx**2)) + zup(xup(self%eta_Ohm*jy**2)) + xup(yup(self%eta_Ohm*jz**2))
101 u_max = max(u_max,self%eta_Ohm/ds)
103 call trace%end (itimer)
104 END SUBROUTINE update
6th order stagger operators, with self-test procedure