Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libmtime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
icon-libraries
libmtime
Commits
67b1f786
Commit
67b1f786
authored
11 years ago
by
Luis Kornblueh
Browse files
Options
Downloads
Patches
Plain Diff
Next step of iconatm finished.
parent
a6940dc7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
test/iconatm.f90
+134
-52
134 additions, 52 deletions
test/iconatm.f90
test/iconatm.nml
+23
-0
23 additions, 0 deletions
test/iconatm.nml
with
158 additions
and
52 deletions
.gitignore
+
1
−
0
View file @
67b1f786
...
...
@@ -26,3 +26,4 @@ test/iconatm
test/iconoce
test/output_control
test/recurrence
test/repetitor
This diff is collapsed.
Click to expand it.
test/iconatm.f90
+
134
−
52
View file @
67b1f786
program
iconatm
use
mtime
implicit
none
character
(
len
=
max_calendar_str_len
)
::
calendar_in_use
character
(
len
=
max_datetime_str_len
)
::
dstring
character
(
len
=
max_timedelta_str_len
)
::
tdstring
type
(
datetime
),
pointer
::
experiment_start_date
=>
null
()
type
(
datetime
),
pointer
::
experiment_
stop
_date
=>
null
()
type
(
datetime
),
pointer
::
experiment_
end
_date
=>
null
()
type
(
datetime
),
pointer
::
start_date
=>
null
()
type
(
datetime
),
pointer
::
stop_date
=>
null
()
...
...
@@ -30,65 +27,130 @@ program iconatm
type
(
timedelta
),
pointer
::
model_time_step
=>
null
()
type
(
datetime
),
pointer
::
current_date
=>
null
()
! setup of calendar
call
setCalendar
(
year_of_365_days
)
! proleptic_gregorian/year_of_365_days/year_of_360_days.
character
(
len
=
max_calendar_str_len
)
::
calendar_in_use
character
(
len
=
max_datetime_str_len
)
::
dstring
character
(
len
=
max_timedelta_str_len
)
::
tdstring
! namelist variables
character
(
len
=
max_calendar_str_len
)
::
calendar
character
(
len
=
max_datetime_str_len
)
::
experimentStartDate
character
(
len
=
max_datetime_str_len
)
::
experimentEndDate
character
(
len
=
max_timedelta_str_len
)
::
modelTimeStep
character
(
len
=
max_repetition_str_len
)
::
advectionTimeInterval
character
(
len
=
max_repetition_str_len
)
::
radiationTimeInterval
character
(
len
=
max_repetition_str_len
)
::
convectionTimeInterval
character
(
len
=
max_repetition_str_len
)
::
cloudTimeInterval
character
(
len
=
max_repetition_str_len
)
::
ssoTimeInterval
character
(
len
=
max_repetition_str_len
)
::
gwdragTimeInterval
character
(
len
=
max_repetition_str_len
)
::
checkpointTimeInterval
character
(
len
=
max_repetition_str_len
)
::
restartTimeInterval
character
(
len
=
max_repetition_str_len
)
::
couplingTimeInterval
character
(
len
=
132
)
::
error_message
namelist
/
timeControl
/
&
&
calendar
,
&
&
experimentStartDate
,
&
&
experimentEndDate
,
&
&
modelTimeStep
,
&
&
advectionTimeInterval
,
&
&
radiationTimeInterval
,
&
&
convectionTimeInterval
,
&
&
cloudTimeInterval
,
&
&
ssoTimeInterval
,
&
&
gwdragTimeInterval
,
&
&
checkpointTimeInterval
,
&
&
restartTimeInterval
,
&
&
couplingTimeInterval
integer
::
iunit
,
icalendar
,
ierror
open
(
file
=
'test/iconatm.nml'
,
newunit
=
iunit
,
iostat
=
ierror
)
if
(
ierror
/
=
0
)
then
print
*
,
'ERROR: could not open namelist file.'
stop
else
read
(
unit
=
iunit
,
nml
=
timeControl
,
iostat
=
ierror
,
iomsg
=
error_message
)
if
(
ierror
/
=
0
)
then
print
*
,
'ERROR: could not read namelist file.'
print
*
,
' '
,
trim
(
error_message
)
stop
endif
close
(
unit
=
iunit
)
endif
select
case
(
toLower
(
calendar
))
case
(
'proleptic gregorian'
)
icalendar
=
proleptic_gregorian
case
(
'365 day year'
)
icalendar
=
year_of_365_days
case
(
'360 day year'
)
icalendar
=
year_of_360_days
case
default
icalendar
=
calendar_not_set
print
*
,
'ERROR: calendar '
,
trim
(
calendar
),
' not available.'
stop
end
select
call
setCalendar
(
icalendar
)
call
calendarToString
(
calendar_in_use
)
print
*
,
'Calendar: '
,
TRIM
(
calendar_in_use
)
! set defaults for dates
start_date
=>
newDatetime
(
'1978-01-01'
)
call
datetimeToString
(
start_date
,
dstring
)
print
*
,
'Start date: '
,
trim
(
dstring
)
print
*
,
'Calendar: '
,
trim
(
calendar_in_use
)
experiment_start_date
=>
newDatetime
(
experimentStartDate
)
call
datetimeToString
(
experiment_start_date
,
dstring
)
print
*
,
'Experiment start date: '
,
dstring
experiment_end_date
=>
newDatetime
(
experimentEndDate
)
call
datetimeToString
(
experiment_end_date
,
dstring
)
print
*
,
'Experiment end date : '
,
dstring
model_time_step
=>
newTimedelta
(
modelTimeStep
)
call
timedeltaToString
(
model_time_step
,
tdstring
)
print
*
,
'Dynamics time step: '
,
trim
(
tdstring
)
stop_date
=>
newDatetime
(
'2008-01-01'
)
call
datetimeToString
(
stop_date
,
dstring
)
print
*
,
'Stop date : '
,
trim
(
dstring
)
physics_time_intervals
:
block
experiment_start_date
=
start_date
call
datetimeToString
(
experiment_start_date
,
dstring
)
print
*
,
'Experiment start date: '
,
trim
(
dstring
)
character
(
len
=
max_repetition_str_len
)
::
r
,
s
,
e
,
d
logical
::
lr
,
ls
,
le
,
ld
experiment_stop_date
=
stop_date
call
datetimeToString
(
experiment_stop_date
,
dstring
)
print
*
,
'Experiment stop date : '
,
trim
(
dstring
)
call
splitRepetitionString
(
advectionTimeInterval
,
&
&
r
,
s
,
e
,
d
,
lr
,
ls
,
le
,
ld
)
dynamic_time_step
=>
newTimedelta
(
'PT120S'
)
call
timedeltaToString
(
dynamic_time_step
,
tdstring
)
print
*
,
'Dynamics tim step: '
,
trim
(
tdstring
)
if
(
lr
)
then
if
(
getRepetitions
(
r
)
/
=
-1
)
then
print
*
,
'WARNING: event setup should not have explicit repeat count.'
endif
endif
advection_time_step
=>
newTimedelta
(
'PT600S'
)
if
(
ls
)
then
print
*
,
'WARNING: event setup should not have explicit start date.'
endif
radiation_time_step
=>
newTimedelta
(
'PT1800S'
)
convection_time_step
=>
newTimedelta
(
'PT600S'
)
cloud_cover_time_step
=>
newTimedelta
(
'PT600S'
)
sso_time_step
=>
newTimedelta
(
'PT1200S'
)
gwdrag_time_step
=>
newTimedelta
(
'PT1200S'
)
if
(
le
)
then
print
*
,
'WARNING: event setup should not have explicit end date.'
endif
checkpoint_time_step
=>
newTimedelta
(
'PT86400S'
)
restart_time_step
=>
newTimedelta
(
'P1M'
)
if
(
ld
)
then
advection_time_step
=>
newTimeDelta
(
d
)
call
timedeltaToString
(
advection_time_step
,
tdstring
)
print
*
,
'Advection time interval: '
,
trim
(
tdstring
)
endif
coupling_time_step
=>
newTimedelta
(
'PT21600S'
)
model_time_step
=>
newTimedelta
(
'PT600S'
)
end
block
physics_time_intervals
! time_step => newTimedelta('PT12H')
! call timedeltaToString(time_step, time_step_string)
! print *, 'Model time step : ', trim(time_step_string)
current_date
=>
newDatetime
(
experiment_start_date
)
! current_date => newDatetime('2012-09-01T02:10:00.000')
! ! copy operator - overload newDatetime using construct and copy!
! ! current_date = start_date
! call datetimeToString(current_date, current_date_string)
! print *, 'Model time : ', trim(current_date_string)
! time_integration: do
! current_date = current_date + time_step
! call datetimeToString(current_date, current_date_string)
! print *, 'Model time loop : ', trim(current_date_string)
! if (current_date >= stop_date) exit time_integration
! enddo time_integration
time_integration
:
do
current_date
=
current_date
+
model_time_step
call
datetimeToString
(
current_date
,
dstring
)
print
*
,
'Model time loop : '
,
trim
(
dstring
)
if
(
current_date
>=
experiment_end_date
)
exit
time_integration
enddo
time_integration
! call datetimeToString(current_date, current_date_string)
! print *, 'Model stop time : ', trim(current_date_string)
...
...
@@ -181,4 +243,24 @@ program iconatm
! end subroutine event_tests
contains
pure
function
toLower
(
str
)
result
(
string
)
character
(
*
),
intent
(
in
)
::
str
character
(
len
(
str
))
::
string
integer
::
ic
,
i
character
(
len
=
26
),
parameter
::
capitel
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
character
(
len
=
26
),
parameter
::
lower
=
'abcdefghijklmnopqrstuvwxyz'
string
=
str
do
i
=
1
,
LEN_TRIM
(
str
)
ic
=
INDEX
(
capitel
,
str
(
i
:
i
))
if
(
ic
>
0
)
string
(
i
:
i
)
=
lower
(
ic
:
ic
)
end
do
end
function
toLower
end
program
iconatm
This diff is collapsed.
Click to expand it.
test/iconatm.nml
0 → 100644
+
23
−
0
View file @
67b1f786
&timeControl
calendar = 'proleptic Gregorian'
experimentStartDate = '2000-01-01T00:00:00'
experimentEndDate = '2000-01-02T00:00:00'
modelTimeStep = 'PT2M'
advectionTimeInterval = 'R/PT12M'
radiationTimeInterval = 'R/PT1H'
convectionTimeInterval = 'R/PT12M'
cloudTimeInterval = 'R/PT12M'
ssoTimeInterval = 'R/PT12M'
gwdragTimeInterval = 'R/PT12M'
checkpointTimeInterval = 'R/P5D'
restartTimeInterval = 'R/P1M'
couplingTimeInterval = 'R/PT2H'
/
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