Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for 1D models + thermal conduction in hydro #125

Merged
merged 12 commits into from
Mar 29, 2023
Merged
Prev Previous commit
Next Next commit
initial support for non-constant heating in settings
  • Loading branch information
n-claes committed Mar 8, 2023
commit 25c9478d4cd4fdc05a92be07ef137ed12977b49e
1 change: 1 addition & 0 deletions post_processing/pylbo/automation/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
("dropoff_width", (int, np.integer, float)),
("flow", bool),
("radiative_cooling", bool),
("heating", bool),
("ncool", (int, np.integer)),
("cooling_curve", str),
("external_gravity", bool),
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set (sources
dataIO/mod_console.f08
settings/physics/mod_flow_settings.f08
settings/physics/mod_cooling_settings.f08
settings/physics/mod_heating_settings.f08
settings/physics/mod_gravity_settings.f08
settings/physics/mod_resistivity_settings.f08
settings/physics/mod_viscosity_settings.f08
Expand Down
6 changes: 4 additions & 2 deletions src/dataIO/mod_input.f08
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ subroutine read_physicslist(unit, settings)
character(str_len) :: iomsg

character(len=str_len) :: physics_type
logical :: flow, incompressible, radiative_cooling, external_gravity, &
logical :: flow, incompressible, radiative_cooling, heating, external_gravity, &
parallel_conduction, perpendicular_conduction, resistivity, use_eta_dropoff, &
viscosity, viscous_heating, hall_mhd, hall_dropoff, &
elec_inertia, inertia_dropoff
Expand All @@ -201,7 +201,7 @@ subroutine read_physicslist(unit, settings)
real(dp) :: dropoff_edge_dist, dropoff_width

namelist /physicslist/ &
physics_type, mhd_gamma, flow, incompressible, radiative_cooling, &
physics_type, mhd_gamma, flow, incompressible, radiative_cooling, heating, &
external_gravity, parallel_conduction, perpendicular_conduction, &
resistivity, use_eta_dropoff, viscosity, viscous_heating, hall_mhd, &
hall_dropoff, elec_inertia, inertia_dropoff, ncool, &
Expand All @@ -219,6 +219,7 @@ subroutine read_physicslist(unit, settings)
flow = settings%physics%flow%is_enabled()

radiative_cooling = settings%physics%cooling%is_enabled()
heating = settings%physics%heating%is_enabled()
ncool = settings%physics%cooling%get_interpolation_points()
cooling_curve = settings%physics%cooling%get_cooling_curve()

Expand Down Expand Up @@ -253,6 +254,7 @@ subroutine read_physicslist(unit, settings)
if (incompressible) call settings%physics%set_incompressible()
if (flow) call settings%physics%flow%enable()
if (radiative_cooling) call settings%physics%enable_cooling(cooling_curve, ncool)
if (heating) call settings%physics%enable_heating()
if (external_gravity) call settings%physics%enable_gravity()
if (parallel_conduction) then
call settings%physics%enable_parallel_conduction(fixed_tc_para_value)
Expand Down
9 changes: 9 additions & 0 deletions src/settings/mod_physics_settings.f08
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module mod_physics_settings
use mod_check_values, only: is_zero
use mod_flow_settings, only: flow_settings_t, new_flow_settings
use mod_cooling_settings, only: cooling_settings_t, new_cooling_settings
use mod_heating_settings, only: heating_settings_t, new_heating_settings
use mod_gravity_settings, only: gravity_settings_t, new_gravity_settings
use mod_resistivity_settings, only: resistivity_settings_t, new_resistivity_settings
use mod_viscosity_settings, only: viscosity_settings_t, new_viscosity_settings
Expand All @@ -19,6 +20,7 @@ module mod_physics_settings
real(dp) :: dropoff_width
type(flow_settings_t) :: flow
type(cooling_settings_t) :: cooling
type(heating_settings_t) :: heating
type(gravity_settings_t) :: gravity
type(resistivity_settings_t) :: resistivity
type(viscosity_settings_t) :: viscosity
Expand All @@ -34,6 +36,7 @@ module mod_physics_settings

procedure, public :: enable_flow
procedure, public :: enable_cooling
procedure, public :: enable_heating
procedure, public :: enable_gravity
procedure, public :: enable_resistivity
procedure, public :: enable_viscosity
Expand Down Expand Up @@ -109,6 +112,12 @@ pure subroutine enable_cooling(this, cooling_curve, interpolation_points)
end subroutine enable_cooling


pure subroutine enable_heating(this)
class(physics_t), intent(inout) :: this
call this%heating%enable()
end subroutine enable_heating


pure subroutine enable_gravity(this)
class(physics_t), intent(inout) :: this
call this%gravity%enable()
Expand Down
45 changes: 45 additions & 0 deletions src/settings/physics/mod_heating_settings.f08
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module mod_heating_settings
implicit none

private

type, public :: heating_settings_t
logical, private :: has_heating
logical :: ensure_equilibrium

contains

procedure, public :: enable
procedure, public :: disable
procedure, public :: is_enabled
end type heating_settings_t

public :: new_heating_settings

contains

pure function new_heating_settings() result(heating)
type(heating_settings_t) :: heating
heating%has_heating = .false.
heating%ensure_equilibrium = .true.
end function new_heating_settings


pure logical function is_enabled(this)
class(heating_settings_t), intent(in) :: this
is_enabled = this%has_heating
end function is_enabled


pure subroutine enable(this)
class(heating_settings_t), intent(inout) :: this
this%has_heating = .true.
end subroutine enable


pure subroutine disable(this)
class(heating_settings_t), intent(inout) :: this
this%has_heating = .false.
end subroutine disable

end module mod_heating_settings