forked from wardvp/EBFM-glacier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMAIN.m
40 lines (31 loc) · 1.48 KB
/
MAIN.m
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% SURFACE ENERGY BALANCE - SNOW & FIRN MODEL
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Model setup & initialization
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[grid,time,io,phys] = INIT_parameters();
[C] = INIT_constants();
[grid] = INIT_grid(grid,io);
[OUT,IN,OUTFILE] = INIT_variables(C,grid,io);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Time-loop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for t=1:time.tn
% Print time to screen
[time] = TIME_print_time(t,time);
% Read and prepare climate input
[IN,OUT] = TIME_climate_forcing(C,grid,IN,t,time,OUT,io);
% Surface energy balance model
[OUT] = TIME_energy_balance_model(C,OUT,IN,time,grid);
% Snow & firn model
[OUT] = TIME_snow_model(C,OUT,IN,time.dt,grid,phys);
% Mass balance
[OUT] = TIME_mass_balance(OUT,IN,C);
% Write output to files
[io,OUTFILE] = TIME_write_to_file(OUTFILE,io,OUT,grid,t,time,C);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Save restart-file at end run
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FINAL_create_boot_file(OUT,io);