MPI-AMRVAC 3.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Loading...
Searching...
No Matches
mod_dust.t
Go to the documentation of this file.
1!> Module for including dust species, which interact with the gas through a drag
2!> force
3module mod_dust
4 use mod_global_parameters, only: std_len
6 use mod_comm_lib, only: mpistop
7
8 implicit none
9 private
10
11 !> Reduction of stopping time timestep limit
12 double precision :: dust_dtpar = 0.5d0
13
14 !> Factor used in squared thermal velocity
15 double precision :: gas_vtherm_factor = 3.0d0
16
17 !> Dust temperature in K (if dust_temperature_type is constant)
18 double precision :: dust_temperature = -1.0d0
19
20 !> Dust drag coefficient for linear drag (for testing dust_method=linear)
21 double precision :: dust_K_lineardrag = -1.0d0
22
23 !> If dust_temperature_type is stellar, it will be calculated according to Tielens (2005),
24 !> eqn. 5.44 using an input stellar luminosity in solar luminosities
25 double precision :: dust_stellar_luminosity = -1.0d0
26
27 !> Minimum dust density as used when dust_small_to_zero=T
28 double precision, public, protected :: dust_min_rho = -1.0d0
29
30 !> Size of each dust species, dimensionless expression
31 double precision, allocatable, public :: dust_size(:)
32
33 !> Internal density of each dust species, dimensionless expression
34 double precision, allocatable, public :: dust_density(:)
35
36 !> The number of dust species
37 integer, public, protected :: dust_n_species = 0
38
39 integer, protected :: gas_rho_ = -1
40 integer, allocatable, protected :: gas_mom(:)
41 integer, protected :: gas_e_ = -1
42
43 !> Indices of the dust densities
44 integer, allocatable, public, protected :: dust_rho(:)
45
46 !> Indices of the dust momentum densities
47 integer, allocatable, public, protected :: dust_mom(:, :)
48
49 !> Set small dust densities to zero to avoid numerical problems
50 logical, public, protected :: dust_small_to_zero = .false.
51
52 !> Adding dust in sourcesplit manner or not
53 logical :: dust_source_split = .false.
54
55 !> This can be turned off for testing purposes, if F then gas uncouples from dust
56 logical :: dust_backreaction = .true.
57
58 !> whether second order terms (relevant only when dust_n_species >=2) are included
59 !> there are the terms n2, ni2, d2 in Eqs 6,7,8 in amrvac 3.0 paper
60 logical :: dust_implicit_second_order = .true.
61
62 !> whether fh is added for gas energy: is only added in the impliict implementation, the explicit one was left as before
63 logical :: dust_backreaction_fh = .false.
64
65 !> What type of dust drag force to use. Can be 'Kwok', 'sticking', 'linear', 'usr' or 'none'.
66 character(len=std_len), public, protected :: dust_method = 'Kwok'
67
68 !> Can be 'graphite' or 'silicate', affects the dust temperature
69 character(len=std_len) :: dust_species = 'graphite'
70
71 !> Determines the dust temperature, can be 'constant', 'ism', or 'stellar'
72 character(len=std_len) :: dust_temperature_type = 'constant'
73
74
75 ! Public methods
76 public :: dust_init
77 public :: dust_get_dt
78 public :: dust_get_flux
79 public :: dust_get_cmax
80 public :: dust_get_flux_prim
81 public :: dust_get_cmax_prim
82 public :: dust_add_source
83 public :: dust_to_conserved
84 public :: dust_to_primitive
85 public :: dust_check_params
86 public :: dust_check_w
87 public :: set_dusttozero
88 public :: dust_implicit_update
90
91
92contains
93
94 subroutine dust_init(g_rho, g_mom, g_energy)
96
97 integer, intent(in) :: g_rho
98 integer, intent(in) :: g_mom(ndir)
99 integer, intent(in) :: g_energy ! Negative value if not present
100 integer :: n, idir
101 character(len=2) :: dim
102
103 call dust_read_params(par_files)
104
105 if(dust_source_split) any_source_split=.true.
106 allocate(gas_mom(ndir))
107 gas_rho_ = g_rho
108 gas_mom = g_mom
109 gas_e_ = g_energy
110
111 allocate(dust_size(dust_n_species))
113 dust_size(:) = -1.0d0
114 dust_density(:) = -1.0d0
115
116 allocate(dust_rho(dust_n_species))
117 allocate(dust_mom(ndir, dust_n_species))
118
119 ! Set index of dust densities
120 do n = 1, dust_n_species
121 dust_rho(n) = var_set_fluxvar("rhod", "rhod", n)
122 end do
123
124 ! Dust momentum
125 do idir = 1, ndir
126 write(dim, "(I0,A)") idir, "d"
127 do n = 1, dust_n_species
128 dust_mom(idir, n) = var_set_fluxvar("m"//dim, "v"//dim, n)
129 end do
130 end do
131
132 end subroutine dust_init
133
134 !> Read dust_list module parameters from a file
135 subroutine dust_read_params(files)
137 character(len=*), intent(in) :: files(:)
138 integer :: n
139
140 namelist /dust_list/ dust_n_species, dust_min_rho, dust_method, &
141 dust_k_lineardrag, dust_small_to_zero, dust_source_split, dust_temperature, &
142 dust_temperature_type, dust_backreaction, dust_dtpar, gas_vtherm_factor, dust_stellar_luminosity,&
143 dust_implicit_second_order, dust_backreaction_fh
144
145 do n = 1, size(files)
146 open(unitpar, file=trim(files(n)), status="old")
147 read(unitpar, dust_list, end=111)
148111 close(unitpar)
149 end do
150
151 end subroutine dust_read_params
152
153 subroutine dust_check_params()
156
157 if (dust_method == 'sticking') then
158 if (si_unit) call mpistop("Dust error: sticking assumes cgs units")
159 if (dust_temperature_type == "constant") then
160 if (dust_temperature < 0.0d0) then
161 call mpistop("Dust error: dust_temperature (in K) < 0 or not set")
162 end if
163 else if (dust_temperature_type == "stellar") then
164 if (dust_stellar_luminosity < 0.0d0) then
165 call mpistop("Dust error: dust_stellar_luminosity (in solar) < 0 or not set")
166 end if
167 end if
168 end if
169
170 if (dust_method == 'linear') then
171 if(dust_k_lineardrag<0.0d0) then
172 call mpistop("With dust_method=='linear', you must set a positive dust_K_lineardrag")
173 end if
174 end if
175
176 if (any(dust_size < 0.0d0)) &
177 call mpistop("Dust error: any(dust_size < 0) or not set")
178 if (any(dust_density < 0.0d0)) &
179 call mpistop("Dust error: any(dust_density < 0) or not set")
180
181 if (dust_method == 'usr') then
182 if (.not. associated(usr_get_3d_dragforce) .or. .not. associated(usr_dust_get_dt)) &
183 call mpistop("Dust error:usr_get_3d_dragforce and usr_dust_get_dt not defined")
184 end if
185
186 if(.not. use_imex_scheme .and. ((dust_dtpar .ge. 1d0).or.(dust_dtpar.le.0))) then
187 if(mype .eq. 0) print*, "EXPLICIT source for dust requires 0<dt_dustpar < 1, set to 0.8"
188 dust_dtpar = 0.8
189 endif
190
191 end subroutine dust_check_params
192
193 subroutine dust_check_w(ixI^L,ixO^L,w,x,flag)
195
196 integer, intent(in) :: ixi^l,ixo^l
197 double precision, intent(in):: w(ixi^s,1:nw)
198 double precision, intent(in):: x(ixi^s, 1:ndim)
199 logical, intent(inout) :: flag(ixi^s,1:nw)
200 integer :: n
201
202 do n = 1, dust_n_species
203 flag(ixo^s,dust_rho(n))=(w(ixo^s,dust_rho(n))<0.0d0)
204 enddo
205
206 end subroutine dust_check_w
207
208 subroutine dust_to_conserved(ixI^L, ixO^L, w, x)
210
211 integer, intent(in) :: ixi^l, ixo^l
212 double precision, intent(inout) :: w(ixi^s, 1:nw)
213 double precision, intent(in) :: x(ixi^s, 1:ndim)
214 integer :: n, idir
215
216 if(fix_small_values .and. dust_small_to_zero) call set_dusttozero(ixi^l, ixo^l, w, x)
217
218 do n = 1, dust_n_species
219 ! Convert velocity to momentum
220 do idir = 1, ndir
221 w(ixo^s, dust_mom(idir, n)) = w(ixo^s, dust_rho(n)) * &
222 w(ixo^s, dust_mom(idir, n))
223 end do
224 end do
225
226 end subroutine dust_to_conserved
227
228 subroutine dust_to_primitive(ixI^L, ixO^L, w, x)
230
231 integer, intent(in) :: ixi^l, ixo^l
232 double precision, intent(inout) :: w(ixi^s, 1:nw)
233 double precision, intent(in) :: x(ixi^s, 1:ndim)
234 integer :: n, idir
235
236 do n = 1, dust_n_species
237 ! Convert momentum to velocity
238 do idir = 1, ndir
239 where (w(ixo^s, dust_rho(n)) > 0.0d0)
240 w(ixo^s, dust_mom(idir, n)) = w(ixo^s, dust_mom(idir, n)) / &
241 w(ixo^s, dust_rho(n))
242 elsewhere
243 w(ixo^s, dust_mom(idir, n)) = 0.0d0
244 end where
245 end do
246 end do
247
248 if(fix_small_values .and. dust_small_to_zero) call set_dusttozero(ixi^l, ixo^l, w, x)
249
250 end subroutine dust_to_primitive
251
252 subroutine dust_get_flux(w, x, ixI^L, ixO^L, idim, f)
254
255 integer, intent(in) :: ixi^l, ixo^l, idim
256 double precision, intent(in) :: w(ixi^s, 1:nw), x(ixi^s, 1:ndim)
257 double precision, intent(inout) :: f(ixi^s, nwflux)
258 integer :: n, idir
259
260 do n = 1, dust_n_species
261 where (w(ixo^s, dust_rho(n)) > 0.0d0)
262 f(ixo^s, dust_rho(n)) = w(ixo^s, dust_mom(idim, n))
263 elsewhere
264 f(ixo^s, dust_rho(n)) = 0.0d0
265 end where
266
267 do idir = 1, ndir
268 f(ixo^s, dust_mom(idir, n)) = w(ixo^s, dust_mom(idir, n)) * &
269 get_vdust(w, ixi^l, ixo^l, idim, n)
270 end do
271 end do
272
273 end subroutine dust_get_flux
274
275 subroutine dust_get_flux_prim(w, x, ixI^L, ixO^L, idim, f)
277
278 integer, intent(in) :: ixi^l, ixo^l, idim
279 double precision, intent(in) :: w(ixi^s, 1:nw), x(ixi^s, 1:ndim)
280 double precision, intent(inout) :: f(ixi^s, nwflux)
281 integer :: n, idir
282
283 do n = 1, dust_n_species
284 where (w(ixo^s, dust_rho(n)) > 0.0d0)
285 f(ixo^s, dust_rho(n)) = w(ixo^s, dust_mom(idim, n))*w(ixo^s, dust_rho(n))
286 elsewhere
287 f(ixo^s, dust_rho(n)) = 0.0d0
288 end where
289
290 do idir = 1, ndir
291 f(ixo^s, dust_mom(idir, n)) = w(ixo^s, dust_mom(idir, n)) * &
292 w(ixo^s, dust_rho(n)) * get_vdust_prim(w, ixi^l, ixo^l, idim, n)
293 end do
294 end do
295
296 end subroutine dust_get_flux_prim
297
298 function get_vdust(w, ixI^L, ixO^L, idim, n) result(vdust)
299 use mod_global_parameters, only: nw
300 integer, intent(in) :: ixi^l, ixo^l, idim, n
301 double precision, intent(in) :: w(ixi^s, nw)
302 double precision :: vdust(ixo^s)
303
304 where (w(ixo^s, dust_rho(n)) > 0.0d0)
305 vdust(ixo^s) = w(ixo^s, dust_mom(idim, n)) / w(ixo^s, dust_rho(n))
306 elsewhere
307 vdust(ixo^s) = 0.0d0
308 end where
309
310 end function get_vdust
311
312 function get_vdust_prim(w, ixI^L, ixO^L, idim, n) result(vdust)
313 use mod_global_parameters, only: nw
314 integer, intent(in) :: ixi^l, ixo^l, idim, n
315 double precision, intent(in) :: w(ixi^s, nw)
316 double precision :: vdust(ixo^s)
317
318 where (w(ixo^s, dust_rho(n)) > 0.0d0)
319 vdust(ixo^s) = w(ixo^s, dust_mom(idim, n))
320 elsewhere
321 vdust(ixo^s) = 0.0d0
322 end where
323
324 end function get_vdust_prim
325
326 ! Force dust density to zero if dust_rho <= dust_min_rho
327 subroutine set_dusttozero(ixI^L, ixO^L, w, x)
329
330 integer, intent(in) :: ixi^l, ixo^l
331 double precision, intent(in) :: x(ixi^s, 1:ndim)
332 double precision, intent(inout) :: w(ixi^s, 1:nw)
333
334 integer :: n, idir
335 logical :: flag(ixi^s)
336
337 do n = 1, dust_n_species
338 flag(ixo^s)=(w(ixo^s, dust_rho(n)) <= dust_min_rho)
339 where (flag(ixo^s))
340 w(ixo^s, dust_rho(n)) = 0.0d0
341 end where
342 do idir = 1, ndir
343 where (flag(ixo^s))
344 w(ixo^s, dust_mom(idir, n)) = 0.0d0
345 end where
346 end do
347 end do
348
349 end subroutine set_dusttozero
350
351 ! Calculate drag force based on Epstein's law
352 ! From Kwok 1975, page 584 (between eqn 8 and 9)
353 subroutine get_3d_dragforce(ixI^L, ixO^L, w, x, fdrag, ptherm, vgas)
356 integer, intent(in) :: ixi^l, ixo^l
357 double precision, intent(in) :: x(ixi^s, 1:ndim)
358 double precision, intent(in) :: w(ixi^s, 1:nw)
359 double precision, intent(out) :: &
360 fdrag(ixi^s, 1:ndir, 1:dust_n_species)
361 double precision, intent(in) :: ptherm(ixi^s), vgas(ixi^s, 1:ndir)
362
363 double precision, dimension(ixI^S) :: vt2, deltav, fd, vdust
364 double precision :: alpha_t(ixi^s, 1:dust_n_species)
365 integer :: n, idir
366
367 vt2(ixo^s) = gas_vtherm_factor*ptherm(ixo^s)/w(ixo^s, gas_rho_)
368
369 select case( trim(dust_method) )
370 case ('Kwok') ! assume sticking coefficient equals 0.25
371
372 do idir = 1, ndir
373 do n = 1, dust_n_species
374 where(w(ixo^s, dust_rho(n)) > 0.0d0)
375 vdust(ixo^s) = w(ixo^s, dust_mom(idir, n)) / w(ixo^s, dust_rho(n))
376 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
377
378 ! 0.75 from sticking coefficient
379 fd(ixo^s) = 0.75d0*w(ixo^s, dust_rho(n))*w(ixo^s, gas_rho_)*deltav(ixo^s) &
380 / (dust_density(n) * dust_size(n))
381
382 ! 0.75 from spherical grainvolume
383 fd(ixo^s) = -fd(ixo^s)*0.75d0*dsqrt(vt2(ixo^s) + deltav(ixo^s)**2)
384 elsewhere
385 fd(ixo^s) = 0.0d0
386 end where
387 fdrag(ixo^s, idir, n) = fd(ixo^s)
388 end do
389 end do
390
391 case ('sticking') ! Calculate sticking coefficient based on the gas and dust temperatures
392
393 call get_sticking(w, x, ixi^l, ixo^l, alpha_t, ptherm)
394
395 do idir = 1, ndir
396 do n = 1, dust_n_species
397 where(w(ixo^s, dust_rho(n))>0.0d0)
398 vdust(ixo^s) = w(ixo^s,dust_mom(idir, n)) / w(ixo^s, dust_rho(n))
399 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
400 fd(ixo^s) = (one-alpha_t(ixo^s,n)) * w(ixo^s, dust_rho(n))*w(ixo^s, gas_rho_) * &
401 deltav(ixo^s) / (dust_density(n)*dust_size(n))
402 fd(ixo^s) = -fd(ixo^s)*0.75d0*dsqrt(vt2(ixo^s) + deltav(ixo^s)**2)
403 else where
404 fd(ixo^s) = 0.0d0
405 end where
406 fdrag(ixo^s, idir,n) = fd(ixo^s)
407 end do
408 end do
409
410 case('linear') !linear with Deltav, for testing (see Laibe & Price 2011)
411 do idir = 1, ndir
412 do n = 1, dust_n_species
413 where(w(ixo^s, dust_rho(n))>0.0d0)
414 vdust(ixo^s) = w(ixo^s,dust_mom(idir, n))/w(ixo^s, dust_rho(n))
415 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
416
417 fd(ixo^s) = -dust_k_lineardrag*deltav(ixo^s)
418 else where
419 fd(ixo^s) = 0.0d0
420 end where
421 fdrag(ixo^s, idir,n) = fd(ixo^s)
422 end do
423 end do
424
425 case('usr')
426 call usr_get_3d_dragforce(ixi^l, ixo^l, w, x, fdrag, ptherm, vgas, dust_n_species)
427 case('none')
428 fdrag(ixo^s, :, :) = 0.0d0
429 case default
430 call mpistop( "=== This dust method has not been implemented===" )
431 end select
432
433 end subroutine get_3d_dragforce
434
435 !> Get sticking coefficient alpha_T (always between 0 and 1)
436 !>
437 !> Uses Temperatures in K
438 !> Equation from Decin et al. 2006
439 !> NOTE: w can also be wprim on entry, and hence only identical prim-cons variables must be used
440 subroutine get_sticking(w, x, ixI^L, ixO^L, alpha_T, ptherm)
442 integer, intent(in) :: ixi^l, ixo^l
443 double precision, intent(in) :: x(ixi^s, 1:ndim)
444 double precision, intent(in) :: w(ixi^s, 1:nw)
445 double precision, intent(out) :: alpha_t(ixi^s, 1:dust_n_species)
446 double precision, intent(in) :: ptherm(ixi^s)
447 double precision :: tgas(ixi^s)
448 integer :: n
449
450 ! get the dust species T in K
451 call get_tdust(w, x, ixi^l, ixo^l, alpha_t)
452
453 ! convert dimensionless gas T to K
454 tgas(ixo^s) = (ptherm(ixo^s)/w(ixo^s, gas_rho_))*unit_temperature
455
456 do n = 1, dust_n_species
457 alpha_t(ixo^s,n) = 0.35d0 * dexp(-dsqrt((tgas(ixo^s) + &
458 alpha_t(ixo^s,n))/5.0d2))+0.1d0
459 end do
460
461 end subroutine get_sticking
462
463 !> Returns dust temperature (in K), either as constant or based on equ. 5.41,
464 !> 5.42 and 5.44 from Tielens (2005)
465 !>
466 !> Note that this calculation assumes cgs!!!!
467 !>
468 !> It takes as input the stellar luminosity in solar units in 'stellar' case
469 !> or a fixed dust input temperature in Kelvin when 'constant' or does case 'ism'
470 !> NOTE: w can also be wprim on entry, and hence only identical prim-cons variables must be used
471 subroutine get_tdust(w, x, ixI^L, ixO^L, Td)
473 use mod_geometry
474
475 integer, intent(in) :: ixi^l, ixo^l
476 double precision, intent(in) :: x(ixi^s, 1:ndim)
477 double precision, intent(in) :: w(ixi^s, 1:nw)
478 double precision, intent(out) :: td(ixi^s, 1:dust_n_species)
479 double precision :: g0(ixo^s)
480 integer :: n
481
482 select case( trim(dust_temperature_type) )
483 case( 'constant' )
484 td(ixo^s, :) = dust_temperature
485 case( 'ism' )
486 select case( trim(dust_species) )
487 case( 'graphite' )
488 do n = 1, dust_n_species
489 td(ixo^s, n) = 15.8d0*((0.0001d0/(dust_size(n)*unit_length))**0.06d0)
490 end do
491 case( 'silicate' )
492 do n = 1, dust_n_species
493 td(ixo^s, n) = 13.6d0*((0.0001d0/(dust_size(n)*unit_length))**0.06d0)
494 end do
495 case default
496 call mpistop( "=== Dust species undetermined===" )
497 end select
498 case( 'stellar' )
499 select case(coordinate)
500 case(spherical)
501 g0(ixo^s) = max(x(ixo^s, 1)*unit_length, smalldouble)
502 !!!case(cylindrical) convert R,Z to spherical radial coordinate r here
503 !!! but only ok for 2D (R,Z) or 2.5D (R,Z) case
504 !!! G0(ixO^S) = max(dsqrt(sum(x(ixO^S,:)**2,dim=ndim+1))*unit_length, smalldouble)
505 case default
506 call mpistop('stellar case not available in this coordinate system')
507 end select
508
509 g0(ixo^s) = 2.1d4*(dust_stellar_luminosity/1.0d8)*((3.0857d17/g0(ixo^s))**2)
510
511 select case( trim(dust_species) )
512 case( 'graphite' )
513 do n = 1, dust_n_species
514 td(ixo^s, n) = 61.0d0*((0.0001d0/(dust_size(n)*unit_length))**0.06d0) &
515 *(g0(ixo^s)**(one/5.8d0))
516 end do
517 case( 'silicate' )
518 do n = 1, dust_n_species
519 td(ixo^s, n) = 50.0d0*((0.0001d0/(dust_size(n)*unit_length))**0.06d0) &
520 *(g0(ixo^s)**(one/6.0d0))
521 end do
522 case default
523 call mpistop( "=== Dust species undetermined===" )
524 end select
525 case default
526 call mpistop( "=== Dust temperature undetermined===" )
527 end select
528
529 end subroutine get_tdust
530
531 !> w[iw]= w[iw]+qdt*S[wCT, x] where S is the source based on wCT within ixO
532 subroutine dust_add_source(qdt, ixI^L, ixO^L, wCT, w, x, qsourcesplit, active)
534
535 integer, intent(in) :: ixi^l, ixo^l
536 double precision, intent(in) :: qdt
537 double precision, intent(in) :: wct(ixi^s, 1:nw), x(ixi^s, 1:ndim)
538 double precision, intent(inout) :: w(ixi^s, 1:nw)
539 logical, intent(in) :: qsourcesplit
540 logical, intent(inout) :: active
541
542 double precision :: ptherm(ixi^s), vgas(ixi^s, 1:ndir)
543 double precision :: fdrag(ixi^s, 1:ndir, 1:dust_n_species)
544 integer :: n, idir
545
546 select case( trim(dust_method) )
547 case( 'none' )
548 !do nothing here
549 case default !all regular dust methods here
550 if (qsourcesplit .eqv. dust_source_split) then
551 active = .true.
552
553 call phys_get_pthermal(wct, x, ixi^l, ixo^l, ptherm)
554 do idir=1,ndir
555 vgas(ixo^s,idir)=wct(ixo^s,gas_mom(idir))/wct(ixo^s,gas_rho_)
556 end do
557
558 call get_3d_dragforce(ixi^l, ixo^l, wct, x, fdrag, ptherm, vgas)
559 fdrag(ixo^s, 1:ndir, 1:dust_n_species) = fdrag(ixo^s, 1:ndir, 1:dust_n_species) * qdt
560
561 do idir = 1, ndir
562
563 do n = 1, dust_n_species
564 if (dust_backreaction) then
565 w(ixo^s, gas_mom(idir)) = w(ixo^s, gas_mom(idir)) + &
566 fdrag(ixo^s, idir, n)
567 if (gas_e_ > 0) then
568 w(ixo^s, gas_e_) = w(ixo^s, gas_e_) + vgas(ixo^s, idir) &
569 * fdrag(ixo^s, idir, n)
570 end if
571 end if
572
573
574 w(ixo^s, dust_mom(idir, n)) = w(ixo^s, dust_mom(idir, n)) - &
575 fdrag(ixo^s, idir, n)
576 end do
577 end do
578
579 endif
580 end select
581
582 end subroutine dust_add_source
583
584 !> inplace update of psa==>F_im(psa)
585 subroutine dust_evaluate_implicit(qtC,psa)
587 type(state), target :: psa(max_blocks)
588 double precision, intent(in) :: qtc
589
590 integer :: iigrid, igrid, level
591
592 !dust_method = 'none' not used
593
594 !$OMP PARALLEL DO PRIVATE(igrid)
595 do iigrid=1,igridstail; igrid=igrids(iigrid);
596 ^d&dxlevel(^d)=rnode(rpdx^d_,igrid);
597 block=>psa(igrid)
598 call dust_terms(ixg^ll,ixm^ll,psa(igrid)%w,psa(igrid)%x)
599 end do
600 !$OMP END PARALLEL DO
601
602 end subroutine dust_evaluate_implicit
603
604
605
606
607 subroutine dust_terms(ixI^L,ixO^L,w,x)
609 integer, intent(in) :: ixi^l, ixo^l
610 double precision, intent(inout) :: w(ixi^s, 1:nw)
611 double precision, intent(in) :: x(ixi^s,1:ndim)
612
613 double precision :: tmp(ixi^s), vgas(ixi^s, 1:ndir)
614 double precision :: alpha(ixi^s, 1:ndir, 1:dust_n_species)
615 integer :: n, idir
616
617 do idir=1,ndir
618 vgas(ixo^s,idir)=w(ixo^s,gas_mom(idir))/w(ixo^s,gas_rho_)
619 end do
620 call get_alpha_dust(ixi^l, ixo^l, w, vgas,x, alpha)
621 w(ixo^s, gas_e_)=0d0
622 do idir = 1, ndir
623
624 w(ixo^s, gas_mom(idir))=0d0
625 do n = 1, dust_n_species
626 ! contribution for gas momentum
627 tmp(ixo^s) = alpha(ixo^s, idir,n) * ( &
628 w(ixo^s,dust_rho(n)) * w(ixo^s, gas_mom(idir)) - &
629 w(ixo^s,gas_rho_) * w(ixo^s, dust_mom(idir, n)))
630 w(ixo^s, dust_mom(idir, n)) = -tmp(ixo^s)
631 if (dust_backreaction) then
632 w(ixo^s, gas_mom(idir)) = w(ixo^s, gas_mom(idir)) + tmp(ixo^s)
633 if (gas_e_ > 0) then
634 if(dust_backreaction_fh) then
635 where(w(ixo^s,dust_rho(n)) > 0d0)
636 w(ixo^s, gas_e_) = w(ixo^s, gas_e_) + alpha(ixo^s, idir,n) * &
637 (w(ixo^s,gas_rho_) * (w(ixo^s, dust_mom(idir,n))**2/w(ixo^s,dust_rho(n))) - &
638 w(ixo^s,dust_rho(n)) * (w(ixo^s, gas_mom(idir))**2/w(ixo^s,gas_rho_)))
639 elsewhere
640 w(ixo^s, gas_e_) = w(ixo^s, gas_e_) + alpha(ixo^s, idir,n) * ( - &
641 w(ixo^s,dust_rho(n)) * (w(ixo^s, gas_mom(idir))**2/w(ixo^s,gas_rho_)))
642 endwhere
643 else
644 w(ixo^s, gas_e_) = w(ixo^s, gas_e_) + vgas(ixo^s, idir) &
645 * tmp(ixo^s)
646 end if
647 end if
648 end if
649 end do
650 end do
651 end subroutine dust_terms
652
653 !> Implicit solve of psb=psa+dtfactor*dt*F_im(psb)
654 subroutine dust_implicit_update(dtfactor,qdt,qtC,psb,psa)
656 !use mod_ghostcells_update
657
658 type(state), target :: psa(max_blocks)
659 type(state), target :: psb(max_blocks)
660 double precision, intent(in) :: qdt
661 double precision, intent(in) :: qtc
662 double precision, intent(in) :: dtfactor
663
664 integer :: iigrid, igrid
665
666 !call getbc(global_time,0.d0,psa,1,nw)
667 !$OMP PARALLEL DO PRIVATE(igrid)
668 do iigrid=1,igridstail; igrid=igrids(iigrid);
669 ^d&dxlevel(^d)=rnode(rpdx^d_,igrid);
670 block=>psa(igrid)
671 call dust_advance_implicit_grid(ixg^ll, ixg^ll, psa(igrid)%w, psb(igrid)%w, psa(igrid)%x, dtfactor,qdt)
672 end do
673 !$OMP END PARALLEL DO
674
675 end subroutine dust_implicit_update
676
677 subroutine dust_advance_implicit_grid(ixI^L, ixO^L, w, wout, x, dtfactor,qdt)
679 integer, intent(in) :: ixi^l, ixo^l
680 double precision, intent(in) :: qdt
681 double precision, intent(in) :: dtfactor
682 double precision, intent(in) :: w(ixi^s,1:nw)
683 double precision, intent(in) :: x(ixi^s,1:ndim)
684 double precision, intent(out) :: wout(ixi^s,1:nw)
685
686 integer :: n, m, idir
687 double precision :: alpha(ixi^s, 1:ndir, 1:dust_n_species)
688 double precision :: tmp(ixi^s),tmp2(ixi^s)
689 double precision :: tmp3(ixi^s)
690 double precision :: vgas(ixi^s, 1:ndir)
691
692
693 do idir = 1, ndir
694 vgas(ixo^s,idir)=w(ixo^s,gas_mom(idir))/w(ixo^s,gas_rho_)
695 end do
696 call get_alpha_dust(ixi^l, ixo^l, w, vgas, x, alpha)
697 !TODO this is still neeed?
698 wout(ixo^s,1:nw) = w(ixo^s,1:nw)
699
700 do idir = 1, ndir
701 ! d1 from Eq 6
702 tmp2(ixo^s) = 0d0
703 do n = 1, dust_n_species
704 tmp2(ixo^s) = tmp2(ixo^s) + alpha(ixo^s, idir,n) * &
705 (w(ixo^s,gas_rho_) + w(ixo^s,dust_rho(n)))
706
707 enddo
708 ! store D in tmp
709 tmp(ixo^s) = 1d0 + tmp2(ixo^s) * qdt
710 if(dust_implicit_second_order) then
711 ! d2 from Eq 6
712 tmp2(ixo^s) = 0d0
713 do n = 1, dust_n_species
714 do m = n+1, dust_n_species
715 tmp2(ixo^s) = tmp3(ixo^s) + alpha(ixo^s, idir,n) * alpha(ixo^s, idir,m) *&
716 (w(ixo^s,gas_rho_) + w(ixo^s,dust_rho(n))+w(ixo^s,dust_rho(m)))
717 enddo
718 enddo
719 ! multiplied at the end by rho_gas
720 tmp(ixo^s) = tmp(ixo^s) + w(ixo^s,gas_rho_)*tmp2(ixo^s) * (qdt**2)
721 endif
722
723
724
725 do n = 1, dust_n_species
726 ! ni1 from eq 7
727 tmp2(ixo^s) = alpha(ixo^s, idir,n) * ( &
728 w(ixo^s,dust_rho(n)) * w(ixo^s, gas_mom(idir)) - &
729 w(ixo^s,gas_rho_) * w(ixo^s, dust_mom(idir, n))) * qdt
730
731 if(dust_implicit_second_order) then
732 ! ni2 from eq 7
733 tmp3(ixo^s) = 0d0
734 do m = n+1, dust_n_species
735 tmp3(ixo^s) = tmp3(ixo^s) + alpha(ixo^s, idir,n) * alpha(ixo^s, idir,m) * &
736 ( w(ixo^s,dust_rho(n)) * (w(ixo^s, dust_mom(idir, n)) + w(ixo^s, gas_mom(idir))) - &
737 (w(ixo^s,gas_rho_) + w(ixo^s,dust_rho(m))) * w(ixo^s, dust_mom(idir, n)) )
738 enddo
739 ! tmp3 multiplied at the end by rho_gas
740 tmp2(ixo^s) = tmp2(ixo^s) + tmp3(ixo^s) * w(ixo^s,gas_rho_)* (qdt**2)
741 endif
742 tmp2(ixo^s) = tmp2(ixo^s)/tmp(ixo^s)
743 wout(ixo^s, dust_mom(idir,n)) = w(ixo^s, dust_mom(idir,n)) + tmp2(ixo^s)
744 enddo
745
746 if (dust_backreaction) then
747 tmp2(ixo^s) = 0d0
748 !n1 from eq 8
749 do n = 1, dust_n_species
750 tmp2(ixo^s) = tmp2(ixo^s) + alpha(ixo^s, idir,n) * &
751 (w(ixo^s,gas_rho_) * w(ixo^s, dust_mom(idir,n)) - &
752 w(ixo^s,dust_rho(n)) * w(ixo^s, gas_mom(idir)))
753
754 enddo
755 tmp2(ixo^s) = qdt * tmp2(ixo^s)
756 if(dust_implicit_second_order) then
757 !n2 from eq 8
758 tmp3(ixo^s) = 0d0
759 do n = 1, dust_n_species
760 do m = n+1, dust_n_species
761 tmp3(ixo^s) = tmp3(ixo^s) + alpha(ixo^s, idir,n) * alpha(ixo^s, idir,m) * &
762 (w(ixo^s,gas_rho_) * (w(ixo^s, dust_mom(idir, n)) + w(ixo^s, dust_mom(idir, m))) - &
763 (w(ixo^s,dust_rho(n)) + w(ixo^s,dust_rho(m)))* w(ixo^s, gas_mom(idir)))
764 enddo
765 enddo
766 ! tmp3 multiplied at the end by rho_gas
767 tmp2(ixo^s) = tmp2(ixo^s) + (qdt**2)*tmp3(ixo^s)* w(ixo^s,gas_rho_)
768 endif
769 ! store in tmp2 contribution to momentum
770 ! so that it is used when dust_backreaction_fh = .false.
771 tmp2(ixo^s) = tmp2(ixo^s) / tmp(ixo^s)
772 wout(ixo^s, gas_mom(idir)) = w(ixo^s, gas_mom(idir)) + tmp2(ixo^s)
773
774 ! kinetic energy update
775 if (gas_e_ > 0) then
776 if(dust_backreaction_fh) then
777 ! add work done by coll terms + FrictionalHeating
778 tmp2(ixo^s) = 0d0
779 do n = 1, dust_n_species
780 ! 2*dust kinetic energy: dust rho can be 0
781 where(w(ixo^s,dust_rho(n)) > 0d0)
782 tmp3(ixo^s)= w(ixo^s, dust_mom(idir,n))**2/w(ixo^s,dust_rho(n))
783 elsewhere
784 tmp3(ixo^s) = 0d0
785 endwhere
786 tmp2(ixo^s) = tmp2(ixo^s) + alpha(ixo^s, idir,n) * &
787 (w(ixo^s,gas_rho_) * tmp3(ixo^s) - &
788 w(ixo^s,dust_rho(n)) * (w(ixo^s, gas_mom(idir))**2/w(ixo^s,gas_rho_)))
789
790 enddo
791 tmp2(ixo^s) = qdt * tmp2(ixo^s)
792 if(dust_implicit_second_order) then
793 tmp3(ixo^s) = 0d0
794 do n = 1, dust_n_species
795 do m = n+1, dust_n_species
796 tmp3(ixo^s) = tmp3(ixo^s) + alpha(ixo^s, idir,n) * alpha(ixo^s, idir,m) * &
797 (w(ixo^s,gas_rho_) * (w(ixo^s, dust_mom(idir, n))**2/w(ixo^s,dust_rho(n)) + w(ixo^s, dust_mom(idir,m))**2/w(ixo^s,dust_rho(m))) - &
798 (w(ixo^s,dust_rho(n)) + w(ixo^s,dust_rho(m)))* w(ixo^s, gas_mom(idir))**2/w(ixo^s,gas_rho_))
799 enddo
800 enddo
801 ! tmp3 multiplied at the end by rho_gas
802 tmp2(ixo^s) = tmp2(ixo^s) + (qdt**2)*tmp3(ixo^s)* w(ixo^s,gas_rho_)
803 endif
804 wout(ixo^s, gas_e_) = wout(ixo^s, gas_e_) + 0.5d0 * tmp2(ixo^s) / tmp(ixo^s)
805 else
806 ! dust_backreaction_fh = .false.
807 ! add only work done by coll term by multiplyting the contribution in mom eq. by velocity
808 wout(ixo^s, gas_e_) = wout(ixo^s, gas_e_) + vgas(ixo^s, idir) * tmp2(ixo^s)
809 endif
810 end if
811 end if
812 end do !1..ndir
813
814
815 end subroutine dust_advance_implicit_grid
816
817 ! copied from get_3d_dragforce subroutine
818 subroutine get_alpha_dust(ixI^L, ixO^L, w, vgas,x, alpha)
821 integer, intent(in) :: ixi^l, ixo^l
822 double precision, intent(in) :: x(ixi^s, 1:ndim)
823 double precision, intent(in) :: w(ixi^s, 1:nw)
824 double precision,intent(in) :: vgas(ixi^s, 1:ndir)
825 double precision, intent(out) :: &
826 alpha(ixi^s, 1:ndir, 1:dust_n_species)
827
828 double precision :: ptherm(ixi^s)
829 double precision, dimension(ixI^S) :: vt2, deltav, fd, vdust
830 double precision :: alpha_t(ixi^s, 1:dust_n_species)
831 integer :: n, idir
832
833 call phys_get_pthermal(w, x, ixi^l, ixo^l, ptherm)
834
835 vt2(ixo^s) = gas_vtherm_factor*ptherm(ixo^s)/w(ixo^s, gas_rho_)
836
837 select case( trim(dust_method) )
838 case ('Kwok') ! assume sticking coefficient equals 0.25
839
840 do idir = 1, ndir
841 do n = 1, dust_n_species
842 where(w(ixo^s, dust_rho(n)) > 0.0d0)
843
844 ! 0.75 from sticking coefficient
845 fd(ixo^s) = 0.75d0 / (dust_density(n) * dust_size(n))
846
847 ! 0.75 from spherical grainvolume
848 vdust(ixo^s) = w(ixo^s, dust_mom(idir, n)) / w(ixo^s, dust_rho(n))
849 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
850 fd(ixo^s) = fd(ixo^s)*0.75d0*dsqrt(vt2(ixo^s) + deltav(ixo^s)**2)
851 elsewhere
852 fd(ixo^s) = 0.0d0
853 end where
854 alpha(ixo^s, idir, n) = fd(ixo^s)
855 end do
856 end do
857
858 case ('sticking') ! Calculate sticking coefficient based on the gas and dust temperatures
859
860 call get_sticking(w, x, ixi^l, ixo^l, alpha_t, ptherm)
861
862 do idir = 1, ndir
863 do n = 1, dust_n_species
864 where(w(ixo^s, dust_rho(n))>0.0d0)
865 ! sticking
866 fd(ixo^s) = (one-alpha_t(ixo^s,n)) / (dust_density(n)*dust_size(n))
867 ! 0.75 from spherical grainvolume
868 vdust(ixo^s) = w(ixo^s,dust_mom(idir, n)) / w(ixo^s, dust_rho(n))
869 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
870 fd(ixo^s) = fd(ixo^s)*0.75d0*dsqrt(vt2(ixo^s) + deltav(ixo^s)**2)
871 else where
872 fd(ixo^s) = 0.0d0
873 end where
874 alpha(ixo^s, idir,n) = fd(ixo^s)
875 end do
876 end do
877
878 case('linear') !linear with Deltav, for testing (see Laibe & Price 2011)
879 do idir = 1, ndir
880 do n = 1, dust_n_species
881 where(w(ixo^s, dust_rho(n))>0.0d0)
882 fd(ixo^s) = dust_k_lineardrag/(w(ixo^s,gas_rho_)*w(ixo^s, dust_rho(n)))
883 else where
884 fd(ixo^s) = 0.0d0
885 end where
886 alpha(ixo^s, idir,n) = fd(ixo^s)
887 end do
888 end do
889
890 case('none')
891 alpha(ixo^s, :, :) = 0.0d0
892 case default
893 call mpistop( "=== This dust method has not been implemented===" )
894 end select
895
896 end subroutine get_alpha_dust
897
898
899 !> Get dt related to dust and gas stopping time (Laibe 2011)
900 subroutine dust_get_dt(wprim, ixI^L, ixO^L, dtnew, dx^D, x)
903
904 integer, intent(in) :: ixi^l, ixo^l
905 double precision, intent(in) :: dx^d, x(ixi^s, 1:ndim)
906 double precision, intent(in) :: wprim(ixi^s, 1:nw)
907 double precision, intent(inout) :: dtnew
908
909 double precision :: ptherm(ixi^s), vgas(ixi^s, 1:ndir)
910 double precision, dimension(1:dust_n_species):: dtdust
911 double precision, dimension(ixI^S) :: vt2, deltav, tstop, vdust
912 double precision, dimension(ixI^S, 1:dust_n_species) :: alpha_t
913 integer :: n, idir
914
915 if(dust_dtpar .le. 0) return
916
917 ! hydro has no splitting of pressure and primitives on entry
918 if(gas_e_>0) then
919 ptherm(ixo^s)=wprim(ixo^s,gas_e_)
920 else
921 call mpistop("adjust dust module for no energy for gas")
922 endif
923 do idir = 1, ndir
924 vgas(ixo^s,idir)=wprim(ixo^s,gas_mom(idir))
925 end do
926
927 select case( trim(dust_method) )
928
929 case( 'Kwok' ) ! assume sticking coefficient equals 0.25
930 dtdust(:) = bigdouble
931
932 vt2(ixo^s) = gas_vtherm_factor*ptherm(ixo^s)/wprim(ixo^s, gas_rho_)
933
934 do idir = 1, ndir
935 do n = 1, dust_n_species
936 where(wprim(ixo^s, dust_rho(n))>0.0d0)
937 vdust(ixo^s) = wprim(ixo^s,dust_mom(idir, n))
938 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
939 tstop(ixo^s) = 4.0d0*(dust_density(n)*dust_size(n))/ &
940 (3.0d0*(0.75d0)*dsqrt(vt2(ixo^s) + &
941 deltav(ixo^s)**2)*(wprim(ixo^s, dust_rho(n)) + &
942 wprim(ixo^s, gas_rho_)))
943 else where
944 tstop(ixo^s) = bigdouble
945 end where
946
947 dtdust(n) = min(minval(tstop(ixo^s)), dtdust(n))
948 end do
949 end do
950
951 dtnew = min(minval(dust_dtpar*dtdust(:)), dtnew)
952
953 case( 'sticking' ) ! Calculate sticking coefficient based on the gas temperature
954 dtdust(:) = bigdouble
955
956 vt2(ixo^s) = gas_vtherm_factor*ptherm(ixo^s)/wprim(ixo^s, gas_rho_)
957
958 ! Sticking coefficient
959 call get_sticking(wprim, x, ixi^l, ixo^l, alpha_t, ptherm)
960
961 do idir = 1, ndir
962 do n = 1, dust_n_species
963 where(wprim(ixo^s, dust_rho(n))>0.0d0)
964 vdust(ixo^s) = wprim(ixo^s,dust_mom(idir, n))
965 deltav(ixo^s) = vgas(ixo^s, idir)-vdust(ixo^s)
966 tstop(ixo^s) = 4.0d0*(dust_density(n)*dust_size(n))/ &
967 (3.0d0*(one-alpha_t(ixo^s,n))*dsqrt(vt2(ixo^s) + &
968 deltav(ixo^s)**2)*(wprim(ixo^s, dust_rho(n)) + &
969 wprim(ixo^s, gas_rho_)))
970 else where
971 tstop(ixo^s) = bigdouble
972 end where
973
974 dtdust(n) = min(minval(tstop(ixo^s)), dtdust(n))
975 end do
976 end do
977
978 dtnew = min(minval(dust_dtpar*dtdust(:)), dtnew)
979
980 case('linear') !linear with Deltav, for testing (see Laibe & Price 2011)
981 dtdust(:) = bigdouble
982
983 do n = 1, dust_n_species
984 where(wprim(ixo^s, dust_rho(n))>0.0d0)
985 tstop(ixo^s) = (wprim(ixo^s, dust_rho(n))*wprim(ixo^s, gas_rho_))/ &
986 (dust_k_lineardrag*(wprim(ixo^s, dust_rho(n)) + wprim(ixo^s, gas_rho_)))
987 else where
988 tstop(ixo^s) = bigdouble
989 end where
990
991 dtdust(n) = min(minval(tstop(ixo^s)), dtdust(n))
992 end do
993
994 dtnew = min(minval(dust_dtpar*dtdust(:)), dtnew)
995 case('usr')
996 dtdust(:) = bigdouble
997 call usr_dust_get_dt(wprim, ixi^l, ixo^l, dtdust, dx^d, x, dust_n_species)
998 dtnew = min(minval(dust_dtpar*dtdust(:)), dtnew)
999 case('none')
1000 ! no dust timestep
1001 case default
1002 call mpistop( "=== This dust method has not been implemented===" )
1003 end select
1004
1005 if (dtnew < dtmin) then
1006 write(unitterm,*)"-------------------------------------"
1007 write(unitterm,*)"Warning: found DUST related time step too small! dtnew=", dtnew
1008 write(unitterm,*)"on grid with index:", block%igrid," grid level=", block%level
1009 write(unitterm,*)"grid corners are=",{^d&rnode(rpxmin^d_, block%igrid), rnode(rpxmax^d_, block%igrid)}
1010 write(unitterm,*)" dtdust =", dtdust(:)
1011 write(unitterm,*)"on processor:", mype
1012 write(unitterm,*)"-------------------------------------"
1013 endif
1014
1015 end subroutine dust_get_dt
1016
1017 ! Note that cmax and cmin are assumed to be initialized
1018 subroutine dust_get_cmax(w, x, ixI^L, ixO^L, idim, cmax, cmin)
1020 use mod_variables
1021
1022 integer, intent(in) :: ixi^l, ixo^l, idim
1023 double precision, intent(in) :: w(ixi^s, 1:nw), x(ixi^s, 1:ndim)
1024 double precision, intent(inout) :: cmax(ixi^s,1:number_species)
1025 double precision, intent(inout), optional :: cmin(ixi^s,1:number_species)
1026 double precision :: vdust(ixo^s)
1027 integer :: n
1028
1029 do n = 1, dust_n_species
1030 vdust(ixo^s) = get_vdust(w, ixi^l, ixo^l, idim, n)
1031
1032 if (present(cmin)) then
1033 cmin(ixo^s,1) = min(cmin(ixo^s,1), vdust(ixo^s))
1034 cmax(ixo^s,1) = max(cmax(ixo^s,1), vdust(ixo^s))
1035 else
1036 cmax(ixo^s,1) = max(cmax(ixo^s,1), abs(vdust(ixo^s)))
1037 end if
1038 end do
1039 end subroutine dust_get_cmax
1040
1041 ! Note that cmax and cmin are assumed to be initialized
1042 subroutine dust_get_cmax_prim(w, x, ixI^L, ixO^L, idim, cmax, cmin)
1044
1045 integer, intent(in) :: ixi^l, ixo^l, idim
1046 double precision, intent(in) :: w(ixi^s, 1:nw), x(ixi^s, 1:ndim)
1047 double precision, intent(inout) :: cmax(ixi^s)
1048 double precision, intent(inout), optional :: cmin(ixi^s)
1049 double precision :: vdust(ixo^s)
1050 integer :: n
1051
1052 do n = 1, dust_n_species
1053 vdust(ixo^s) = get_vdust_prim(w, ixi^l, ixo^l, idim, n)
1054
1055 if (present(cmin)) then
1056 cmin(ixo^s) = min(cmin(ixo^s), vdust(ixo^s))
1057 cmax(ixo^s) = max(cmax(ixo^s), vdust(ixo^s))
1058 else
1059 cmax(ixo^s) = max(cmax(ixo^s), abs(vdust(ixo^s)))
1060 end if
1061 end do
1062 end subroutine dust_get_cmax_prim
1063
1064end module mod_dust
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for including dust species, which interact with the gas through a drag force.
Definition mod_dust.t:3
double precision, public, protected dust_min_rho
Minimum dust density as used when dust_small_to_zero=T.
Definition mod_dust.t:28
subroutine, public dust_add_source(qdt, ixil, ixol, wct, w, x, qsourcesplit, active)
w[iw]= w[iw]+qdt*S[wCT, x] where S is the source based on wCT within ixO
Definition mod_dust.t:533
double precision, dimension(:), allocatable, public dust_size
Size of each dust species, dimensionless expression.
Definition mod_dust.t:31
subroutine, public dust_evaluate_implicit(qtc, psa)
inplace update of psa==>F_im(psa)
Definition mod_dust.t:586
character(len=std_len), public, protected dust_method
What type of dust drag force to use. Can be 'Kwok', 'sticking', 'linear', 'usr' or 'none'.
Definition mod_dust.t:66
subroutine, public dust_to_primitive(ixil, ixol, w, x)
Definition mod_dust.t:229
subroutine, public dust_get_flux(w, x, ixil, ixol, idim, f)
Definition mod_dust.t:253
integer, dimension(:, :), allocatable, public, protected dust_mom
Indices of the dust momentum densities.
Definition mod_dust.t:47
subroutine, public set_dusttozero(ixil, ixol, w, x)
Definition mod_dust.t:328
logical, public, protected dust_small_to_zero
Set small dust densities to zero to avoid numerical problems.
Definition mod_dust.t:50
subroutine, public dust_to_conserved(ixil, ixol, w, x)
Definition mod_dust.t:209
integer, public, protected dust_n_species
The number of dust species.
Definition mod_dust.t:37
subroutine, public dust_get_flux_prim(w, x, ixil, ixol, idim, f)
Definition mod_dust.t:276
integer, dimension(:), allocatable, public, protected dust_rho
Indices of the dust densities.
Definition mod_dust.t:44
subroutine, public dust_get_cmax(w, x, ixil, ixol, idim, cmax, cmin)
Definition mod_dust.t:1019
subroutine, public dust_check_w(ixil, ixol, w, x, flag)
Definition mod_dust.t:194
subroutine, public dust_check_params()
Definition mod_dust.t:154
subroutine, public dust_get_cmax_prim(w, x, ixil, ixol, idim, cmax, cmin)
Definition mod_dust.t:1043
subroutine, public dust_get_dt(wprim, ixil, ixol, dtnew, dxd, x)
Get dt related to dust and gas stopping time (Laibe 2011)
Definition mod_dust.t:901
subroutine, public dust_init(g_rho, g_mom, g_energy)
Definition mod_dust.t:95
subroutine, public dust_implicit_update(dtfactor, qdt, qtc, psb, psa)
Implicit solve of psb=psa+dtfactor*dt*F_im(psb)
Definition mod_dust.t:655
double precision, dimension(:), allocatable, public dust_density
Internal density of each dust species, dimensionless expression.
Definition mod_dust.t:34
Module with geometry-related routines (e.g., divergence, curl)
Definition mod_geometry.t:2
integer coordinate
Definition mod_geometry.t:7
integer, parameter spherical
This module contains definitions of global parameters and variables and some generic functions/subrou...
type(state), pointer block
Block pointer for using one block and its previous state.
integer, parameter unitpar
file handle for IO
logical any_source_split
if any normal source term is added in split fasion
logical use_imex_scheme
whether IMEX in use or not
integer, parameter ndim
Number of spatial dimensions for grid variables.
double precision unit_length
Physical scaling factor for length.
character(len=std_len), dimension(:), allocatable par_files
Which par files are used as input.
integer mype
The rank of the current MPI task.
integer ndir
Number of spatial dimensions (components) for vector variables.
integer ixm
the mesh range of a physical block without ghost cells
double precision, dimension(:), allocatable, parameter d
integer, parameter unitterm
Unit for standard output.
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
double precision unit_temperature
Physical scaling factor for temperature.
logical si_unit
Use SI units (.true.) or use cgs units (.false.)
double precision, dimension(:,:), allocatable dx
spatial steps for all dimensions at all levels
logical fix_small_values
fix small values with average or replace methods
double precision, dimension(^nd) dxlevel
store unstretched cell size of current level
double precision dtmin
Stop the simulation when the time step becomes smaller than this value.
integer max_blocks
The maximum number of grid blocks in a processor.
This module defines the procedures of a physics module. It contains function pointers for the various...
Definition mod_physics.t:4
Module with all the methods that users can customize in AMRVAC.
procedure(phys_dust_get_dt), pointer usr_dust_get_dt
procedure(phys_dust_get_3d_dragforce), pointer usr_get_3d_dragforce
integer nw
Total number of variables.
integer number_species
number of species: each species has different characterictic speeds and should be used accordingly in...