Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SAMSIM3.0
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Deutloff, Jakob
SAMSIM3.0
Commits
ff20babb
Commit
ff20babb
authored
3 years ago
by
Fuchs, Niels
Browse files
Options
Downloads
Patches
Plain Diff
add Configuration Script for MOSAiC data
parent
278fad20
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Python_files/Code/build_config_files/build_config_MOSAiC.py
+119
-0
119 additions, 0 deletions
Python_files/Code/build_config_files/build_config_MOSAiC.py
with
119 additions
and
0 deletions
Python_files/Code/build_config_files/build_config_MOSAiC.py
0 → 100644
+
119
−
0
View file @
ff20babb
import
json
from
func_bound_values
import
*
# set constants
rho_l
=
1028
c_l
=
3400
# **********************************************************************************************************************
# Initialize array containig all parameters and set path to its directory
# **********************************************************************************************************************
config
=
{}
path_config
=
r
'
../../../Run_specifics/
'
path_input
=
'
../../../input/
'
# **********************************************************************************************************************
# Set description of run
# **********************************************************************************************************************
description
=
"
Testcase_MOSAiC
"
file
=
open
(
path_config
+
r
"
description.txt
"
,
"
w
"
)
file
.
write
(
description
)
file
.
close
()
# **********************************************************************************************************************
# Initial layer thickness, timestep, output time and simulation time
# **********************************************************************************************************************
config
[
'
dt
'
]
=
20.
# time increment [s]]
config
[
'
time
'
]
=
0.0
# initial value of time [s]
config
[
'
time_out
'
]
=
86400.
# time between outputs [s]
config
[
'
time_total
'
]
=
55468800.
# total length of simulation [s]
# **********************************************************************************************************************
# Time settings needed when input is given
# **********************************************************************************************************************
config
[
'
timestep_data
'
]
=
60
# timestep of input data [s]
config
[
'
length_input
'
]
=
config
[
'
time_total
'
]
/
60.
+
1
# Length of your input files. Must match with timestep_data
# **********************************************************************************************************************
# Layer settings and allocation
# **********************************************************************************************************************
config
[
'
thick_0
'
]
=
0.02
config
[
'
Nlayer
'
]
=
80
config
[
'
N_active
'
]
=
1
config
[
'
N_top
'
]
=
20
config
[
'
N_bottom
'
]
=
20
config
[
'
N_middle
'
]
=
config
[
'
Nlayer
'
]
-
config
[
'
N_top
'
]
-
config
[
'
N_bottom
'
]
# **********************************************************************************************************************
# Flags
# **********************************************************************************************************************
# ________________________top heat flux____________
config
[
'
boundflux_flag
'
]
=
2
config
[
'
albedo_flag
'
]
=
2
# ________________________brine_dynamics____________
config
[
'
grav_heat_flag
'
]
=
1
config
[
'
flush_heat_flag
'
]
=
1
config
[
'
flood_flag
'
]
=
2
config
[
'
flush_flag
'
]
=
5
config
[
'
grav_flag
'
]
=
2
config
[
'
harmonic_flag
'
]
=
2
# ________________________Salinity____________
config
[
'
prescribe_flag
'
]
=
1
config
[
'
salt_flag
'
]
=
1
# ________________________bottom setting______________________
config
[
'
turb_flag
'
]
=
1
config
[
'
bottom_flag
'
]
=
1
config
[
'
tank_flag
'
]
=
1
# ________________________snow______________________
config
[
'
precip_flag
'
]
=
1
config
[
'
freeboard_snow_flag
'
]
=
0
# < Niels, 2017
config
[
'
snow_flush_flag
'
]
=
1
# < Niels, 2017
config
[
'
styropor_flag
'
]
=
0
config
[
'
lab_snow_flag
'
]
=
0
# ________________________debugging_____________________
config
[
'
debug_flag
'
]
=
1
# set to 2 for output of all ice layers each timestep
# ________________________bgc_______________________
config
[
'
bgc_flag
'
]
=
1
# ________________________initial state_______________________
config
[
'
initial_state_flag
'
]
=
1
# 2 if initial state is given
# **********************************************************************************************************************
# Tank and turbulent fluxes settings
# **********************************************************************************************************************
config
[
'
tank_depth
'
]
=
0
config
[
'
alpha_flux_stable
'
]
=
0
config
[
'
alpha_flux_instable
'
]
=
0
# **********************************************************************************************************************
# BGC Settings
# **********************************************************************************************************************
config
[
'
N_bgc
'
]
=
2
config
[
'
bgc_bottom_1
'
]
=
400
config
[
'
bgc_bottom_2
'
]
=
500
# **********************************************************************************************************************
# Construct Input files
# **********************************************************************************************************************
# Set constant inputs
const_inputs
=
{
'
T_bottom
'
:
-
1.8
,
'
S_bu_bottom
'
:
34
,
'
fl_q_bottom
'
:
1.
,
'
precip_s
'
:
0.
}
for
input
in
list
(
const_inputs
.
keys
()):
data
=
np
.
ones
(
int
(
config
[
'
length_input
'
]))
*
const_inputs
[
input
]
np
.
savetxt
(
path_input
+
input
+
'
.txt
'
,
data
)
# **********************************************************************************************************************
# setting the initial values of the top and only layer - not needed if initial ice properties are given - set to zero
# **********************************************************************************************************************
config
[
'
thick_1
'
]
=
config
[
'
thick_0
'
]
config
[
'
m_1
'
]
=
config
[
'
thick_0
'
]
*
rho_l
config
[
'
S_abs_1
'
]
=
config
[
'
m_1
'
]
*
const_inputs
[
'
S_bu_bottom
'
]
config
[
'
H_abs_1
'
]
=
config
[
'
m_1
'
]
*
const_inputs
[
'
T_bottom
'
]
*
c_l
# **********************************************************************************************************************
# Write init to .json file
# **********************************************************************************************************************
json_object
=
json
.
dumps
(
config
,
indent
=
4
)
with
open
(
path_config
+
"
config.json
"
,
"
w
"
)
as
outfile
:
outfile
.
write
(
json_object
)
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