Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Setup galaxy simulations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SoftenedJeansCriteria
Setup galaxy simulations
Commits
b73698e0
Commit
b73698e0
authored
1 year ago
by
Sylvia Plöckinger
Browse files
Options
Downloads
Patches
Plain Diff
Added setup script
parent
4a87cd79
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+112
-0
112 additions, 0 deletions
setup.py
with
112 additions
and
0 deletions
setup.py
0 → 100644
+
112
−
0
View file @
b73698e0
import
os
from
pathlib
import
Path
import
shutil
import
glob
########################################################
## use this to submit all simulations ##
########################################################
#mass_resolution_levels = ["M5", "M6"]
#softening_resolutions_in_kpc = [0.25, 0.5]
#smoothing_resolutions_in_kpc = [0.0775, 0.0245, 0.00775]
#star_formation_efficiencies = [0.00316, 0.01]
#runtime_in_full_hours = 72
########################################################
########################################################
## use this for testing a small subset of simulations ##
########################################################
mass_resolution_levels
=
[
"
M6
"
]
softening_resolutions_in_kpc
=
[
0.25
]
smoothing_resolutions_in_kpc
=
[
0.0775
,
0.0245
,
0.00775
]
star_formation_efficiencies
=
[
0.00316
]
runtime_in_full_hours
=
12
########################################################
localdir
=
os
.
getcwd
()
for
mass
in
mass_resolution_levels
:
Path
(
os
.
path
.
join
(
localdir
,
mass
)).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
for
soft
in
softening_resolutions_in_kpc
:
for
smooth
in
smoothing_resolutions_in_kpc
:
for
sfe
in
star_formation_efficiencies
:
##########################################
# start from the original local directory
##########################################
os
.
chdir
(
localdir
)
##########################################
# name and create runfolder
##########################################
runname
=
"
Galaxy
"
+
mass
+
\
"
_soft%4.4ipc
"
%
(
int
(
soft
*
1000
))
+
\
"
_hmin%06.2fpc
"
%
(
smooth
*
1000.
)
+
\
"
_sfe%06.3f
"
%
(
sfe
)
folder
=
os
.
path
.
join
(
localdir
,
mass
,
runname
)
Path
(
folder
).
mkdir
(
parents
=
True
,
exist_ok
=
True
)
##########################################
# change working directory to runfolder
##########################################
os
.
chdir
(
folder
)
##########################################
# copy fiducidal files into runfolder
##########################################
for
fidfile
in
glob
.
glob
(
"
../../fiducial_files/*
"
):
shutil
.
copy2
(
fidfile
,
"
./
"
)
##########################################
# modify the yaml file for each run
##########################################
f
=
open
(
"
isolated_galaxy.yml
"
,
"
rt
"
)
data
=
f
.
read
()
data
=
data
.
replace
(
'
RUNNAME
'
,
runname
)
data
=
data
.
replace
(
'
SOFTENING
'
,
'
%.4f
'
%
(
soft
))
data
=
data
.
replace
(
'
INITIALCONDITIONS
'
,
'
%s_disk
'
%
(
mass
))
data
=
data
.
replace
(
'
HMINRATIO
'
,
'
%.4f
'
%
(
smooth
/
(
1.55
*
soft
)))
data
=
data
.
replace
(
'
SFEFFICIENCY
'
,
'
%.4f
'
%
(
sfe
))
data
=
data
.
replace
(
'
EOSDENSITY
'
,
'
1e-4
'
)
data
=
data
.
replace
(
'
EOSTEMPERATURE
'
,
'
10.
'
)
data
=
data
.
replace
(
'
EOSSLOPE
'
,
'
0.
'
)
f
.
close
()
f
=
open
(
"
isolated_galaxy.yml
"
,
"
wt
"
)
f
.
write
(
data
)
f
.
close
()
##########################################
# modify the submission script for each run
##########################################
f
=
open
(
"
submit.job
"
,
"
rt
"
)
data
=
f
.
read
()
data
=
data
.
replace
(
'
RUNNAME
'
,
runname
)
data
=
data
.
replace
(
'
TIMEINHOURS
'
,
'
%2.2i
'
%
(
int
(
runtime_in_full_hours
)))
f
.
close
()
f
=
open
(
"
submit.job
"
,
"
wt
"
)
f
.
write
(
data
)
f
.
close
()
##########################################
# modify the resubmission script for each run
##########################################
f
=
open
(
"
resubmit.job
"
,
"
rt
"
)
data
=
f
.
read
()
data
=
data
.
replace
(
'
RUNNAME
'
,
runname
)
f
.
close
()
f
=
open
(
"
resubmit.job
"
,
"
wt
"
)
f
.
write
(
data
)
f
.
close
()
##########################################
# submit jobs
##########################################
os
.
system
(
"
sbatch submit.job
"
)
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