-
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.
Merge pull request #30 from matt-frey/ape-calculation
APE calculation
- Loading branch information
Showing
7 changed files
with
90 additions
and
62 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
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,29 @@ | ||
module ape_density | ||
use constants | ||
implicit none | ||
|
||
public :: ape_den | ||
|
||
contains | ||
|
||
elemental function ape_den(b, z) result(a) | ||
double precision, intent(in) :: b ! buoyancy value | ||
double precision, intent(in) :: z ! height | ||
double precision :: a ! APE density | ||
double precision :: br | ||
|
||
#ifdef ENABLE_IW_TEST_CASE | ||
a = f18 * (b - four * z) ** 2 | ||
#elif ENABLE_RT_TEST_CASE | ||
br = max(b, -one) | ||
br = min(br, one) | ||
a = br * dasin(br) + dsqrt(one - br ** 2) - z * br - dcos(z) | ||
#else | ||
! dummy line to avoid compiler warning of 'unused variables' | ||
a = b + z | ||
|
||
a = zero | ||
#endif | ||
end function ape_den | ||
|
||
end module ape_density |