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
c15bc10e
Commit
c15bc10e
authored
7 months ago
by
Evgeny Mortikov
Browse files
Options
Downloads
Patches
Plain Diff
adding configuration files support
parent
a74317ca
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
obl_def.fi
+1
-0
1 addition, 0 deletions
obl_def.fi
obl_main.f90
+94
-1
94 additions, 1 deletion
obl_main.f90
with
95 additions
and
1 deletion
obl_def.fi
+
1
−
0
View file @
c15bc10e
! obl model macro definitions
!#define OBL_EXCLUDE_NETCDF
!#define USE_CONFIG_PARSER
This diff is collapsed.
Click to expand it.
obl_main.f90
+
94
−
1
View file @
c15bc10e
#include "obl_def.fi"
program
obl_main
!< @brief main program for calculations for ocean boundary layer
#ifdef USE_CONFIG_PARSER
use
iso_c_binding
,
only
:
C_NULL_CHAR
use
config_parser
#endif
! modules used
use
obl_time_and_space
use
obl_initial_conditions
...
...
@@ -81,6 +88,20 @@ program obl_main
real
::
flux_u_surf_res
,
flux_u_bot_res
,
flux_v_surf_res
,
flux_v_bot_res
! command line arguments
! --------------------------------------------------------------------------------
integer
::
num_args
character
(
len
=
128
)
::
arg
character
(
len
=
128
),
parameter
::
arg_key_help
=
'--help'
character
(
len
=
128
),
parameter
::
arg_key_config
=
"--config"
integer
::
ierr
real
::
value
! --------------------------------------------------------------------------------
! arrays for output
real
,
allocatable
::
Theta_write
(:,:)
real
,
allocatable
::
Salin_write
(:,:)
...
...
@@ -99,8 +120,80 @@ program obl_main
closure_mode
=
4
!< 1 - pacanowski-philander, 2 - pacanowski-philander+, 3 - k-epsilon explicit, 4 - k-epsilon semiimplicit, 5 - inmom
! --- command line arguments processing
num_args
=
command_argument_count
()
do
i
=
1
,
num_args
call
get_command_argument
(
i
,
arg
)
if
(
trim
(
arg
)
==
trim
(
arg_key_help
))
then
write
(
*
,
*
)
' obl model, usage:'
write
(
*
,
*
)
' --help'
write
(
*
,
*
)
' print usage options'
write
(
*
,
*
)
' --config [filename]'
write
(
*
,
*
)
' use configuration file'
return
end
if
if
(
trim
(
arg
)
==
trim
(
arg_key_config
))
then
if
(
i
==
num_args
)
then
write
(
*
,
*
)
' FAILURE! > missing configuration file [key] argument'
ierr
=
1
! signal ERROR
return
end
if
call
get_command_argument
(
i
+
1
,
arg
)
#ifdef USE_CONFIG_PARSER
call
c_config_run
(
trim
(
arg
)//
C_NULL_CHAR
,
status
)
if
(
status
==
0
)
then
write
(
*
,
*
)
' FAILURE! > unable to parse configuration file: '
,
trim
(
arg
)
ierr
=
1
! signal ERROR
return
end
if
call
c_config_is_varname
(
"domain.depth"
//
C_NULL_CHAR
,
status
)
if
(
status
/
=
0
)
then
call
c_config_get_float
(
"domain.depth"
//
C_NULL_CHAR
,
z
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
end
if
call
c_config_is_varname
(
"grid.cz"
//
C_NULL_CHAR
,
status
)
if
(
status
/
=
0
)
then
call
c_config_get_int
(
"grid.cz"
//
C_NULL_CHAR
,
nz
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
end
if
call
c_config_is_varname
(
"time.end"
//
C_NULL_CHAR
,
status
)
if
(
status
/
=
0
)
then
call
c_config_get_float
(
"time.end"
//
C_NULL_CHAR
,
t
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
end
if
call
c_config_is_varname
(
"time.n"
//
C_NULL_CHAR
,
status
)
if
(
status
/
=
0
)
then
call
c_config_get_int
(
"time.n"
//
C_NULL_CHAR
,
nt
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
end
if
#endif
endif
enddo
#ifndef USE_CONFIG_PARSER
! set time, depth, steps and number of space
call
set_Time_Space
(
t
,
nt
,
z
,
nz
)
#endif
allocate
(
dz
(
1
:
nz
))
call
set_dz_dt
(
dz
,
dt
,
nz
,
nt
,
t
,
z
)
call
set_Time_Space_Forcing
(
nf
,
df
)
...
...
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