MPI-AMRVAC 3.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Loading...
Searching...
No Matches
mod_physics.t
Go to the documentation of this file.
1!> This module defines the procedures of a physics module. It contains function
2!> pointers for the various supported routines. An actual physics module has to
3!> set these pointers to its implementation of these routines.
5 use mod_global_parameters, only: name_len, max_nw
8
9 implicit none
10 public
11
12
13 double precision :: phys_gamma=5.d0/3.d0
14
15 !> To use wider stencils in flux calculations. A value of 1 will extend it by
16 !> one cell in both directions, in any dimension
17 integer :: phys_wider_stencil = 0
18
19 !> Array per direction per variable, which can be used to specify that certain
20 !> fluxes have to be treated differently
21 integer, allocatable :: flux_type(:, :)
22
23 !> Indicates a normal flux
24 integer, parameter :: flux_default = 0
25 !> Indicates the flux should be treated with tvdlf
26 integer, parameter :: flux_tvdlf = 1
27 !> Indicates dissipation should be omitted
28 integer, parameter :: flux_no_dissipation = 2
29 !> Indicates the flux should be specially treated
30 integer, parameter :: flux_special = 3
31 !> Indicates the flux should be treated with hll
32 integer, parameter :: flux_hll = 4
33 !> extra ghost cells in the transverse dimensions for fluxes of CT
35
36 !> Solve energy equation or not
37 logical :: phys_energy=.false.
38
39 !> Solve total energy equation or not
40 logical :: phys_total_energy=.false.
41
42 !> Solve internal energy instead of total energy
43 logical :: phys_internal_e=.false.
44
45 !> exclude Maxwell stress flux from momentum flux (use hydrodynamic momentum flux) for conservation fix at coarse-fine block boundaries to avoid abnormal large velocity there in strong magnetic field
46 logical :: phys_hd_mom_conserve_fix = .false.
47
48 !> String describing the physics type of the simulation
49 character(len=name_len) :: physics_type = ""
50
51 procedure(sub_check_params), pointer :: phys_check_params => null()
52 procedure(sub_set_mg_bounds), pointer :: phys_set_mg_bounds => null()
53 procedure(sub_convert), pointer :: phys_to_conserved => null()
54 procedure(sub_convert), pointer :: phys_to_primitive => null()
55 procedure(sub_check_params), pointer :: phys_bind_eos_to_source => null()
56 procedure(sub_modify_wlr), pointer :: phys_modify_wlr => null()
57 procedure(sub_convert), pointer :: phys_to_prolong => null()
58 procedure(sub_convert), pointer :: phys_from_prolong => null()
59 procedure(sub_wb_transform), pointer :: phys_wb_transform => null()
60 procedure(sub_wb_inverse), pointer :: phys_wb_inverse => null()
61 procedure(sub_wb_prolong), pointer :: phys_wb_prolong => null()
62 procedure(sub_get_cmax), pointer :: phys_get_cmax => null()
63 procedure(sub_get_tcutoff), pointer :: phys_get_tcutoff => null()
64 procedure(sub_trac_after_setdt), pointer:: phys_trac_after_setdt => null()
65 procedure(sub_get_h_speed), pointer :: phys_get_h_speed => null()
66 procedure(sub_get_cbounds), pointer :: phys_get_cbounds => null()
67 procedure(sub_get_flux), pointer :: phys_get_flux => null()
68 procedure(sub_e_to_ei), pointer :: phys_e_to_ei => null()
69 procedure(sub_e_to_ei), pointer :: phys_ei_to_e => null()
70 procedure(sub_get_ei), pointer :: phys_get_ei => null()
71 procedure(sub_get_v), pointer :: phys_get_v => null()
72 procedure(sub_get_rho), pointer :: phys_get_rho => null()
73 procedure(sub_get_dt), pointer :: phys_get_dt => null()
74 procedure(sub_add_source_geom), pointer :: phys_add_source_geom => null()
75 procedure(sub_add_source), pointer :: phys_add_source => null()
76 procedure(sub_global_source), pointer :: phys_global_source_after => null()
77 procedure(sub_special_advance), pointer :: phys_special_advance => null()
78 procedure(sub_check_w), pointer :: phys_check_w => null()
79 procedure(sub_get_pthermal), pointer :: phys_get_pthermal => null()
80 procedure(sub_get_pthermal), pointer :: phys_get_gamma1 => null()
81 procedure(sub_get_tgas), pointer :: phys_get_tgas => null()
82 procedure(sub_get_csrad2), pointer :: phys_get_csrad2 => null()
83 procedure(sub_get_rfactor), pointer :: phys_get_rfactor => null()
84 procedure(sub_boundary_adjust), pointer :: phys_boundary_adjust => null()
85 procedure(sub_write_info), pointer :: phys_write_info => null()
86 procedure(sub_small_values), pointer :: phys_handle_small_values => null()
87 procedure(sub_get_ct_velocity), pointer :: phys_get_ct_velocity => null()
88 procedure(sub_update_faces), pointer :: phys_update_faces => null()
89 procedure(sub_face_to_center), pointer :: phys_face_to_center => null()
90 procedure(sub_implicit_update), pointer :: phys_implicit_update => null()
91 procedure(sub_evaluate_implicit),pointer:: phys_evaluate_implicit => null()
92 procedure(sub_clean_divb), pointer :: phys_clean_divb => null()
93 ! set the equilibrium variables
94 procedure(sub_set_equi_vars), pointer :: phys_set_equi_vars => null()
95 ! subroutine with no parameters which creates EUV images
96 procedure(sub_check_params), pointer :: phys_te_images => null()
97 procedure(sub_get_auxiliary), pointer :: phys_get_auxiliary => null()
98 procedure(sub_get_auxiliary_prim), pointer :: phys_get_auxiliary_prim => null()
99 procedure(sub_get_hd_mom_flux), pointer :: phys_get_hd_mom_flux => null()
100
101 abstract interface
102
104 end subroutine sub_check_params
105
109 end subroutine sub_set_mg_bounds
110
111 subroutine sub_boundary_adjust(igrid,psb)
113 integer, intent(in) :: igrid
114 type(state), target :: psb(max_blocks)
115 end subroutine sub_boundary_adjust
116
117 subroutine sub_convert(ixI^L, ixO^L, w, x)
119 integer, intent(in) :: ixI^L, ixO^L
120 double precision, intent(inout) :: w(ixI^S, nw)
121 double precision, intent(in) :: x(ixI^S, 1:^ND)
122 end subroutine sub_convert
123
124 subroutine sub_modify_wlr(ixI^L, ixO^L, qt, wLC, wRC, wLp, wRp, s, idir)
126 integer, intent(in) :: ixI^L, ixO^L, idir
127 double precision, intent(in) :: qt
128 double precision, intent(inout) :: wLC(ixI^S,1:nw), wRC(ixI^S,1:nw)
129 double precision, intent(inout) :: wLp(ixI^S,1:nw), wRp(ixI^S,1:nw)
130 type(state) :: s
131 end subroutine sub_modify_wlr
132
133 subroutine sub_wb_transform(ixI^L, ixO^L, idims, w, x, wb_phi, &
134 wb_phi_face, wb_T)
136 integer, intent(in) :: ixI^L, ixO^L, idims
137 double precision, intent(inout) :: w(ixI^S, 1:nw)
138 double precision, intent(in) :: x(ixI^S, 1:ndim)
139 double precision, intent(out) :: wb_phi(ixI^S)
140 double precision, intent(out) :: wb_phi_face(ixI^S)
141 double precision, intent(out) :: wb_T(ixI^S)
142 end subroutine sub_wb_transform
143
144 subroutine sub_wb_inverse(ixI^L, ixL^L, ixR^L, idims, wLp, wRp, w, &
145 wb_phi, wb_phi_face, wb_T)
147 integer, intent(in) :: ixI^L, ixL^L, ixR^L, idims
148 double precision, intent(inout) :: wLp(ixI^S, 1:nw), wRp(ixI^S, 1:nw)
149 double precision, intent(inout) :: w(ixI^S, 1:nw)
150 double precision, intent(in) :: wb_phi(ixI^S), wb_phi_face(ixI^S)
151 double precision, intent(in) :: wb_T(ixI^S)
152 end subroutine sub_wb_inverse
153
154 subroutine sub_wb_prolong(ixI^L, ixO^L, w, x)
156 integer, intent(in) :: ixI^L, ixO^L
157 double precision, intent(inout) :: w(ixI^S, 1:nw)
158 double precision, intent(in) :: x(ixI^S, 1:ndim)
159 end subroutine sub_wb_prolong
160
161 subroutine sub_get_cmax(w, x, ixI^L, ixO^L, idim, cmax)
163 integer, intent(in) :: ixI^L, ixO^L, idim
164 double precision, intent(in) :: w(ixI^S, nw), x(ixI^S, 1:^ND)
165 double precision, intent(inout) :: cmax(ixI^S)
166 end subroutine sub_get_cmax
167
168 subroutine sub_get_tcutoff(ixI^L,ixO^L,w,x,tco_local,Tmax_local)
170 integer, intent(in) :: ixI^L, ixO^L
171 double precision, intent(inout) :: w(ixI^S, nw)
172 double precision, intent(in) :: x(ixI^S, 1:^ND)
173 double precision, intent(out) :: tco_local, Tmax_local
174 end subroutine sub_get_tcutoff
175
176 subroutine sub_trac_after_setdt(trac_alfa,tco,T_peak,T_bott)
177 double precision, intent(in) :: trac_alfa,tco,T_peak,T_bott
178 end subroutine sub_trac_after_setdt
179
180 subroutine sub_get_v(w,x,ixI^L,ixO^L,v)
182 integer, intent(in) :: ixI^L, ixO^L
183 double precision, intent(in) :: w(ixI^S,nw), x(ixI^S,1:^ND)
184 double precision, intent(out) :: v(ixI^S,1:ndir)
185 end subroutine sub_get_v
186
187 subroutine sub_get_rho(w,x,ixI^L,ixO^L,rho)
189 integer, intent(in) :: ixI^L, ixO^L
190 double precision, intent(in) :: w(ixI^S,nw), x(ixI^S,1:^ND)
191 double precision, intent(out) :: rho(ixI^S)
192 end subroutine sub_get_rho
193
194 subroutine sub_get_h_speed(wprim,x,ixI^L,ixO^L,idim,Hspeed)
196 integer, intent(in) :: ixI^L, ixO^L, idim
197 double precision, intent(in) :: wprim(ixI^S, nw)
198 double precision, intent(in) :: x(ixI^S,1:ndim)
199 double precision, intent(out) :: Hspeed(ixI^S,1:number_species)
200 end subroutine sub_get_h_speed
201
202 subroutine sub_get_cbounds(wLC, wRC, wLp, wRp, x, ixI^L, ixO^L, idim, Hspeed, cmax, cmin)
204 use mod_variables
205 integer, intent(in) :: ixI^L, ixO^L, idim
206 double precision, intent(in) :: wLC(ixI^S, nw), wRC(ixI^S, nw)
207 double precision, intent(in) :: wLp(ixI^S, nw), wRp(ixI^S, nw)
208 double precision, intent(in) :: x(ixI^S, 1:^ND)
209 double precision, intent(inout) :: cmax(ixI^S,1:number_species)
210 double precision, intent(inout), optional :: cmin(ixI^S,1:number_species)
211 double precision, intent(in) :: Hspeed(ixI^S,1:number_species)
212 end subroutine sub_get_cbounds
213
214 subroutine sub_get_flux(wC, w, x, ixI^L, ixO^L, idim, f)
216 integer, intent(in) :: ixI^L, ixO^L, idim
217 double precision, intent(in) :: wC(ixI^S, 1:nw)
218 double precision, intent(in) :: w(ixI^S, 1:nw)
219 double precision, intent(in) :: x(ixI^S, 1:^ND)
220 double precision, intent(out) :: f(ixI^S, nwflux)
221 end subroutine sub_get_flux
222
223 subroutine sub_e_to_ei(ixI^L,ixO^L,w,x)
225 integer, intent(in) :: ixI^L, ixO^L
226 double precision, intent(inout) :: w(ixI^S, nw)
227 double precision, intent(in) :: x(ixI^S, 1:ndim)
228 end subroutine sub_e_to_ei
229
230 function sub_get_ei(w, ixI^L, ixO^L) result(ei)
232 integer, intent(in) :: ixi^l, ixo^l
233 double precision, intent(in) :: w(ixi^s, nw)
234 double precision :: ei(ixo^s)
235 end function sub_get_ei
236
237 subroutine sub_add_source_geom(qdt, dtfactor, ixI^L, ixO^L, wCT, wprim, w, x)
239 integer, intent(in) :: ixI^L, ixO^L
240 double precision, intent(in) :: qdt, dtfactor, x(ixI^S, 1:^ND)
241 double precision, intent(inout) :: wCT(ixI^S, 1:nw), wprim(ixI^S, 1:nw), w(ixI^S, 1:nw)
242 end subroutine sub_add_source_geom
243
244 subroutine sub_add_source(qdt, dtfactor, ixI^L, ixO^L, wCT, wCTprim, w, x, &
245 qsourcesplit, active)
247 integer, intent(in) :: ixI^L, ixO^L
248 double precision, intent(in) :: qdt, dtfactor
249 double precision, intent(in) :: wCT(ixI^S, 1:nw), wCTprim(ixI^S,1:nw), x(ixI^S, 1:ndim)
250 double precision, intent(inout) :: w(ixI^S, 1:nw)
251 logical, intent(in) :: qsourcesplit
252 logical, intent(inout) :: active !< Needs to be set to true when active
253 end subroutine sub_add_source
254
255 !> Add global source terms on complete domain (potentially implicit)
256 subroutine sub_global_source(qdt, qt, active)
258 double precision, intent(in) :: qdt !< Current time step
259 double precision, intent(in) :: qt !< Current time
260 logical, intent(inout) :: active !< Output if the source is active
261 end subroutine sub_global_source
262
263 !> clean initial divb
264 subroutine sub_clean_divb(qdt, qt, active)
266 double precision, intent(in) :: qdt !< Current time step
267 double precision, intent(in) :: qt !< Current time
268 logical, intent(inout) :: active !< Output if the source is active
269 end subroutine sub_clean_divb
270
271 !> set equilibrium variables other than b0 (e.g. p0 and rho0)
272 subroutine sub_set_equi_vars(igrid)
273 integer, intent(in) :: igrid
274 end subroutine sub_set_equi_vars
275
276
277 !> Add special advance in each advect step
278 subroutine sub_special_advance(qt, psa)
280 double precision, intent(in) :: qt !< Current time
281 type(state), target :: psa(max_blocks) !< Compute based on this state
282 end subroutine sub_special_advance
283
284 subroutine sub_get_dt(w, ixI^L, ixO^L, dtnew, dx^D, x)
286 integer, intent(in) :: ixI^L, ixO^L
287 double precision, intent(in) :: dx^D, x(ixI^S, 1:^ND)
288 double precision, intent(in) :: w(ixI^S, 1:nw)
289 double precision, intent(inout) :: dtnew
290 end subroutine sub_get_dt
291
292 subroutine sub_check_w(primitive, ixI^L, ixO^L, w, w_flag)
294 logical, intent(in) :: primitive
295 integer, intent(in) :: ixI^L, ixO^L
296 double precision, intent(in) :: w(ixI^S,1:nw)
297 logical, intent(inout) :: w_flag(ixI^S,1:nw)
298 end subroutine sub_check_w
299
300 subroutine sub_get_pthermal(w,x,ixI^L,ixO^L,pth)
302 integer, intent(in) :: ixI^L, ixO^L
303 double precision, intent(in) :: w(ixI^S,nw)
304 double precision, intent(in) :: x(ixI^S,1:ndim)
305 double precision, intent(out):: pth(ixI^S)
306 end subroutine sub_get_pthermal
307
308 subroutine sub_get_auxiliary(ixI^L,ixO^L,w,x)
310 integer, intent(in) :: ixI^L, ixO^L
311 double precision, intent(inout) :: w(ixI^S,nw)
312 double precision, intent(in) :: x(ixI^S,1:ndim)
313 end subroutine sub_get_auxiliary
314
315 subroutine sub_get_auxiliary_prim(ixI^L,ixO^L,w)
317 integer, intent(in) :: ixI^L, ixO^L
318 double precision, intent(inout) :: w(ixI^S,nw)
319 end subroutine sub_get_auxiliary_prim
320
321 subroutine sub_get_tgas(w,x,ixI^L,ixO^L,tgas)
323 integer, intent(in) :: ixI^L, ixO^L
324 double precision, intent(in) :: w(ixI^S,nw)
325 double precision, intent(in) :: x(ixI^S,1:ndim)
326 double precision, intent(out):: tgas(ixI^S)
327 end subroutine sub_get_tgas
328
329 subroutine sub_get_csrad2(w,x,ixI^L,ixO^L,cmax)
331 integer, intent(in) :: ixI^L, ixO^L
332 double precision, intent(in) :: w(ixI^S,nw)
333 double precision, intent(in) :: x(ixI^S,1:ndim)
334 double precision, intent(out):: cmax(ixI^S)
335 end subroutine sub_get_csrad2
336
337 subroutine sub_get_rfactor(w,x,ixI^L,ixO^L,cmax)
339 integer, intent(in) :: ixI^L, ixO^L
340 double precision, intent(in) :: w(ixI^S,nw)
341 double precision, intent(in) :: x(ixI^S,1:ndim)
342 double precision, intent(out):: cmax(ixI^S)
343 end subroutine sub_get_rfactor
344
345 subroutine sub_write_info(file_handle)
346 integer, intent(in) :: file_handle
347 end subroutine sub_write_info
348
349 subroutine sub_small_values(primitive, w, x, ixI^L, ixO^L, subname)
351 logical, intent(in) :: primitive
352 integer, intent(in) :: ixI^L,ixO^L
353 double precision, intent(inout) :: w(ixI^S,1:nw)
354 double precision, intent(in) :: x(ixI^S,1:ndim)
355 character(len=*), intent(in) :: subname
356 end subroutine sub_small_values
357
358 subroutine sub_get_ct_velocity(vcts,wLp,wRp,ixI^L,ixO^L,idim,cmax,cmin)
360
361 integer, intent(in) :: ixI^L, ixO^L, idim
362 double precision, intent(in) :: wLp(ixI^S, nw), wRp(ixI^S, nw)
363 double precision, intent(in) :: cmax(ixI^S)
364 double precision, intent(in), optional :: cmin(ixI^S)
365 type(ct_velocity), intent(inout):: vcts
366 end subroutine sub_get_ct_velocity
367
368 subroutine sub_update_faces(ixI^L,ixO^L,qt,qdt,wprim,fC,fE,sCT,s,vcts)
370 integer, intent(in) :: ixI^L, ixO^L
371 double precision, intent(in) :: qt, qdt
372 ! cell-center primitive variables
373 double precision, intent(in) :: wprim(ixI^S,1:nw)
374 ! velocity structure
375 type(state) :: sCT, s
376 type(ct_velocity) :: vcts
377 double precision, intent(in) :: fC(ixI^S,1:nwflux,1:ndim)
378 double precision, intent(inout) :: fE(ixI^S,sdim:3)
379 end subroutine sub_update_faces
380
381 subroutine sub_face_to_center(ixO^L,s)
383 integer, intent(in) :: ixO^L
384 type(state) :: s
385 end subroutine sub_face_to_center
386
387 subroutine sub_evaluate_implicit(qtC,psa)
389 type(state), target :: psa(max_blocks)
390 double precision, intent(in) :: qtC
391 end subroutine sub_evaluate_implicit
392
393 subroutine sub_implicit_update(dtfactor,qdt,qtC,psa,psb)
395 type(state), target :: psa(max_blocks)
396 type(state), target :: psb(max_blocks)
397 double precision, intent(in) :: qdt
398 double precision, intent(in) :: qtC
399 double precision, intent(in) :: dtfactor
400 end subroutine sub_implicit_update
401
402 subroutine sub_get_hd_mom_flux(wC,w,x,ixI^L,ixO^L,idims,f)
404 integer, intent(in) :: ixI^L, ixO^L, idims
405 ! conservative w
406 double precision, intent(in) :: wC(ixI^S,nw)
407 ! primitive w
408 double precision, intent(in) :: w(ixI^S,nw)
409 double precision, intent(in) :: x(ixI^S,1:ndim)
410 double precision,intent(out) :: f(ixI^S,1:ndir)
411 end subroutine sub_get_hd_mom_flux
412
413 end interface
414
415contains
416
417 subroutine phys_check()
418 use mod_global_parameters, only: nw, ndir
419
422 use mod_comm_lib, only: mpistop
423
424 if (physics_type == "") call mpistop("Error: no physics module loaded")
425
426 call phys_hllc_check()
427 call phys_roe_check()
428
429 ! Checks whether the required physics methods have been defined
430 if (.not. associated(phys_check_params)) &
432
433 if (.not. associated(phys_to_conserved)) &
434 call mpistop("Error: phys_to_conserved not defined")
435
436 if (.not. associated(phys_to_primitive)) &
437 call mpistop("Error: phys_to_primitive not defined")
438
439 if (.not. associated(phys_modify_wlr)) &
441
442 if (.not. associated(phys_get_cmax)) &
443 call mpistop("Error: no phys_get_cmax not defined")
444
445 if (.not. associated(phys_get_h_speed)) &
447
448 if (.not. associated(phys_get_cbounds)) &
449 call mpistop("Error: no phys_get_cbounds not defined")
450
451 if (.not. associated(phys_get_flux)) &
452 call mpistop("Error: no phys_get_flux not defined")
453
454 if (.not. associated(phys_get_dt)) &
455 call mpistop("Error: no phys_get_dt not defined")
456
457 if (.not. associated(phys_add_source_geom)) &
459
460 if (.not. associated(phys_add_source)) &
462
463 if (.not. associated(phys_check_w)) &
465
466 if (.not. associated(phys_get_pthermal)) &
468 if (.not. associated(phys_get_auxiliary)) &
470 if (.not. associated(phys_get_auxiliary_prim)) &
472
473 if (.not. associated(phys_boundary_adjust)) &
475
476 if (.not. associated(phys_write_info)) &
478
479 if (.not. associated(phys_handle_small_values)) &
481
482 if (.not. associated(phys_get_ct_velocity)) &
484
485 if (.not. associated(phys_update_faces)) &
487
488 if (.not. associated(phys_face_to_center)) &
490
491 if (.not. associated(phys_evaluate_implicit)) &
493
494 if (.not. associated(phys_implicit_update)) &
496
497 if (.not. associated(phys_get_hd_mom_flux)) &
499
500 end subroutine phys_check
501
503 end subroutine dummy_init_params
504
506 end subroutine dummy_check_params
507
508 subroutine dummy_modify_wlr(ixI^L, ixO^L, qt, wLC, wRC, wLp, wRp, s, idir)
510 integer, intent(in) :: ixI^L, ixO^L, idir
511 double precision, intent(in) :: qt
512 double precision, intent(inout) :: wLC(ixI^S,1:nw), wRC(ixI^S,1:nw)
513 double precision, intent(inout) :: wLp(ixI^S,1:nw), wRp(ixI^S,1:nw)
514 type(state) :: s
515 end subroutine dummy_modify_wlr
516
517 subroutine dummy_get_h_speed(wprim,x,ixI^L,ixO^L,idim,Hspeed)
519 integer, intent(in) :: ixI^L, ixO^L, idim
520 double precision, intent(in) :: wprim(ixI^S, nw)
521 double precision, intent(in) :: x(ixI^S,1:ndim)
522 double precision, intent(out) :: Hspeed(ixI^S,1:number_species)
523 end subroutine dummy_get_h_speed
524
525 subroutine dummy_add_source_geom(qdt, dtfactor, ixI^L, ixO^L, wCT, wprim, w, x)
527 integer, intent(in) :: ixI^L, ixO^L
528 double precision, intent(in) :: qdt, dtfactor, x(ixI^S, 1:^ND)
529 double precision, intent(inout) :: wCT(ixI^S, 1:nw), wprim(ixI^S,1:nw),w(ixI^S, 1:nw)
530 end subroutine dummy_add_source_geom
531
532 subroutine dummy_add_source(qdt, dtfactor, ixI^L, ixO^L, wCT, wCTprim, w, x, &
533 qsourcesplit, active)
535 integer, intent(in) :: ixI^L, ixO^L
536 double precision, intent(in) :: qdt,dtfactor
537 double precision, intent(in) :: wCT(ixI^S, 1:nw), wCTprim(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 ! Don't have to set active, since it starts as .false.
542 end subroutine dummy_add_source
543
544 subroutine dummy_check_w(primitive, ixI^L, ixO^L, w, w_flag)
546 logical, intent(in) :: primitive
547 integer, intent(in) :: ixI^L, ixO^L
548 double precision, intent(in) :: w(ixI^S,1:nw)
549 logical, intent(inout) :: w_flag(ixI^S,1:nw)
550
551 w_flag=.false. ! All okay
552 end subroutine dummy_check_w
553
554 subroutine dummy_get_pthermal(w, x, ixI^L, ixO^L, pth)
556 use mod_comm_lib, only: mpistop
557
558 integer, intent(in) :: ixI^L, ixO^L
559 double precision, intent(in) :: w(ixI^S, nw)
560 double precision, intent(in) :: x(ixI^S, 1:ndim)
561 double precision, intent(out):: pth(ixI^S)
562
563 call mpistop("No get_pthermal method specified")
564 end subroutine dummy_get_pthermal
565
566 subroutine dummy_get_auxiliary(ixI^L, ixO^L, w, x)
568 use mod_comm_lib, only: mpistop
569
570 integer, intent(in) :: ixI^L, ixO^L
571 double precision, intent(inout) :: w(ixI^S, nw)
572 double precision, intent(in) :: x(ixI^S, 1:ndim)
573
574 !call mpistop("No get_auxiliary method specified")
575 end subroutine dummy_get_auxiliary
576
577 subroutine dummy_get_auxiliary_prim(ixI^L, ixO^L, w)
579 use mod_comm_lib, only: mpistop
580
581 integer, intent(in) :: ixI^L, ixO^L
582 double precision, intent(inout) :: w(ixI^S, nw)
583
584 call mpistop("No get_auxiliary_prim method specified")
585 end subroutine dummy_get_auxiliary_prim
586
587 subroutine dummy_boundary_adjust(igrid,psb)
589 integer, intent(in) :: igrid
590 type(state), target :: psb(max_blocks)
591 end subroutine dummy_boundary_adjust
592
593 subroutine dummy_write_info(fh)
595 integer, intent(in) :: fh !< File handle
596 integer, dimension(MPI_STATUS_SIZE) :: st
597 integer :: er
598
599 ! Number of physics parameters
600 integer, parameter :: n_par = 0
601
602 call mpi_file_write(fh, n_par, 1, mpi_integer, st, er)
603 end subroutine dummy_write_info
604
605 subroutine dummy_small_values(primitive, w, x, ixI^L, ixO^L, subname)
607 logical, intent(in) :: primitive
608 integer, intent(in) :: ixI^L,ixO^L
609 double precision, intent(inout) :: w(ixI^S,1:nw)
610 double precision, intent(in) :: x(ixI^S,1:ndim)
611 character(len=*), intent(in) :: subname
612 end subroutine dummy_small_values
613
614 subroutine dummy_get_ct_velocity(vcts,wLp,wRp,ixI^L,ixO^L,idim,cmax,cmin)
616
617 integer, intent(in) :: ixI^L, ixO^L, idim
618 double precision, intent(in) :: wLp(ixI^S, nw), wRp(ixI^S, nw)
619 double precision, intent(in) :: cmax(ixI^S)
620 double precision, intent(in), optional :: cmin(ixI^S)
621 type(ct_velocity), intent(inout):: vcts
622 end subroutine dummy_get_ct_velocity
623
624 subroutine dummy_update_faces(ixI^L,ixO^L,qt,qdt,wprim,fC,fE,sCT,s,vcts)
626 integer, intent(in) :: ixI^L, ixO^L
627 double precision, intent(in) :: qt, qdt
628 ! cell-center primitive variables
629 double precision, intent(in) :: wprim(ixI^S,1:nw)
630 type(state) :: sCT, s
631 type(ct_velocity) :: vcts
632 double precision, intent(in) :: fC(ixI^S,1:nwflux,1:ndim)
633 double precision, intent(inout) :: fE(ixI^S,sdim:3)
634 end subroutine dummy_update_faces
635
636 subroutine dummy_face_to_center(ixO^L,s)
638 integer, intent(in) :: ixO^L
639 type(state) :: s
640 end subroutine dummy_face_to_center
641
642 subroutine dummy_evaluate_implicit(qtC,psa)
644 type(state), target :: psa(max_blocks)
645 double precision, intent(in) :: qtC
646 integer :: iigrid, igrid
647
648 ! Just copy in nul state
649 !$OMP PARALLEL DO PRIVATE(igrid)
650 do iigrid=1,igridstail; igrid=igrids(iigrid);
651 psa(igrid)%w = 0.0d0*psa(igrid)%w
652 if(stagger_grid) psa(igrid)%ws = 0.0d0*psa(igrid)%ws
653 end do
654 !$OMP END PARALLEL DO
655
656 end subroutine dummy_evaluate_implicit
657
658 subroutine dummy_implicit_update(dtfactor,qdt,qtC,psa,psb)
660 type(state), target :: psa(max_blocks)
661 type(state), target :: psb(max_blocks)
662 double precision, intent(in) :: qdt
663 double precision, intent(in) :: qtC
664 double precision, intent(in) :: dtfactor
665 integer :: iigrid, igrid
666
667 ! Just copy in psb state when using the scheme without implicit part
668 !$OMP PARALLEL DO PRIVATE(igrid)
669 do iigrid=1,igridstail; igrid=igrids(iigrid);
670 psa(igrid)%w = psb(igrid)%w
671 if(stagger_grid) psa(igrid)%ws = psb(igrid)%ws
672 end do
673 !$OMP END PARALLEL DO
674
675 end subroutine dummy_implicit_update
676
677 subroutine dummy_get_hd_mom_flux(wC,w,x,ixI^L,ixO^L,idims,f)
679 integer, intent(in) :: ixI^L, ixO^L, idims
680 ! conservative w
681 double precision, intent(in) :: wC(ixI^S,nw)
682 ! primitive w
683 double precision, intent(in) :: w(ixI^S,nw)
684 double precision, intent(in) :: x(ixI^S,1:ndim)
685 double precision,intent(out) :: f(ixI^S,1:ndir)
686 end subroutine dummy_get_hd_mom_flux
687
688end module mod_physics
Add global source terms on complete domain (potentially implicit).
set equilibrium variables other than b0 (e.g. p0 and rho0)
Add special advance in each advect step.
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
This module contains definitions of global parameters and variables and some generic functions/subrou...
logical stagger_grid
True for using stagger grid.
integer ndir
Number of spatial dimensions (components) for vector variables.
subroutine phys_hllc_check
subroutine phys_roe_check()
This module defines the procedures of a physics module. It contains function pointers for the various...
Definition mod_physics.t:4
procedure(sub_check_params), pointer phys_bind_eos_to_source
Definition mod_physics.t:55
procedure(sub_get_ct_velocity), pointer phys_get_ct_velocity
Definition mod_physics.t:87
subroutine dummy_implicit_update(dtfactor, qdt, qtc, psa, psb)
subroutine dummy_boundary_adjust(igrid, psb)
procedure(sub_convert), pointer phys_to_primitive
Definition mod_physics.t:54
procedure(sub_wb_transform), pointer phys_wb_transform
Definition mod_physics.t:59
procedure(sub_get_tgas), pointer phys_get_tgas
Definition mod_physics.t:81
integer, parameter flux_tvdlf
Indicates the flux should be treated with tvdlf.
Definition mod_physics.t:26
procedure(sub_small_values), pointer phys_handle_small_values
Definition mod_physics.t:86
procedure(sub_write_info), pointer phys_write_info
Definition mod_physics.t:85
procedure(sub_e_to_ei), pointer phys_e_to_ei
Definition mod_physics.t:68
procedure(sub_get_flux), pointer phys_get_flux
Definition mod_physics.t:67
procedure(sub_e_to_ei), pointer phys_ei_to_e
Definition mod_physics.t:69
procedure(sub_evaluate_implicit), pointer phys_evaluate_implicit
Definition mod_physics.t:91
subroutine dummy_get_auxiliary(ixil, ixol, w, x)
subroutine dummy_face_to_center(ixol, s)
procedure(sub_get_pthermal), pointer phys_get_gamma1
Definition mod_physics.t:80
subroutine dummy_modify_wlr(ixil, ixol, qt, wlc, wrc, wlp, wrp, s, idir)
procedure(sub_get_cbounds), pointer phys_get_cbounds
Definition mod_physics.t:66
logical phys_hd_mom_conserve_fix
exclude Maxwell stress flux from momentum flux (use hydrodynamic momentum flux) for conservation fix ...
Definition mod_physics.t:46
procedure(sub_check_params), pointer phys_te_images
Definition mod_physics.t:96
procedure(sub_wb_inverse), pointer phys_wb_inverse
Definition mod_physics.t:60
procedure(sub_get_dt), pointer phys_get_dt
Definition mod_physics.t:73
subroutine dummy_update_faces(ixil, ixol, qt, qdt, wprim, fc, fe, sct, s, vcts)
logical phys_total_energy
Solve total energy equation or not.
Definition mod_physics.t:40
integer, parameter flux_hll
Indicates the flux should be treated with hll.
Definition mod_physics.t:32
procedure(sub_get_pthermal), pointer phys_get_pthermal
Definition mod_physics.t:79
procedure(sub_get_tcutoff), pointer phys_get_tcutoff
Definition mod_physics.t:63
subroutine dummy_get_pthermal(w, x, ixil, ixol, pth)
procedure(sub_add_source_geom), pointer phys_add_source_geom
Definition mod_physics.t:74
procedure(sub_check_params), pointer phys_check_params
Definition mod_physics.t:51
procedure(sub_wb_prolong), pointer phys_wb_prolong
Definition mod_physics.t:61
integer, parameter flux_default
Indicates a normal flux.
Definition mod_physics.t:24
procedure(sub_get_auxiliary), pointer phys_get_auxiliary
Definition mod_physics.t:97
integer transverse_ghost_cells
extra ghost cells in the transverse dimensions for fluxes of CT
Definition mod_physics.t:34
subroutine dummy_get_h_speed(wprim, x, ixil, ixol, idim, hspeed)
subroutine dummy_small_values(primitive, w, x, ixil, ixol, subname)
procedure(sub_get_auxiliary_prim), pointer phys_get_auxiliary_prim
Definition mod_physics.t:98
integer, parameter flux_special
Indicates the flux should be specially treated.
Definition mod_physics.t:30
procedure(sub_trac_after_setdt), pointer phys_trac_after_setdt
Definition mod_physics.t:64
integer, parameter flux_no_dissipation
Indicates dissipation should be omitted.
Definition mod_physics.t:28
procedure(sub_get_ei), pointer phys_get_ei
Definition mod_physics.t:70
subroutine dummy_add_source_geom(qdt, dtfactor, ixil, ixol, wct, wprim, w, x)
procedure(sub_set_equi_vars), pointer phys_set_equi_vars
Definition mod_physics.t:94
integer, dimension(:, :), allocatable flux_type
Array per direction per variable, which can be used to specify that certain fluxes have to be treated...
Definition mod_physics.t:21
procedure(sub_get_rfactor), pointer phys_get_rfactor
Definition mod_physics.t:83
integer phys_wider_stencil
To use wider stencils in flux calculations. A value of 1 will extend it by one cell in both direction...
Definition mod_physics.t:17
procedure(sub_get_hd_mom_flux), pointer phys_get_hd_mom_flux
Definition mod_physics.t:99
subroutine dummy_init_params
procedure(sub_update_faces), pointer phys_update_faces
Definition mod_physics.t:88
procedure(sub_convert), pointer phys_to_prolong
Definition mod_physics.t:57
procedure(sub_convert), pointer phys_to_conserved
Definition mod_physics.t:53
character(len=name_len) physics_type
String describing the physics type of the simulation.
Definition mod_physics.t:49
procedure(sub_check_w), pointer phys_check_w
Definition mod_physics.t:78
subroutine dummy_get_ct_velocity(vcts, wlp, wrp, ixil, ixol, idim, cmax, cmin)
procedure(sub_set_mg_bounds), pointer phys_set_mg_bounds
Definition mod_physics.t:52
procedure(sub_implicit_update), pointer phys_implicit_update
Definition mod_physics.t:90
procedure(sub_convert), pointer phys_from_prolong
Definition mod_physics.t:58
subroutine dummy_evaluate_implicit(qtc, psa)
subroutine dummy_check_params
procedure(sub_clean_divb), pointer phys_clean_divb
Definition mod_physics.t:92
procedure(sub_boundary_adjust), pointer phys_boundary_adjust
Definition mod_physics.t:84
subroutine dummy_add_source(qdt, dtfactor, ixil, ixol, wct, wctprim, w, x, qsourcesplit, active)
double precision phys_gamma
Definition mod_physics.t:13
procedure(sub_global_source), pointer phys_global_source_after
Definition mod_physics.t:76
procedure(sub_add_source), pointer phys_add_source
Definition mod_physics.t:75
procedure(sub_face_to_center), pointer phys_face_to_center
Definition mod_physics.t:89
procedure(sub_modify_wlr), pointer phys_modify_wlr
Definition mod_physics.t:56
subroutine dummy_write_info(fh)
procedure(sub_get_h_speed), pointer phys_get_h_speed
Definition mod_physics.t:65
subroutine dummy_get_auxiliary_prim(ixil, ixol, w)
logical phys_internal_e
Solve internal energy instead of total energy.
Definition mod_physics.t:43
procedure(sub_get_cmax), pointer phys_get_cmax
Definition mod_physics.t:62
procedure(sub_get_rho), pointer phys_get_rho
Definition mod_physics.t:72
procedure(sub_get_v), pointer phys_get_v
Definition mod_physics.t:71
subroutine dummy_check_w(primitive, ixil, ixol, w, w_flag)
subroutine phys_check()
procedure(sub_get_csrad2), pointer phys_get_csrad2
Definition mod_physics.t:82
logical phys_energy
Solve energy equation or not.
Definition mod_physics.t:37
subroutine dummy_get_hd_mom_flux(wc, w, x, ixil, ixol, idims, f)
procedure(sub_special_advance), pointer phys_special_advance
Definition mod_physics.t:77
Module with all the methods that users can customize in AMRVAC.