-
Notifications
You must be signed in to change notification settings - Fork 0
/
aconite_main.F90
67 lines (51 loc) · 1.75 KB
/
aconite_main.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
program main
use aconite_init
use aconite_io
use aconite_ecosystem
use aconite_functions
implicit none
integer :: CN_Mode
integer :: rstep
integer :: mstep
integer :: model_year
integer :: in_spinup
integer :: year_count
call initvars
call read_namelist
!read climate data
call read_climate(clim,io%clim_length)
!read parameters, site, and disturbance
if (io%param_in /= '') then
call read_parameters()
endif
if (io%site_in /= '') then
call read_site_data()
endif
!read restart
if (io%restart_in /= '') then
call read_restart()
endif
model_year = 0
do mstep = 1,(io%sim_length*365)
state%rstep = state%rstep + 1
if(state%rstep == (io%clim_length+1))then
state%rstep = 1
endif
year_count = year_count + 1
call ecosystem_dynamics(state%rstep,year_count)
if (io%day_out /= '' .AND. mstep >= (io%print_year_start*365) .AND. mstep < (io%print_year_end*365)) then
call write_daily_output(model_year,mstep)
endif
if(year_count == 365 .AND. mstep >= (io%print_year_start*365) .AND. mstep < (io%print_year_end*365)) then
call write_annual_output(state%rstep,model_year,mstep)
if(io%restart_out /= '') then
call write_restart()
endif
endif
call zero_fluxes()
if(year_count == 365) then
print *, 'model year',(mstep/365.0)
year_count = 0
endif
enddo
end program main