-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ports of craterproduction.py functions to convert to true age internally
- Loading branch information
Austin Blevins
committed
Jul 19, 2023
1 parent
87dd833
commit aa92e35
Showing
7 changed files
with
183 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| !********************************************************************************************************************************** | ||
| ! | ||
| ! Unit Name : util_npf_timefunc | ||
| ! Unit Type : subroutine | ||
| ! Project : CTEM | ||
| ! Language : Fortran 2003 | ||
| ! | ||
| ! Description : The time function of the lunar Neukum production function (Neukum et al., 2001) | ||
| ! | ||
| ! Input | ||
| ! Arguments : | ||
| ! | ||
| ! Output | ||
| ! Arguments : | ||
| ! | ||
| ! | ||
| ! Notes : | ||
| ! | ||
| !********************************************************************************************************************************** | ||
| function util_npf_timefunc(T) result(N1) | ||
| use module_globals | ||
| use module_util, EXCEPT_THIS_ONE => util_npf_timefunc | ||
| real(DP), intent(in) :: T | ||
| real(DP) :: N1 | ||
|
|
||
| N1 = 5.44e-14 * (exp(6.93*T)-1) + 8.17e-4*T | ||
| end function util_npf_timefunc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| !********************************************************************************************************************************** | ||
| ! | ||
| ! Unit Name : util_t_from_scale | ||
| ! Unit Type : subroutine | ||
| ! Project : CTEM | ||
| ! Language : Fortran 2003 | ||
| ! | ||
| ! Description : converts age from "interval time" to true time in Ga based on the lunar Neukum production function (Neukum et al., 2001) | ||
| ! | ||
| ! Input | ||
| ! Arguments : | ||
| ! | ||
| ! Output | ||
| ! Arguments : | ||
| ! | ||
| ! | ||
| ! Notes : This is a Fortran port of the function "T_from_scale" from craterproduction.py. It uses the bisect method so is simple but inefficient. | ||
| ! | ||
| !********************************************************************************************************************************** | ||
| function util_t_from_scale(scale,start,finish) result(time) | ||
| use module_globals | ||
| use module_util, EXCEPT_THIS_ONE => util_t_from_scale | ||
| real(DP), intent(in) :: scale, start, finish | ||
| real(DP) :: time | ||
|
|
||
| real(DP) :: tol = 1e-11_DP | ||
| integer(I4B) :: maxiter = 1000 | ||
| integer(I4B) :: i | ||
| real(DP) :: a, b, c | ||
|
|
||
|
|
||
| a = start | ||
| b = finish | ||
| time = -1. | ||
| i = 0 | ||
| temp = 0._DP | ||
|
|
||
| if (abs(temp-scale)<tol) then | ||
| ans = 0.0_DP | ||
| else | ||
| do while(i .lt. maxiter) | ||
| c = (a+b)/2 | ||
| temp = util_tscale(c) | ||
|
|
||
| if (abs(temp-scale)<tol) then | ||
| time = c | ||
| exit | ||
| else if ((temp-scale)>0) then | ||
| b = c | ||
| i = i + 1 | ||
| else if ((temp-scale)<0) then | ||
| a = c | ||
| i = i + 1 | ||
| else if (abs(a-b)<tol) then | ||
| write(*,*) "ERROR in util_t_from_scale: Convergence failed!" | ||
| write(*,*) scale, start, finish | ||
| exit | ||
| end if | ||
| end do | ||
| end if | ||
|
|
||
| if (ans .lt. 0) then | ||
| write(*,*) "ERROR in util_t_from_scale: Maximum iterations reached!" | ||
| write(*,*) scale, maxiter | ||
| end if | ||
| end function util_t_from_scale | ||
|
|
||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| !********************************************************************************************************************************** | ||
| ! | ||
| ! Unit Name : util_tscale | ||
| ! Unit Type : subroutine | ||
| ! Project : CTEM | ||
| ! Language : Fortran 2003 | ||
| ! | ||
| ! Description : converts age from true time in Ga to "interval time" based on the lunar Neukum production function (Neukum et al., 2001) | ||
| ! | ||
| ! Input | ||
| ! Arguments : | ||
| ! | ||
| ! Output | ||
| ! Arguments : | ||
| ! | ||
| ! | ||
| ! Notes : This is a Fortran port of the function "T_scale" from craterproduction.py | ||
| ! | ||
| !********************************************************************************************************************************** | ||
| function util_tscale(t) result(tscale) | ||
| use module_globals | ||
| use module_util, EXCEPT_THIS_ONE => util_tscale | ||
| real(DP), intent(in) :: t | ||
| real(DP) :: tscale | ||
|
|
||
| real(DP) :: N1 | ||
| real(DP) :: CSFD = 0.0008173348179780709 !this is the result of the shape function at T=1 Ga for the lunar NPF | ||
|
|
||
| N1 = util_npf_timefunc(t) | ||
|
|
||
| tscale = N1 / CSFD | ||
| end function util_tscale | ||
|
|
||
|
|
||
|
|