Skip to content
Snippets Groups Projects
Commit 079ccc28 authored by JakobDeutloff's avatar JakobDeutloff
Browse files

Documentation updated and os part added to other plotscripts

parent f675f468
No related branches found
No related tags found
No related merge requests found
......@@ -30,9 +30,15 @@ levelsbrine = ([400,2000])
import numpy
import matplotlib.pyplot as plt
from matplotlib import rc
import os
rc('font', size='10')
rc('font', family='serif')
# set wd to the directory of the script
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
#Loading data
bgc_br = numpy.loadtxt("../../../output/dat_bgc"+tracernumber+".br.dat")
bgc_bu = numpy.loadtxt("../../../output/dat_bgc"+tracernumber+".bu.dat")
......
......@@ -9,14 +9,21 @@
#6. Run the script! (python plot_profile.py)
#7. Open the outputfile in the imageviewer of your choice.
#Loading modules and setting fonts
import numpy
import matplotlib.pyplot as plt
from matplotlib import rc
import os
import matplotlib
rc('font', size='10')
rc('font', family='serif')
# set wd to the directory of the script
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
os.chdir(dname)
#Settings
dx = 1.0
......
{
"start_time": "2019-01-01 00:00:00",
"dt": 20,
"start_time": "2022-01-01 00:00:00",
"dt": 60,
"time": 0.0,
"time_out": 86400,
"time_total": 55468800,
"time_out": 302400.0,
"time_total": 65318400.0,
"length_input": 1088640.0,
"timestep_data": 60,
"length_input": 924481,
"thick_0": 0.02,
"Nlayer": 80,
"thick_0": 0.03,
"Nlayer": 20,
"N_active": 1,
"N_top": 20,
"N_bottom": 20,
"N_middle": 40,
"N_top": 5,
"N_bottom": 5,
"N_middle": 10,
"boundflux_flag": 2,
"albedo_flag": 2,
"grav_heat_flag": 1,
......@@ -25,7 +25,7 @@
"turb_flag": 2,
"bottom_flag": 1,
"tank_flag": 1,
"precip_flag": 1,
"precip_flag": 0,
"freeboard_snow_flag": 0,
"snow_flush_flag": 1,
"styropor_flag": 0,
......@@ -33,14 +33,14 @@
"debug_flag": 1,
"bgc_flag": 1,
"initial_state_flag": 1,
"tank_depth": 0,
"alpha_flux_stable": 0,
"alpha_flux_instable": 0,
"N_bgc": 0,
"bgc_bottom_1": 0,
"bgc_bottom_2": 0,
"thick_1": 0.02,
"m_1": 20.56,
"S_abs_1": 699.04,
"H_abs_1": -69904.0
"tank_depth": 1,
"alpha_flux_stable": 15,
"alpha_flux_instable": 22,
"N_bgc": 2,
"bgc_bottom_1": 385,
"bgc_bottom_2": 385,
"thick_1": 0.03,
"m_1": 30.84,
"S_abs_1": 1048.56,
"H_abs_1": 0
}
\ No newline at end of file
Mosaic_run_1
\ No newline at end of file
Testcase_3
\ No newline at end of file
......@@ -2,7 +2,7 @@
How to configure SAMSIM3.0 with config.json files and the respective inputs
## Brief Description
This Guide will show you an example run of SAMSIM3.0 with testcase. We go step-by-step through the python file build_config_1.py which is used to build the config.json file and
This Guide will show you an example run of SAMSIM3.0 with testcase 1. We go step-by-step through the python file build_config_1.py which is used to build the config.json file and
the input files needed to run SAMSIM3.0 for testcase 1. For a detailed documentation of the different variables, please look at
reference manual and SAMISM3.md.
......@@ -12,15 +12,21 @@ We use the build_config_1.py file, which is used to create the config.json and t
testcase 1 as an example.
The first section imports the json lbrary and the functions used to build the input files for the respective testcases.
It also defines two constants used below.
It also defines two constants used below and sets the working directory to the directory of the build_config file.
```python
import json
from Python_files.Code.build_config_files.func_bound_values import *
from func_bound_values import *
import os
# set wd to the directory of the script
abspath = os.path.abspath(__file__)
dname = os.path.dirname(abspath)
# set constants
rho_l = 1028
c_l = 3400
os.chdir(dname)
```
The second section initializes the config array which is converted into the config.json file in the end and sets the
paths for the storage spaces of the input files and the config file.
......@@ -43,11 +49,13 @@ file.write(description)
file.close()
```
In the fourth section, the time settings of the simulation are defined. Note that 'time_total'
should be a multiple of 'time_out'.
should be a multiple of 'time_out'. 'start_time' sets the beginning of your run, which is important if you
want to have a realistic timeframe. For testcase 1-4 this is arbitrary.
```python
# **********************************************************************************************************************
# Initial layer thickness, timestep, output time and simulation time
# **********************************************************************************************************************
config['start_time'] = '2022-01-01 00:00:00' # start time in YYYY-mm-dd HH:MM:SS
config['dt'] = 1 # time increment [s]]
config['time'] = 0.0 # initial value of time [s]
config['time_out'] = 3600 # time between outputs [s]
......@@ -191,5 +199,45 @@ json_object = json.dumps(config, indent=4)
with open(path_config + "config.json", "w") as outfile:
outfile.write(json_object)
```
### Run config script
You can run the build_config_1 file to prepare testcase 1 by simpely typing
````shell
python3 Python_files/Code/build_config_files/build_config_1.py
````
into your console. Note that the path can be different, depending on what folder you are in.
Running the script will put the needed input in the input folder and the config.json and the description.txt file
in the Run_specifics folder.
### Run SAMSIM
Now, you can run the model by going to the directory with the makefile in it (home directory of the repository)
and typing
````shell
make
````
into the console. This will compile the fortran code and produce a .mod and a .o file for every module and an executable file
called samsim.x.
Having done that, you can now run SAMSIM by typing
````shell
./samsim.x
````
into the console, which will run the executable file. One good thing about SAMSIM3.0 is that you
don't have to recompile it after you changed the inputs or the config file. You can simpely type the above command again
to rerun it for a different setting.
Runnig the SAMSIM will produce some output in your console, showing the progress and some other model variables.
After SAMSIM finishes, you can find the model output in the output foler.
### Plotting the output
The model output can simpely be plotted by running one of the plotscrips, depending on what you want to investigate.
For a good first overview I suggest using the plot_TPhiS.py script, which plots temperature, liquid fraction and salinity of the
sea ice profile over time. To do so, type
````shell
python3 Python_files/Code/plotscripts/plot_TPhiS.py
````
The path again depends on which folder you are currently in. This produces a nice plot which you can find in the folder
Python_files/Plots and should look like this for testcase 1:
![Testcase1](Plots/pic_TPhiS.png?raw=true)
\ No newline at end of file
documentation/Plots/pic_TPhiS.png

1.15 MiB

......@@ -22,7 +22,7 @@ This warning have been removed by introducing an additional variable T_in:
````
This improvement of the code caused minor changes in the output of the testcases which have a snow cover (3&4). For testcase 3, the changes look like this:
![testcase3_changes](C:\Users\jakob\OneDrive\Dokumente\Jobs\Sea ice Hiwi\Grotz3000\final_version\documentation\Plots\testcase3_v1_v2.png)
![testcase3_changes](Plots\testcase3_v1_v2.png)
There have been a lot of other warnings removed but these were the major ones.
......@@ -101,13 +101,13 @@ while reading the input data. The exact cause could not be identified but the di
If you can find the cause for the errors, contact me (jakob.deutloff@gmail.com) and I invite you for a drink ;).
Differences testcase 1 (none):
![testcase1_diff](C:\Users\jakob\OneDrive\Dokumente\Jobs\Sea ice Hiwi\Grotz3000\final_version\documentation\Plots\differeces_sam_final1.png)
![testcase1_diff](Plots\differeces_sam_final1.png)
Differences testcase 2:
![testcase2_diff](C:\Users\jakob\OneDrive\Dokumente\Jobs\Sea ice Hiwi\Grotz3000\final_version\documentation\Plots\differeces_sam_final2.png)
![testcase2_diff](Plots\differeces_sam_final2.png)
Differences Testcase 3:
![testcase3_diff](C:\Users\jakob\OneDrive\Dokumente\Jobs\Sea ice Hiwi\Grotz3000\final_version\documentation\Plots\differeces_sam_final3.png)
![testcase3_diff](Plots\differeces_sam_final3.png)
Differences Testcase 4:
![testcase4_diff](C:\Users\jakob\OneDrive\Dokumente\Jobs\Sea ice Hiwi\Grotz3000\final_version\documentation\Plots\differeces_sam_final4.png)
![testcase4_diff](Plots\differeces_sam_final4.png)
## List of New Variables
- T2m_input - Input file for T2m
- T_top_input - Input file for T_top
......
......@@ -98,7 +98,7 @@ CONTAINS
!Time settings needed when input is given
!*************************************************************************************************************************
CALL json%get('length_input', length_input, is_found)
IF (.not. is_found) THEN; PRINT*, 'n_time_output not found'; STOP; END IF
IF (.not. is_found) THEN; PRINT*, 'lenght_input not found'; STOP; END IF
CALL json%get('timestep_data', timestep_data, is_found)
IF (.not. is_found) THEN; PRINT*, 'timestep_data not found'; STOP; END IF
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment