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
b2fbb696
Commit
b2fbb696
authored
6 months ago
by
Evgeny Mortikov
Browse files
Options
Downloads
Patches
Plain Diff
adding configuration files support
parent
bfdfd35a
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_config.f90
+31
-7
31 additions, 7 deletions
obl_config.f90
obl_init.f90
+72
-0
72 additions, 0 deletions
obl_init.f90
with
103 additions
and
7 deletions
obl_config.f90
+
31
−
7
View file @
b2fbb696
...
...
@@ -112,6 +112,9 @@ contains
call
set_uniform_grid
(
grid
,
-
depth
,
depth
,
cz
)
end
block
#else
!> unable to define without config
ierr
=
1
#endif
end
subroutine
set_grid
...
...
@@ -166,6 +169,9 @@ contains
end
if
end
block
#else
!> unable to define without config
ierr
=
1
#endif
end
subroutine
set_time
...
...
@@ -232,6 +238,9 @@ contains
end
if
end
block
#else
!> unable to define without config
ierr
=
1
#endif
end
subroutine
set_phys
...
...
@@ -265,9 +274,7 @@ contains
return
endif
#ifdef USE_CONFIG_PARSER
block
call
set_config_tforcing
(
tau_x_surf
,
"atm.tau_x"
,
ierr
)
if
(
ierr
/
=
0
)
return
...
...
@@ -333,7 +340,9 @@ contains
! ----------------------------------------------------------------------------
end
block
#endif
!> assuming that surface fluxes could be not set
!> *: this will use LW[in] and calculate LW[out]
!> *: probably to better set = 0 in all explicitly
end
subroutine
set_forcing
! --------------------------------------------------------------------------------
...
...
@@ -368,13 +377,28 @@ contains
return
endif
#ifdef USE_CONFIG_PARSER
block
!> just a temporaty to set smth
call
set_initial_conditions_kato
(
grid
)
call
set_config_profile
(
Theta
,
"initial_conditions.Theta"
,
grid
,
ierr
)
if
(
ierr
/
=
0
)
then
return
endif
call
set_config_profile
(
Salin
,
"initial_conditions.Salin"
,
grid
,
ierr
)
if
(
ierr
/
=
0
)
then
return
endif
call
set_config_profile
(
U
,
"initial_conditions.U"
,
grid
,
ierr
)
if
(
ierr
/
=
0
)
then
return
endif
call
set_config_profile
(
V
,
"initial_conditions.V"
,
grid
,
ierr
)
if
(
ierr
/
=
0
)
then
return
endif
end
block
#endif
end
subroutine
set_initial_conditions
end
module
obl_config
This diff is collapsed.
Click to expand it.
obl_init.f90
+
72
−
0
View file @
b2fbb696
...
...
@@ -4,6 +4,10 @@ module obl_init
! modules used
! --------------------------------------------------------------------------------
#ifdef USE_CONFIG_PARSER
use
iso_c_binding
,
only
:
C_NULL_CHAR
use
config_parser
#endif
use
obl_grid
use
obl_math
...
...
@@ -15,6 +19,7 @@ module obl_init
! public interface
! --------------------------------------------------------------------------------
public
::
set_const_profile
,
set_linear_profile
,
set_external_profile
public
::
set_config_profile
! --------------------------------------------------------------------------------
contains
...
...
@@ -111,4 +116,71 @@ module obl_init
endif
end
subroutine
! --------------------------------------------------------------------------------
subroutine
set_config_profile
(
F
,
tag
,
grid
,
ierr
)
!< @brief set constant profile
! ----------------------------------------------------------------------------
type
(
gridDataType
),
intent
(
in
)
::
grid
real
,
dimension
(
grid
%
cz
),
intent
(
out
)
::
F
integer
,
intent
(
out
)
::
ierr
character
(
len
=
*
),
intent
(
in
)
::
tag
character
,
allocatable
::
config_field
(:)
integer
::
status
real
::
Fsurf
,
Fgrad
! --------------------------------------------------------------------------------
ierr
=
0
! = OK
#ifdef USE_CONFIG_PARSER
call
c_config_get_string
(
trim
(
tag
)//
".mode"
//
C_NULL_CHAR
,
config_field
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
if
(
trim
(
char_array2str
(
config_field
))
==
'const'
)
then
call
c_config_get_float
(
trim
(
tag
)//
".surface_value"
//
C_NULL_CHAR
,
Fsurf
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
call
set_const_profile
(
F
,
Fsurf
,
grid
)
else
if
(
trim
(
char_array2str
(
config_field
))
==
'linear'
)
then
call
c_config_get_float
(
trim
(
tag
)//
".surface_value"
//
C_NULL_CHAR
,
Fsurf
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
call
c_config_get_float
(
trim
(
tag
)//
".grad_z"
//
C_NULL_CHAR
,
Fgrad
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
call
set_linear_profile
(
F
,
Fsurf
,
Fgrad
,
grid
)
else
if
(
trim
(
char_array2str
(
config_field
))
==
'ascii'
)
then
call
c_config_get_string
(
trim
(
tag
)//
".filename"
//
C_NULL_CHAR
,
config_field
,
status
)
if
(
status
==
0
)
then
ierr
=
1
! signal ERROR
return
end
if
call
set_external_profile
(
F
,
char_array2str
(
config_field
),
grid
)
else
write
(
*
,
*
)
' FAILURE! > unknown initial conditions mode: '
,
trim
(
char_array2str
(
config_field
))
ierr
=
1
! signal ERROR
return
endif
#else
!> unable to define without config
ierr
=
1
#endif
end
subroutine
end
module
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