forked from GomezGroup/1DSeaLevelModel_FWTW
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsl_model_driver.f90
52 lines (42 loc) · 1.41 KB
/
sl_model_driver.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
program sl_model_driver
use sl_model_mod
use sl_io_mod
use user_specs_mod
implicit none
integer :: i, itersl, iter, dtime
real :: starttime ! Start time of the simulation
integer :: iargc, nargs ! Arguments read in from a bash script
character(16) :: carg(20) ! Arguments from a bash script
nargs = iargc()
do i=1,nargs
call getarg(i, carg(i))
enddo
if (nargs == 4) then ! Check if namelist file is provided
read (carg(1),*) itersl
read (carg(2),*) iter ! the coupling time step we are on (in years)
read (carg(3),*) dtime ! coupling time (in years)
read (carg(4),*) starttime ! start time of the simulation (in years)
elseif (nargs == 5) then
call sl_drive_readnl(itersl, dtime, starttime)
read (carg(2),*) iter
call sl_call_readnl
else
write(6,*) 'The number of arguments need to be either 4 or 5'
write(6,*) 'Terminating: program sl_model'
stop
endif
! check point for time array and coupling
call sl_solver_checkpoint(itersl, dtime)
! set up the temporal resolution
call sl_timewindow(iter)
! initialize arrays
call sl_allocate_and_initialize_array
! intialize and execute the sea-level solver
if (iter .eq. 0) then
call sl_solver_init(itersl, starttime)
elseif (iter .gt. 0) then
call sl_solver(itersl, iter, dtime, starttime)
endif
! deallocate arrays
call sl_deallocate_array
end program sl_model_driver