Skip to content

Commit

Permalink
Merge pull request #143 from n-claes/qol/usr_H_warning
Browse files Browse the repository at this point in the history
QoL: better logging for user-defined heating
  • Loading branch information
n-claes authored May 23, 2023
2 parents 71f15ec + 0c3cb73 commit 2a94ba9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/mod_equilibrium.f08
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,6 @@ subroutine set_equilibrium(settings, grid, background, physics)
if (settings%physics%cooling%is_enabled()) then
call physics%heatloss%cooling%initialise()
end if
call physics%heatloss%check_if_thermal_balance_needs_enforcing( &
physics%conduction, grid &
)
call physics%hall%validate_scale_ratio(grid%gaussian_grid)
end subroutine set_equilibrium

Expand Down
5 changes: 4 additions & 1 deletion src/mod_inspections.f08
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ subroutine do_equilibrium_inspections(settings, grid, background, physics)
type(settings_t), intent(in) :: settings
type(grid_t), intent(in) :: grid
type(background_t), intent(in) :: background
type(physics_t), intent(in) :: physics
type(physics_t), intent(inout) :: physics

call physics%heatloss%check_if_thermal_balance_needs_enforcing( &
physics%conduction, grid &
)
if (nan_values_present(background, physics, grid)) return
if (negative_values_present(background, grid)) return
if (.not. wave_numbers_are_valid(geometry=settings%grid%get_geometry())) return
Expand Down
2 changes: 1 addition & 1 deletion src/mod_version.f08
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module mod_version
implicit none

!> legolas version number
character(len=10), parameter :: LEGOLAS_VERSION = "2.0.2"
character(len=10), parameter :: LEGOLAS_VERSION = "2.0.3"

end module mod_version
19 changes: 19 additions & 0 deletions src/physics/mod_heatloss.f08
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ end subroutine set_module_pointers


subroutine check_if_thermal_balance_needs_enforcing(this, conduction_tgt, grid_tgt)
use mod_function_utils, only: zero_func

class(heatloss_t), intent(inout) :: this
type(conduction_t), intent(in) :: conduction_tgt
type(grid_t), intent(in) :: grid_tgt

if (.not. settings%physics%heating%is_enabled()) return
if (.not. settings%physics%heating%force_thermal_balance) return

if (.not. associated(this%heating%H, zero_func)) call log_usr_H_func_warning()

call set_module_pointers(conduction_tgt, grid_tgt, this%cooling)
call logger%info("enforcing thermal balance by setting a constant heating term")
this%heating%H => H_for_thermal_balance
Expand Down Expand Up @@ -126,6 +130,21 @@ real(dp) function H_for_thermal_balance(x)
end function H_for_thermal_balance


subroutine log_usr_H_func_warning() ! LCOV_EXCL_START
call logger%warning( &
"found user-defined heating function but forced thermal balance enabled!" &
)
call logger%disable_prefix()
call logger%warning( &
"The provided function will be ignored and thermal balance will be enforced." &
)
call logger%warning( &
"To disable this behaviour, set force_thermal_balance = .false. in the parfile" &
)
call logger%enable_prefix()
end subroutine log_usr_H_func_warning ! LCOV_EXCL_STOP


subroutine delete(this)
class(heatloss_t), intent(inout) :: this
nullify(settings)
Expand Down

0 comments on commit 2a94ba9

Please sign in to comment.