Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into debug
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 23, 2023
2 parents 19df565 + b55d703 commit 90009c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmake/Modules/SetFortranFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}"
#####################

# Optimizations
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_TESTING "${CMAKE_Fortran_FLAGS_TESTING}"
Fortran REQUIRED "-O2" # All compilers not on Windows
"/O2" # Intel Windows
SET_COMPILE_FLAG(CMAKE_Fortran_FLAGS_TESTING "${CMAKE_Fortran_FLAGS_DEBUG}"
Fortran REQUIRED "-O3" # All compilers not on Windows
"/O3" # Intel Windows
)

#####################
Expand Down
11 changes: 9 additions & 2 deletions src/fraggle/fraggle_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module subroutine fraggle_util_set_mass_dist(self, param)
!! Sets the mass of fragments based on the mass distribution returned by the regime calculation.
!! This subroutine must be run after the the setup routine has been run on the fragments
!!
use, intrinsic :: ieee_exceptions
implicit none
! Arguments
class(collision_fraggle), intent(inout) :: self !! Fraggle collision system object
Expand All @@ -101,6 +102,10 @@ module subroutine fraggle_util_set_mass_dist(self, param)
integer(I4B), dimension(:), allocatable :: ind
integer(I4B), parameter :: MAXLOOP = 20
logical :: flipper
logical, dimension(size(IEEE_ALL)) :: fpe_halting_modes

call ieee_get_halting_mode(IEEE_ALL,fpe_halting_modes) ! Save the current halting modes so we can turn them off temporarily
call ieee_set_halting_mode(IEEE_ALL,.false.)

associate(impactors => self%impactors, min_mfrag => self%min_mfrag)
! Get mass weighted mean of Ip and density
Expand Down Expand Up @@ -146,6 +151,7 @@ module subroutine fraggle_util_set_mass_dist(self, param)
fragments%density(1) = impactors%mass_dist(1) / volume(jtarg)
if (param%lrotation) fragments%Ip(:, 1) = impactors%Ip(:,1)
end associate
call ieee_set_halting_mode(IEEE_ALL,fpe_halting_modes)
return
case default
write(*,*) "fraggle_util_set_mass_dist_fragments error: Unrecognized regime code",impactors%regime
Expand Down Expand Up @@ -176,8 +182,8 @@ module subroutine fraggle_util_set_mass_dist(self, param)
y1 = y1 - (i-1)**(-x1/3.0_DP)
end do
if (y0*y1 < 0.0_DP) exit
x1 = x1 * 1.6_DP
x0 = x0 / 1.6_DP
x1 = x1 * 1.1_DP
x0 = x0 * 1.1_DP
end do

! Find the mass scaling factor with bisection
Expand Down Expand Up @@ -276,6 +282,7 @@ module subroutine fraggle_util_set_mass_dist(self, param)

end associate

call ieee_set_halting_mode(IEEE_ALL,fpe_halting_modes)
return
end subroutine fraggle_util_set_mass_dist

Expand Down

0 comments on commit 90009c7

Please sign in to comment.