Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ocean-mixing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
inmcm-mirror
ocean-mixing
Commits
083f3a52
Commit
083f3a52
authored
6 months ago
by
Evgeny Mortikov
Browse files
Options
Downloads
Patches
Plain Diff
adding common module
parent
727005a6
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-0
1 addition, 0 deletions
CMakeLists.txt
obl_common.f90
+52
-0
52 additions, 0 deletions
obl_common.f90
obl_math.f90
+21
-27
21 additions, 27 deletions
obl_math.f90
obl_tforcing.f90
+1
-1
1 addition, 1 deletion
obl_tforcing.f90
with
75 additions
and
28 deletions
CMakeLists.txt
+
1
−
0
View file @
083f3a52
...
...
@@ -31,6 +31,7 @@ endif(BUILD_DOC)
set
(
CMAKE_Fortran_MODULE_DIRECTORY
${
CMAKE_BINARY_DIR
}
/modules/
)
set
(
SOURCES
obl_common.f90
obl_grid.f90
obl_tslice.f90
obl_tseries.f90
...
...
This diff is collapsed.
Click to expand it.
obl_common.f90
0 → 100644
+
52
−
0
View file @
083f3a52
!> @brief ocean boundary layer model common subroutines
module
obl_common
public
contains
!> @brief string to int conversion
elemental
subroutine
str2int
(
int
,
str
,
stat
)
! ----------------------------------------------------------------------------
implicit
none
integer
,
intent
(
out
)
::
int
integer
,
intent
(
out
)
::
stat
!> output status, /= 0 signals ERROR
character
(
len
=
*
),
intent
(
in
)
::
str
! ----------------------------------------------------------------------------
read
(
str
,
*
,
iostat
=
stat
)
int
end
subroutine
str2int
! ----------------------------------------------------------------------------
!> @brief string to real conversion
elemental
subroutine
str2real
(
x
,
str
,
stat
)
! ----------------------------------------------------------------------------
implicit
none
real
,
intent
(
out
)
::
x
integer
,
intent
(
out
)
::
stat
!> output status, /= 0 signals ERROR
character
(
len
=
*
),
intent
(
in
)
::
str
! ----------------------------------------------------------------------------
read
(
str
,
*
,
iostat
=
stat
)
x
end
subroutine
str2real
! ----------------------------------------------------------------------------
!> @brief character array to string conversion
function
char_array2str
(
char_array
)
result
(
str
)
! ----------------------------------------------------------------------------
implicit
none
character
,
intent
(
in
)
::
char_array
(:)
character
(
len
=
:),
allocatable
::
str
integer
::
i
! ----------------------------------------------------------------------------
str
=
""
do
i
=
1
,
size
(
char_array
)
str
=
str
(:)
//
char_array
(
i
)
end
do
end
function
! ----------------------------------------------------------------------------
end
module
obl_common
This diff is collapsed.
Click to expand it.
obl_math.f90
+
21
−
27
View file @
083f3a52
...
...
@@ -18,8 +18,7 @@ module obl_math
public
::
c_interp_linear
public
::
limit_min_array
,
limit_max_array
public
::
tma
public
::
is_finite
public
::
char_array2str
public
::
is_finite
,
is_finite_array
! --------------------------------------------------------------------------------
...
...
@@ -127,42 +126,37 @@ module obl_math
end
subroutine
tma
! --------------------------------------------------------------------------------
function
is_finite
(
F
,
n
)
!> @brief check if
any
value
in array
is finite
elemental
function
is_finite
(
value
)
!> @brief check if value is finite
! ----------------------------------------------------------------------------
use
ieee_arithmetic
implicit
none
logical
::
is_finite
integer
,
intent
(
in
)
::
n
real
,
intent
(
in
),
dimension
(
n
)
::
F
integer
::
k
real
,
intent
(
in
)
::
value
! ----------------------------------------------------------------------------
is_finite
=
.true.
do
k
=
1
,
n
is_finite
=
ieee_is_finite
(
F
(
k
))
if
(
is_finite
.eqv.
.false.
)
exit
enddo
is_finite
=
ieee_is_finite
(
value
)
end
function
is_finite
!> @brief character array to string conversion
function
char_array2str
(
char_array
)
result
(
str
)
function
is_finite_array
(
F
,
n
)
!> @brief check if any value in array is finite
! ----------------------------------------------------------------------------
use
ieee_arithmetic
implicit
none
character
,
intent
(
in
)
::
char_array
(:)
character
(
len
=
:),
allocatable
::
str
integer
::
i
! ----------------------------------------------------------------------------
logical
::
is_finite_array
str
=
""
do
i
=
1
,
size
(
char_array
)
str
=
str
(:)
//
char_array
(
i
)
end
do
integer
,
intent
(
in
)
::
n
real
,
intent
(
in
),
dimension
(
n
)
::
F
end
function
integer
::
k
! ----------------------------------------------------------------------------
is_finite_array
=
.true.
do
k
=
1
,
n
is_finite_array
=
ieee_is_finite
(
F
(
k
))
if
(
.not.
is_finite_array
)
exit
enddo
end
function
is_finite_array
end
module
This diff is collapsed.
Click to expand it.
obl_tforcing.f90
+
1
−
1
View file @
083f3a52
...
...
@@ -136,7 +136,7 @@ module obl_tforcing
subroutine
set_config_tforcing
(
tforcing
,
tag
,
ierr
)
!> @brief generic forcing setup
! ----------------------------------------------------------------------------
use
obl_
math
,
only
:
char_array2str
use
obl_
common
,
only
:
char_array2str
type
(
timeForcingDataType
),
intent
(
inout
)
::
tforcing
integer
,
intent
(
out
)
::
ierr
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment