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
46 !> String describing the physics type of the simulation
47 character(len=name_len) :: physics_type = ""
48
49 procedure(sub_check_params), pointer :: phys_check_params => null()
50 procedure(sub_set_mg_bounds), pointer :: phys_set_mg_bounds => null()
51 procedure(sub_convert), pointer :: phys_to_conserved => null()
52 procedure(sub_convert), pointer :: phys_to_primitive => null()
53 procedure(sub_check_params), pointer :: phys_bind_eos_to_source => null()
54 procedure(sub_modify_wlr), pointer :: phys_modify_wlr => null()
55 procedure(sub_convert), pointer :: phys_to_prolong => null()
56 procedure(sub_convert), pointer :: phys_from_prolong => null()
57 procedure(sub_wb_transform), pointer :: phys_wb_transform => null()
58 procedure(sub_wb_inverse), pointer :: phys_wb_inverse => null()
59 procedure(sub_wb_prolong), pointer :: phys_wb_prolong => null()
60 procedure(sub_get_cmax), pointer :: phys_get_cmax => null()
61 procedure(sub_get_tcutoff), pointer :: phys_get_tcutoff => null()
62 procedure(sub_trac_after_setdt), pointer:: phys_trac_after_setdt => null()
63 procedure(sub_get_h_speed), pointer :: phys_get_h_speed => null()
64 procedure(sub_get_cbounds), pointer :: phys_get_cbounds => null()
65 procedure(sub_get_flux), pointer :: phys_get_flux => null()
66 procedure(sub_e_to_ei), pointer :: phys_e_to_ei => null()
67 procedure(sub_e_to_ei), pointer :: phys_ei_to_e => null()
68 procedure(sub_get_ei), pointer :: phys_get_ei => null()
69 procedure(sub_get_v), pointer :: phys_get_v => null()
70 procedure(sub_get_rho), pointer :: phys_get_rho => null()
71 procedure(sub_get_dt), pointer :: phys_get_dt => null()
72 procedure(sub_add_source_geom), pointer :: phys_add_source_geom => null()
73 procedure(sub_add_source), pointer :: phys_add_source => null()
74 procedure(sub_global_source), pointer :: phys_global_source_after => null()
75 procedure(sub_special_advance), pointer :: phys_special_advance => null()
76 procedure(sub_check_w), pointer :: phys_check_w => null()
77 procedure(sub_get_pthermal), pointer :: phys_get_pthermal => null()
78 procedure(sub_get_pthermal), pointer :: phys_get_gamma1 => null()
79 procedure(sub_get_tgas), pointer :: phys_get_tgas => null()
80 procedure(sub_get_csrad2), pointer :: phys_get_csrad2 => null()
81 procedure(sub_get_rfactor), pointer :: phys_get_rfactor => null()
82 procedure(sub_boundary_adjust), pointer :: phys_boundary_adjust => null()
83 procedure(sub_write_info), pointer :: phys_write_info => null()
84 procedure(sub_small_values), pointer :: phys_handle_small_values => null()
85 procedure(sub_get_ct_velocity), pointer :: phys_get_ct_velocity => null()
86 procedure(sub_update_faces), pointer :: phys_update_faces => null()
87 procedure(sub_face_to_center), pointer :: phys_face_to_center => null()
88 procedure(sub_implicit_update), pointer :: phys_implicit_update => null()
89 procedure(sub_evaluate_implicit),pointer:: phys_evaluate_implicit => null()
90 procedure(sub_clean_divb), pointer :: phys_clean_divb => null()
91 ! set the equilibrium variables
92 procedure(sub_set_equi_vars), pointer :: phys_set_equi_vars => null()
93 ! subroutine with no parameters which creates EUV images
94 procedure(sub_check_params), pointer :: phys_te_images => null()
95 procedure(sub_get_auxiliary), pointer :: phys_get_auxiliary => null()
96 procedure(sub_get_auxiliary_prim), pointer :: phys_get_auxiliary_prim => null()
97
98 abstract interface
99
101 end subroutine sub_check_params
102
106 end subroutine sub_set_mg_bounds
107
108 subroutine sub_boundary_adjust(igrid,psb)
110 integer, intent(in) :: igrid
111 type(state), target :: psb(max_blocks)
112 end subroutine sub_boundary_adjust
113
114 subroutine sub_convert(ixI^L, ixO^L, w, x)
116 integer, intent(in) :: ixI^L, ixO^L
117 double precision, intent(inout) :: w(ixI^S, nw)
118 double precision, intent(in) :: x(ixI^S, 1:^ND)
119 end subroutine sub_convert
120
121 subroutine sub_modify_wlr(ixI^L, ixO^L, qt, wLC, wRC, wLp, wRp, s, idir)
123 integer, intent(in) :: ixI^L, ixO^L, idir
124 double precision, intent(in) :: qt
125 double precision, intent(inout) :: wLC(ixI^S,1:nw), wRC(ixI^S,1:nw)
126 double precision, intent(inout) :: wLp(ixI^S,1:nw), wRp(ixI^S,1:nw)
127 type(state) :: s
128 end subroutine sub_modify_wlr
129
130 subroutine sub_wb_transform(ixI^L, ixO^L, idims, w, x, wb_phi, &
131 wb_phi_face, wb_T)
133 integer, intent(in) :: ixI^L, ixO^L, idims
134 double precision, intent(inout) :: w(ixI^S, 1:nw)
135 double precision, intent(in) :: x(ixI^S, 1:ndim)
136 double precision, intent(out) :: wb_phi(ixI^S)
137 double precision, intent(out) :: wb_phi_face(ixI^S)
138 double precision, intent(out) :: wb_T(ixI^S)
139 end subroutine sub_wb_transform
140
141 subroutine sub_wb_inverse(ixI^L, ixL^L, ixR^L, idims, wLp, wRp, w, &
142 wb_phi, wb_phi_face, wb_T)
144 integer, intent(in) :: ixI^L, ixL^L, ixR^L, idims
145 double precision, intent(inout) :: wLp(ixI^S, 1:nw), wRp(ixI^S, 1:nw)
146 double precision, intent(inout) :: w(ixI^S, 1:nw)
147 double precision, intent(in) :: wb_phi(ixI^S), wb_phi_face(ixI^S)
148 double precision, intent(in) :: wb_T(ixI^S)
149 end subroutine sub_wb_inverse
150
151 subroutine sub_wb_prolong(ixI^L, ixO^L, w, x)
153 integer, intent(in) :: ixI^L, ixO^L
154 double precision, intent(inout) :: w(ixI^S, 1:nw)
155 double precision, intent(in) :: x(ixI^S, 1:ndim)
156 end subroutine sub_wb_prolong
157
158 subroutine sub_get_cmax(w, x, ixI^L, ixO^L, idim, cmax)
160 integer, intent(in) :: ixI^L, ixO^L, idim
161 double precision, intent(in) :: w(ixI^S, nw), x(ixI^S, 1:^ND)
162 double precision, intent(inout) :: cmax(ixI^S)
163 end subroutine sub_get_cmax
164
165 subroutine sub_get_tcutoff(ixI^L,ixO^L,w,x,tco_local,Tmax_local)
167 integer, intent(in) :: ixI^L, ixO^L
168 double precision, intent(inout) :: w(ixI^S, nw)
169 double precision, intent(in) :: x(ixI^S, 1:^ND)
170 double precision, intent(out) :: tco_local, Tmax_local
171 end subroutine sub_get_tcutoff
172
173 subroutine sub_trac_after_setdt(trac_alfa,tco,T_peak,T_bott)
174 double precision, intent(in) :: trac_alfa,tco,T_peak,T_bott
175 end subroutine sub_trac_after_setdt
176
177 subroutine sub_get_v(w,x,ixI^L,ixO^L,v)
179 integer, intent(in) :: ixI^L, ixO^L
180 double precision, intent(in) :: w(ixI^S,nw), x(ixI^S,1:^ND)
181 double precision, intent(out) :: v(ixI^S,1:ndir)
182 end subroutine sub_get_v
183
184 subroutine sub_get_rho(w,x,ixI^L,ixO^L,rho)
186 integer, intent(in) :: ixI^L, ixO^L
187 double precision, intent(in) :: w(ixI^S,nw), x(ixI^S,1:^ND)
188 double precision, intent(out) :: rho(ixI^S)
189 end subroutine sub_get_rho
190
191 subroutine sub_get_h_speed(wprim,x,ixI^L,ixO^L,idim,Hspeed)
193 integer, intent(in) :: ixI^L, ixO^L, idim
194 double precision, intent(in) :: wprim(ixI^S, nw)
195 double precision, intent(in) :: x(ixI^S,1:ndim)
196 double precision, intent(out) :: Hspeed(ixI^S,1:number_species)
197 end subroutine sub_get_h_speed
198
199 subroutine sub_get_cbounds(wLC, wRC, wLp, wRp, x, ixI^L, ixO^L, idim, Hspeed, cmax, cmin)
201 use mod_variables
202 integer, intent(in) :: ixI^L, ixO^L, idim
203 double precision, intent(in) :: wLC(ixI^S, nw), wRC(ixI^S, nw)
204 double precision, intent(in) :: wLp(ixI^S, nw), wRp(ixI^S, nw)
205 double precision, intent(in) :: x(ixI^S, 1:^ND)
206 double precision, intent(inout) :: cmax(ixI^S,1:number_species)
207 double precision, intent(inout), optional :: cmin(ixI^S,1:number_species)
208 double precision, intent(in) :: Hspeed(ixI^S,1:number_species)
209 end subroutine sub_get_cbounds
210
211 subroutine sub_get_flux(wC, w, x, ixI^L, ixO^L, idim, f)
213 integer, intent(in) :: ixI^L, ixO^L, idim
214 double precision, intent(in) :: wC(ixI^S, 1:nw)
215 double precision, intent(in) :: w(ixI^S, 1:nw)
216 double precision, intent(in) :: x(ixI^S, 1:^ND)
217 double precision, intent(out) :: f(ixI^S, nwflux)
218 end subroutine sub_get_flux
219
220 subroutine sub_e_to_ei(ixI^L,ixO^L,w,x)
222 integer, intent(in) :: ixI^L, ixO^L
223 double precision, intent(inout) :: w(ixI^S, nw)
224 double precision, intent(in) :: x(ixI^S, 1:ndim)
225 end subroutine sub_e_to_ei
226
227 function sub_get_ei(w, ixI^L, ixO^L) result(ei)
229 integer, intent(in) :: ixi^l, ixo^l
230 double precision, intent(in) :: w(ixi^s, nw)
231 double precision :: ei(ixo^s)
232 end function sub_get_ei
233
234 subroutine sub_add_source_geom(qdt, dtfactor, ixI^L, ixO^L, wCT, wprim, w, x)
236 integer, intent(in) :: ixI^L, ixO^L
237 double precision, intent(in) :: qdt, dtfactor, x(ixI^S, 1:^ND)
238 double precision, intent(inout) :: wCT(ixI^S, 1:nw), wprim(ixI^S, 1:nw), w(ixI^S, 1:nw)
239 end subroutine sub_add_source_geom
240
241 subroutine sub_add_source(qdt, dtfactor, ixI^L, ixO^L, wCT, wCTprim, w, x, &
242 qsourcesplit, active)
244 integer, intent(in) :: ixI^L, ixO^L
245 double precision, intent(in) :: qdt, dtfactor
246 double precision, intent(in) :: wCT(ixI^S, 1:nw), wCTprim(ixI^S,1:nw), x(ixI^S, 1:ndim)
247 double precision, intent(inout) :: w(ixI^S, 1:nw)
248 logical, intent(in) :: qsourcesplit
249 logical, intent(inout) :: active !< Needs to be set to true when active
250 end subroutine sub_add_source
251
252 !> Add global source terms on complete domain (potentially implicit)
253 subroutine sub_global_source(qdt, qt, active)
255 double precision, intent(in) :: qdt !< Current time step
256 double precision, intent(in) :: qt !< Current time
257 logical, intent(inout) :: active !< Output if the source is active
258 end subroutine sub_global_source
259
260 !> clean initial divb
261 subroutine sub_clean_divb(qdt, qt, active)
263 double precision, intent(in) :: qdt !< Current time step
264 double precision, intent(in) :: qt !< Current time
265 logical, intent(inout) :: active !< Output if the source is active
266 end subroutine sub_clean_divb
267
268 !> set equilibrium variables other than b0 (e.g. p0 and rho0)
269 subroutine sub_set_equi_vars(igrid)
270 integer, intent(in) :: igrid
271 end subroutine sub_set_equi_vars
272
273
274 !> Add special advance in each advect step
275 subroutine sub_special_advance(qt, psa)
277 double precision, intent(in) :: qt !< Current time
278 type(state), target :: psa(max_blocks) !< Compute based on this state
279 end subroutine sub_special_advance
280
281 subroutine sub_get_dt(w, ixI^L, ixO^L, dtnew, dx^D, x)
283 integer, intent(in) :: ixI^L, ixO^L
284 double precision, intent(in) :: dx^D, x(ixI^S, 1:^ND)
285 double precision, intent(in) :: w(ixI^S, 1:nw)
286 double precision, intent(inout) :: dtnew
287 end subroutine sub_get_dt
288
289 subroutine sub_check_w(primitive, ixI^L, ixO^L, w, w_flag)
291 logical, intent(in) :: primitive
292 integer, intent(in) :: ixI^L, ixO^L
293 double precision, intent(in) :: w(ixI^S,1:nw)
294 logical, intent(inout) :: w_flag(ixI^S,1:nw)
295 end subroutine sub_check_w
296
297 subroutine sub_get_pthermal(w,x,ixI^L,ixO^L,pth)
299 integer, intent(in) :: ixI^L, ixO^L
300 double precision, intent(in) :: w(ixI^S,nw)
301 double precision, intent(in) :: x(ixI^S,1:ndim)
302 double precision, intent(out):: pth(ixI^S)
303 end subroutine sub_get_pthermal
304
305 subroutine sub_get_auxiliary(ixI^L,ixO^L,w,x)
307 integer, intent(in) :: ixI^L, ixO^L
308 double precision, intent(inout) :: w(ixI^S,nw)
309 double precision, intent(in) :: x(ixI^S,1:ndim)
310 end subroutine sub_get_auxiliary
311
312 subroutine sub_get_auxiliary_prim(ixI^L,ixO^L,w)
314 integer, intent(in) :: ixI^L, ixO^L
315 double precision, intent(inout) :: w(ixI^S,nw)
316 end subroutine sub_get_auxiliary_prim
317
318 subroutine sub_get_tgas(w,x,ixI^L,ixO^L,tgas)
320 integer, intent(in) :: ixI^L, ixO^L
321 double precision, intent(in) :: w(ixI^S,nw)
322 double precision, intent(in) :: x(ixI^S,1:ndim)
323 double precision, intent(out):: tgas(ixI^S)
324 end subroutine sub_get_tgas
325
326 subroutine sub_get_csrad2(w,x,ixI^L,ixO^L,cmax)
328 integer, intent(in) :: ixI^L, ixO^L
329 double precision, intent(in) :: w(ixI^S,nw)
330 double precision, intent(in) :: x(ixI^S,1:ndim)
331 double precision, intent(out):: cmax(ixI^S)
332 end subroutine sub_get_csrad2
333
334 subroutine sub_get_rfactor(w,x,ixI^L,ixO^L,cmax)
336 integer, intent(in) :: ixI^L, ixO^L
337 double precision, intent(in) :: w(ixI^S,nw)
338 double precision, intent(in) :: x(ixI^S,1:ndim)
339 double precision, intent(out):: cmax(ixI^S)
340 end subroutine sub_get_rfactor
341
342 subroutine sub_write_info(file_handle)
343 integer, intent(in) :: file_handle
344 end subroutine sub_write_info
345
346 subroutine sub_small_values(primitive, w, x, ixI^L, ixO^L, subname)
348 logical, intent(in) :: primitive
349 integer, intent(in) :: ixI^L,ixO^L
350 double precision, intent(inout) :: w(ixI^S,1:nw)
351 double precision, intent(in) :: x(ixI^S,1:ndim)
352 character(len=*), intent(in) :: subname
353 end subroutine sub_small_values
354
355 subroutine sub_get_ct_velocity(vcts,wLp,wRp,ixI^L,ixO^L,idim,cmax,cmin)
357
358 integer, intent(in) :: ixI^L, ixO^L, idim
359 double precision, intent(in) :: wLp(ixI^S, nw), wRp(ixI^S, nw)
360 double precision, intent(in) :: cmax(ixI^S)
361 double precision, intent(in), optional :: cmin(ixI^S)
362 type(ct_velocity), intent(inout):: vcts
363 end subroutine sub_get_ct_velocity
364
365 subroutine sub_update_faces(ixI^L,ixO^L,qt,qdt,wprim,fC,fE,sCT,s,vcts)
367 integer, intent(in) :: ixI^L, ixO^L
368 double precision, intent(in) :: qt, qdt
369 ! cell-center primitive variables
370 double precision, intent(in) :: wprim(ixI^S,1:nw)
371 ! velocity structure
372 type(state) :: sCT, s
373 type(ct_velocity) :: vcts
374 double precision, intent(in) :: fC(ixI^S,1:nwflux,1:ndim)
375 double precision, intent(inout) :: fE(ixI^S,sdim:3)
376 end subroutine sub_update_faces
377
378 subroutine sub_face_to_center(ixO^L,s)
380 integer, intent(in) :: ixO^L
381 type(state) :: s
382 end subroutine sub_face_to_center
383
384 subroutine sub_evaluate_implicit(qtC,psa)
386 type(state), target :: psa(max_blocks)
387 double precision, intent(in) :: qtC
388 end subroutine sub_evaluate_implicit
389
390 subroutine sub_implicit_update(dtfactor,qdt,qtC,psa,psb)
392 type(state), target :: psa(max_blocks)
393 type(state), target :: psb(max_blocks)
394 double precision, intent(in) :: qdt
395 double precision, intent(in) :: qtC
396 double precision, intent(in) :: dtfactor
397 end subroutine sub_implicit_update
398
399 end interface
400
401contains
402
403 subroutine phys_check()
404 use mod_global_parameters, only: nw, ndir
405
408 use mod_comm_lib, only: mpistop
409
410 if (physics_type == "") call mpistop("Error: no physics module loaded")
411
412 call phys_hllc_check()
413 call phys_roe_check()
414
415 ! Checks whether the required physics methods have been defined
416 if (.not. associated(phys_check_params)) &
418
419 if (.not. associated(phys_to_conserved)) &
420 call mpistop("Error: phys_to_conserved not defined")
421
422 if (.not. associated(phys_to_primitive)) &
423 call mpistop("Error: phys_to_primitive not defined")
424
425 if (.not. associated(phys_modify_wlr)) &
427
428 if (.not. associated(phys_get_cmax)) &
429 call mpistop("Error: no phys_get_cmax not defined")
430
431 if (.not. associated(phys_get_h_speed)) &
433
434 if (.not. associated(phys_get_cbounds)) &
435 call mpistop("Error: no phys_get_cbounds not defined")
436
437 if (.not. associated(phys_get_flux)) &
438 call mpistop("Error: no phys_get_flux not defined")
439
440 if (.not. associated(phys_get_dt)) &
441 call mpistop("Error: no phys_get_dt not defined")
442
443 if (.not. associated(phys_add_source_geom)) &
445
446 if (.not. associated(phys_add_source)) &
448
449 if (.not. associated(phys_check_w)) &
451
452 if (.not. associated(phys_get_pthermal)) &
454 if (.not. associated(phys_get_auxiliary)) &
456 if (.not. associated(phys_get_auxiliary_prim)) &
458
459 if (.not. associated(phys_boundary_adjust)) &
461
462 if (.not. associated(phys_write_info)) &
464
465 if (.not. associated(phys_handle_small_values)) &
467
468 if (.not. associated(phys_get_ct_velocity)) &
470
471 if (.not. associated(phys_update_faces)) &
473
474 if (.not. associated(phys_face_to_center)) &
476
477 if (.not. associated(phys_evaluate_implicit)) &
479
480 if (.not. associated(phys_implicit_update)) &
482
483 end subroutine phys_check
484
486 end subroutine dummy_init_params
487
489 end subroutine dummy_check_params
490
491 subroutine dummy_modify_wlr(ixI^L, ixO^L, qt, wLC, wRC, wLp, wRp, s, idir)
493 integer, intent(in) :: ixI^L, ixO^L, idir
494 double precision, intent(in) :: qt
495 double precision, intent(inout) :: wLC(ixI^S,1:nw), wRC(ixI^S,1:nw)
496 double precision, intent(inout) :: wLp(ixI^S,1:nw), wRp(ixI^S,1:nw)
497 type(state) :: s
498 end subroutine dummy_modify_wlr
499
500 subroutine dummy_get_h_speed(wprim,x,ixI^L,ixO^L,idim,Hspeed)
502 integer, intent(in) :: ixI^L, ixO^L, idim
503 double precision, intent(in) :: wprim(ixI^S, nw)
504 double precision, intent(in) :: x(ixI^S,1:ndim)
505 double precision, intent(out) :: Hspeed(ixI^S,1:number_species)
506 end subroutine dummy_get_h_speed
507
508 subroutine dummy_add_source_geom(qdt, dtfactor, ixI^L, ixO^L, wCT, wprim, w, x)
510 integer, intent(in) :: ixI^L, ixO^L
511 double precision, intent(in) :: qdt, dtfactor, x(ixI^S, 1:^ND)
512 double precision, intent(inout) :: wCT(ixI^S, 1:nw), wprim(ixI^S,1:nw),w(ixI^S, 1:nw)
513 end subroutine dummy_add_source_geom
514
515 subroutine dummy_add_source(qdt, dtfactor, ixI^L, ixO^L, wCT, wCTprim, w, x, &
516 qsourcesplit, active)
518 integer, intent(in) :: ixI^L, ixO^L
519 double precision, intent(in) :: qdt,dtfactor
520 double precision, intent(in) :: wCT(ixI^S, 1:nw), wCTprim(ixI^S,1:nw), x(ixI^S, 1:ndim)
521 double precision, intent(inout) :: w(ixI^S, 1:nw)
522 logical, intent(in) :: qsourcesplit
523 logical, intent(inout) :: active
524 ! Don't have to set active, since it starts as .false.
525 end subroutine dummy_add_source
526
527 subroutine dummy_check_w(primitive, ixI^L, ixO^L, w, w_flag)
529 logical, intent(in) :: primitive
530 integer, intent(in) :: ixI^L, ixO^L
531 double precision, intent(in) :: w(ixI^S,1:nw)
532 logical, intent(inout) :: w_flag(ixI^S,1:nw)
533
534 w_flag=.false. ! All okay
535 end subroutine dummy_check_w
536
537 subroutine dummy_get_pthermal(w, x, ixI^L, ixO^L, pth)
539 use mod_comm_lib, only: mpistop
540
541 integer, intent(in) :: ixI^L, ixO^L
542 double precision, intent(in) :: w(ixI^S, nw)
543 double precision, intent(in) :: x(ixI^S, 1:ndim)
544 double precision, intent(out):: pth(ixI^S)
545
546 call mpistop("No get_pthermal method specified")
547 end subroutine dummy_get_pthermal
548
549 subroutine dummy_get_auxiliary(ixI^L, ixO^L, w, x)
551 use mod_comm_lib, only: mpistop
552
553 integer, intent(in) :: ixI^L, ixO^L
554 double precision, intent(inout) :: w(ixI^S, nw)
555 double precision, intent(in) :: x(ixI^S, 1:ndim)
556
557 !call mpistop("No get_auxiliary method specified")
558 end subroutine dummy_get_auxiliary
559
560 subroutine dummy_get_auxiliary_prim(ixI^L, ixO^L, w)
562 use mod_comm_lib, only: mpistop
563
564 integer, intent(in) :: ixI^L, ixO^L
565 double precision, intent(inout) :: w(ixI^S, nw)
566
567 call mpistop("No get_auxiliary_prim method specified")
568 end subroutine dummy_get_auxiliary_prim
569
570 subroutine dummy_boundary_adjust(igrid,psb)
572 integer, intent(in) :: igrid
573 type(state), target :: psb(max_blocks)
574 end subroutine dummy_boundary_adjust
575
576 subroutine dummy_write_info(fh)
578 integer, intent(in) :: fh !< File handle
579 integer, dimension(MPI_STATUS_SIZE) :: st
580 integer :: er
581
582 ! Number of physics parameters
583 integer, parameter :: n_par = 0
584
585 call mpi_file_write(fh, n_par, 1, mpi_integer, st, er)
586 end subroutine dummy_write_info
587
588 subroutine dummy_small_values(primitive, w, x, ixI^L, ixO^L, subname)
590 logical, intent(in) :: primitive
591 integer, intent(in) :: ixI^L,ixO^L
592 double precision, intent(inout) :: w(ixI^S,1:nw)
593 double precision, intent(in) :: x(ixI^S,1:ndim)
594 character(len=*), intent(in) :: subname
595 end subroutine dummy_small_values
596
597 subroutine dummy_get_ct_velocity(vcts,wLp,wRp,ixI^L,ixO^L,idim,cmax,cmin)
599
600 integer, intent(in) :: ixI^L, ixO^L, idim
601 double precision, intent(in) :: wLp(ixI^S, nw), wRp(ixI^S, nw)
602 double precision, intent(in) :: cmax(ixI^S)
603 double precision, intent(in), optional :: cmin(ixI^S)
604 type(ct_velocity), intent(inout):: vcts
605 end subroutine dummy_get_ct_velocity
606
607 subroutine dummy_update_faces(ixI^L,ixO^L,qt,qdt,wprim,fC,fE,sCT,s,vcts)
609 integer, intent(in) :: ixI^L, ixO^L
610 double precision, intent(in) :: qt, qdt
611 ! cell-center primitive variables
612 double precision, intent(in) :: wprim(ixI^S,1:nw)
613 type(state) :: sCT, s
614 type(ct_velocity) :: vcts
615 double precision, intent(in) :: fC(ixI^S,1:nwflux,1:ndim)
616 double precision, intent(inout) :: fE(ixI^S,sdim:3)
617 end subroutine dummy_update_faces
618
619 subroutine dummy_face_to_center(ixO^L,s)
621 integer, intent(in) :: ixO^L
622 type(state) :: s
623 end subroutine dummy_face_to_center
624
625 subroutine dummy_evaluate_implicit(qtC,psa)
627 type(state), target :: psa(max_blocks)
628 double precision, intent(in) :: qtC
629 integer :: iigrid, igrid
630
631 ! Just copy in nul state
632 !$OMP PARALLEL DO PRIVATE(igrid)
633 do iigrid=1,igridstail; igrid=igrids(iigrid);
634 psa(igrid)%w = 0.0d0*psa(igrid)%w
635 if(stagger_grid) psa(igrid)%ws = 0.0d0*psa(igrid)%ws
636 end do
637 !$OMP END PARALLEL DO
638
639 end subroutine dummy_evaluate_implicit
640
641 subroutine dummy_implicit_update(dtfactor,qdt,qtC,psa,psb)
643 type(state), target :: psa(max_blocks)
644 type(state), target :: psb(max_blocks)
645 double precision, intent(in) :: qdt
646 double precision, intent(in) :: qtC
647 double precision, intent(in) :: dtfactor
648 integer :: iigrid, igrid
649
650 ! Just copy in psb state when using the scheme without implicit part
651 !$OMP PARALLEL DO PRIVATE(igrid)
652 do iigrid=1,igridstail; igrid=igrids(iigrid);
653 psa(igrid)%w = psb(igrid)%w
654 if(stagger_grid) psa(igrid)%ws = psb(igrid)%ws
655 end do
656 !$OMP END PARALLEL DO
657
658 end subroutine dummy_implicit_update
659
660end 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:53
procedure(sub_get_ct_velocity), pointer phys_get_ct_velocity
Definition mod_physics.t:85
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:52
procedure(sub_wb_transform), pointer phys_wb_transform
Definition mod_physics.t:57
procedure(sub_get_tgas), pointer phys_get_tgas
Definition mod_physics.t:79
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:84
procedure(sub_write_info), pointer phys_write_info
Definition mod_physics.t:83
procedure(sub_e_to_ei), pointer phys_e_to_ei
Definition mod_physics.t:66
procedure(sub_get_flux), pointer phys_get_flux
Definition mod_physics.t:65
procedure(sub_e_to_ei), pointer phys_ei_to_e
Definition mod_physics.t:67
procedure(sub_evaluate_implicit), pointer phys_evaluate_implicit
Definition mod_physics.t:89
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:78
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:64
procedure(sub_check_params), pointer phys_te_images
Definition mod_physics.t:94
procedure(sub_wb_inverse), pointer phys_wb_inverse
Definition mod_physics.t:58
procedure(sub_get_dt), pointer phys_get_dt
Definition mod_physics.t:71
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:77
procedure(sub_get_tcutoff), pointer phys_get_tcutoff
Definition mod_physics.t:61
subroutine dummy_get_pthermal(w, x, ixil, ixol, pth)
procedure(sub_add_source_geom), pointer phys_add_source_geom
Definition mod_physics.t:72
procedure(sub_check_params), pointer phys_check_params
Definition mod_physics.t:49
procedure(sub_wb_prolong), pointer phys_wb_prolong
Definition mod_physics.t:59
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:95
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:96
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:62
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:68
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:92
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:81
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
subroutine dummy_init_params
procedure(sub_update_faces), pointer phys_update_faces
Definition mod_physics.t:86
procedure(sub_convert), pointer phys_to_prolong
Definition mod_physics.t:55
procedure(sub_convert), pointer phys_to_conserved
Definition mod_physics.t:51
character(len=name_len) physics_type
String describing the physics type of the simulation.
Definition mod_physics.t:47
procedure(sub_check_w), pointer phys_check_w
Definition mod_physics.t:76
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:50
procedure(sub_implicit_update), pointer phys_implicit_update
Definition mod_physics.t:88
procedure(sub_convert), pointer phys_from_prolong
Definition mod_physics.t:56
subroutine dummy_evaluate_implicit(qtc, psa)
subroutine dummy_check_params
procedure(sub_clean_divb), pointer phys_clean_divb
Definition mod_physics.t:90
procedure(sub_boundary_adjust), pointer phys_boundary_adjust
Definition mod_physics.t:82
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:74
procedure(sub_add_source), pointer phys_add_source
Definition mod_physics.t:73
procedure(sub_face_to_center), pointer phys_face_to_center
Definition mod_physics.t:87
procedure(sub_modify_wlr), pointer phys_modify_wlr
Definition mod_physics.t:54
subroutine dummy_write_info(fh)
procedure(sub_get_h_speed), pointer phys_get_h_speed
Definition mod_physics.t:63
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:60
procedure(sub_get_rho), pointer phys_get_rho
Definition mod_physics.t:70
procedure(sub_get_v), pointer phys_get_v
Definition mod_physics.t:69
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:80
logical phys_energy
Solve energy equation or not.
Definition mod_physics.t:37
procedure(sub_special_advance), pointer phys_special_advance
Definition mod_physics.t:75
Module with all the methods that users can customize in AMRVAC.