Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
42555c4f
Commit
42555c4f
authored
7 years ago
by
James Willis
Browse files
Options
Downloads
Patches
Plain Diff
Populate velociraptor interface and output values.
parent
6a3557b7
Branches
Branches containing commit
Tags
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/velociraptor_interface.c
+38
-11
38 additions, 11 deletions
src/velociraptor_interface.c
with
38 additions
and
11 deletions
src/velociraptor_interface.c
+
38
−
11
View file @
42555c4f
...
...
@@ -39,28 +39,55 @@ void init_velociraptor(struct engine *e) {
struct
unitinfo
unit_info
;
struct
siminfo
sim_info
;
struct
unit_system
vel_us
;
struct
phys_const
vel_const
;
/* Initialize velociraptor unit system and constants */
units_init
(
&
vel_us
,
e
->
parameter_file
,
"VelociraptorUnitSystem"
);
phys_const_init
(
&
vel_us
,
e
->
parameter_file
,
&
vel_const
);
/* Set cosmological constants. */
cosmo_info
.
atime
=
e
->
cosmology
->
time
;
/* TODO: double check this. */
cosmo_info
.
atime
=
e
->
cosmology
->
a
;
cosmo_info
.
littleh
=
e
->
cosmology
->
h
;
cosmo_info
.
Omega_m
=
e
->
cosmology
->
Omega_m
;
cosmo_info
.
Omega_b
=
e
->
cosmology
->
Omega_b
;
cosmo_info
.
Omega_Lambda
=
e
->
cosmology
->
Omega_lambda
;
cosmo_info
.
Omega_cdm
=
e
->
cosmology
->
Omega_m
-
e
->
cosmology
->
Omega_b
;
/* TODO: double check this. */
cosmo_info
.
w_de
=
e
->
cosmology
->
w_0
;
/* TODO: double check this. */
cosmo_info
.
Omega_cdm
=
e
->
cosmology
->
Omega_m
-
e
->
cosmology
->
Omega_b
;
cosmo_info
.
w_de
=
e
->
cosmology
->
w_0
;
message
(
"Scale factor: %e"
,
cosmo_info
.
atime
);
message
(
"Little h: %e"
,
cosmo_info
.
littleh
);
message
(
"Omega_m: %e"
,
cosmo_info
.
Omega_m
);
message
(
"Omega_b: %e"
,
cosmo_info
.
Omega_b
);
message
(
"Omega_Lambda: %e"
,
cosmo_info
.
Omega_Lambda
);
message
(
"Omega_cdm: %e"
,
cosmo_info
.
Omega_cdm
);
message
(
"w_de: %e"
,
cosmo_info
.
w_de
);
/* Set unit conversions. */
unit_info
.
lengthtokpc
=
3.2404407e-22
*
e
->
internal_units
->
UnitLength_in_cgs
;
/* 1kpc <=> 3.086e21cm */
unit_info
.
velocitytokms
=
1e-4
*
parser_get_param_double
(
e
->
parameter_file
,
"I
nternal
U
nit
System:UnitVelocity_in_cgs"
);
/* 1km/s <=> 1e
4
cm/s */
unit_info
.
masstosolarmass
=
5.0251256e-34
*
e
->
internal_units
->
UnitMass_in_cgs
;
/* 1M_sol <=> 1.99e33g */
unit_info
.
gravity
=
e
->
physica
l_const
ants
->
const_newton_G
;
/* G = 6.67408e-8 (cgs) */
unit_info
.
lengthtokpc
=
units_conversion_factor
(
e
->
internal_units
,
&
vel_us
,
UNIT_CONV_LENGTH
)
;
/* 1kpc <=> 3.086e21cm */
unit_info
.
velocitytokms
=
units_conversion_factor
(
e
->
i
nternal
_u
nit
s
,
&
vel_us
,
UNIT_CONV_SPEED
);
/* 1km/s <=> 1e
5
cm/s */
unit_info
.
masstosolarmass
=
units_conversion_factor
(
e
->
internal_units
,
&
vel_us
,
UNIT_CONV_MASS
)
;
/* 1M_sol <=> 1.99e33g */
unit_info
.
gravity
=
v
el_const
.
const_newton_G
;
/*
TODO:
G = 6.67408e-8 (cgs) */
unit_info
.
hubbleunit
=
e
->
cosmology
->
H
;
/* TODO: double check this. */
message
(
"Length conversion factor: %e"
,
unit_info
.
lengthtokpc
);
message
(
"Velocity conversion factor: %e"
,
unit_info
.
velocitytokms
);
message
(
"Mass conversion factor: %e"
,
unit_info
.
masstosolarmass
);
message
(
"G: %e"
,
unit_info
.
gravity
);
message
(
"H: %e"
,
unit_info
.
hubbleunit
);
const
int
nr_gparts
=
e
->
s
->
nr_gparts
;
/* Set simulation information. */
sim_info
.
period
=
1
.
0
;
/* Placeholder. */
sim_info
.
zoomhigresolutionmass
=
1
.
0
;
/* Placeholder. */
sim_info
.
interparticlespacing
=
1
.
0
;
/* Placeholder. */
sim_info
.
icosmologicalsim
=
1
;
/* Placeholder. */
sim_info
.
period
=
unit_info
.
lengthtokpc
*
e
->
s
->
cdim
[
0
]
*
e
->
s
->
width
[
0
];
/* Physical size of box in VELOCIraptor units (kpc). */
sim_info
.
zoomhigresolutionmass
=
-
1
.
0
;
/* Placeholder. */
sim_info
.
interparticlespacing
=
sim_info
.
period
/
pow
(
nr_gparts
,
1
.
/
3
.);
/* Placeholder. */
sim_info
.
icosmologicalsim
=
(
e
->
policy
&
engine_policy_cosmology
);
/* Placeholder. */
message
(
"Period: %e"
,
sim_info
.
period
);
message
(
"Zoom high res mass: %e"
,
sim_info
.
zoomhigresolutionmass
);
message
(
"Inter-particle spacing: %e"
,
sim_info
.
interparticlespacing
);
message
(
"Cosmological: %d"
,
sim_info
.
icosmologicalsim
);
InitVelociraptor
(
"stf_input.cfg"
,
"stf_ouput.out"
,
cosmo_info
,
unit_info
,
sim_info
);
}
...
...
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