Initialize the module
subroutine phys_init() use mod_global_parameters use mod_radiative_cooling, only: rc_fl, radiative_cooling_init_params, radiative_cooling_init call read_params(par_files) call phys_units() phys_energy = ffhd_energy phys_total_energy = ffhd_energy phys_internal_e = .false. phys_gamma = ffhd_gamma phys_partial_ionization=ffhd_partial_ionization gamma_1 = ffhd_gamma - 1.0d0 inv_gamma_1 = 1.0d0/gamma_1 ! Determine flux variables rho_ = var_set_rho() allocate(mom(1)) mom(:) = var_set_momentum(1) ! Set index of energy variable if (ffhd_energy) then e_ = var_set_energy() p_ = e_ else e_ = -1 p_ = -1 end if ! Set index for heat flux q_ = var_set_q() need_global_cmax = .true. hypertc_kappa = 8.d-7*unit_temperature**3.5_dp/unit_length/unit_density/unit_velocity**3.0_dp ! Set index of frozen magnetic field iw_b1 = var_set_extravar('b1', 'b1') iw_b2 = var_set_extravar('b2', 'b2') iw_b3 = var_set_extravar('b3', 'b3') ! set number of variables which need update ghostcells ! The frozen field (b1,b2,b3) is registered via var_set_extravar (it is ! not advected), but it is NOT exchanged through getbc: it is a pure ! function of position, so with the FILL_NWEXTRA_ANALYTIC flag (which ! config_schema.toml's `implies` sets for phys='ffhd') fill_nwextra_device ! re-derives it from usr_set_nwextra in every cell of every block - ! interior, inter-block ghosts, physical-boundary ghosts and polar-axis ! ghosts alike - after each tree change. Keeping it out of getbc is what ! lets the polar axis work: evaluating the user's analytic field at a ghost ! cell's own (mirrored) coordinates reproduces the pole sign flips for ! free, with no entry in typeboundary. So nwgc stops at nwflux, exactly as ! for hd and mhd. nwgc=nwflux ! Define custom flux types: if (.not. allocated(flux_type)) then allocate(flux_type(ndir, nw_flux)) flux_type = flux_default else if (any(shape(flux_type) /= [ndir, nw_flux])) then call mpistop("phys_check error: flux_type has wrong shape") end if ! Only the frozen field (b1,b2,b3) is a genuine vector here: mom(1) is a ! scalar (the field-aligned momentum m_par), not 3 consecutive slots, so ! it must not be registered as one. nvector = 1 ! No. vector vars allocate(iw_vector(nvector)) iw_vector(1) = iw_b1 - 1 call radiative_cooling_init_params(phys_gamma,He_abundance) call radiative_cooling_init(rc_fl) end subroutine phys_init