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

QoL: better logging for user-defined heating #143

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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