GadgetUnits
Unit conversion utility for the cosmological Tree-SPH code Gadget
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.0%) to scientific vocabulary
Keywords from Contributors
Repository
Unit conversion utility for the cosmological Tree-SPH code Gadget
Basic Info
Statistics
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
| Documentation | Build Status | License | Citation
|:-----------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:| :-----------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|
|
|
|
|
GadgetUnits.jl
This package provides some basic unit conversion functionality to work with the SPH code Gadget2 by Volker Springel. It is based on the unit conversions listed by Klaus Dolag on his HowTo page (restricted). Further functionality provides tools for cosmological simulations.
If you use GadgetUnits.jl in publications please cite it.
Unit Conversion
GadgetUnits.jl uses Unitful.jl and UnitfulAstro.jl to store the unit conversion factors with actual units in place.
You can convert the internal units of Gadget into cgs units by defining the struct GadgetPhysicalUnits:
julia
GU = GadgetPhysicalUnits(l_unit::T=3.085678e21, m_unit::T=1.989e43, v_unit::T=1.e5;
a_scale::T=1.0, hpar::T=1.0,
γ_th::T=5.0/3.0, γ_CR::T=4.0/3.0, xH::T=0.76) where T
where the keyword arguments are:
- a_scale = 1.0: Cosmological scale factor of the simulation. Can be passed with the header h as h.time.
- hpar = 1.0: Hubble constant as 'little h'. Can be passed with header h as h.h0.
- γ_th = 5.0/3.0: Adiabatic index of gas.
- γ_CR = 4.0/3.0: Adiabatic index of cosmic ray component.
- xH = 0.76: Hydrogen fraction of the simulation, if run without chemical model.
This returns an struct of type GadgetPhysicalUnits with the following properties:
| Field Name | Meaning |
|:--- |:--- |
|x_cgs::T | position in cm |
|x_physical::T | position in kpc |
|v_cgs::T | velocity in cm/s |
|v_physical::T | velocity in km/s |
|m_cgs::T | mass in g |
|m_msun::T | mass in Msun |
|m_physical::T | mass in 10^10 Msun |
|t_s::T | time in sec |
|t_Myr::T | time in Myr |
|E_cgs::T | energy in erg |
|E_eV::T | energy in eV |
|B_cgs::T | magnetic field in Gauss |
|rho_physical::T | density in 10^10 Msun/kpc^3 |
|rho_cgs::T | density in g/cm^3 |
|rho_ncm3::T | density in n_p/cm^3 |
|T_K::T | temperature in K |
|T_eV::T | temperature in eV |
|P_th_cgs::T | thermal pressure in Ba |
|P_CR_cgs::T | cosmic ray pressure in Ba |
To convert, say positions of gas particles from a cosmological simulation to physical units you can use:
```julia
h = read_header(filename)
pos = read_snap(filename, "POS", 0)
GU = GadgetPhysicalUnits(a_scale=h.time, hpar=h.h0)
pos .*= GU.x_cgs
```
If you have different units than the standard Gadget ones you can call the object cunstructor with different values
julia
GU = GadgetPhysicalUnits(your_l_unit, your_m_unit, your_v_unit; kwargs...)
Converting the units can then be done with Unitful.jl and UnitfulAstro.jl.
So if you want to convert the position units from the default cm to Mpc you can do this as:
```julia using Unitful using UnitfulAstro
pos = readsnap(filename, "POS", 0) pos = @. pos * GU.xcgs |> u"Mpc" ```
If you want to get rid of the units, for example if you need basic datatypes again for a function
you can use the funtion ustrip:
julia
pos = ustrip(pos)
Primitive unit type
If you want to have the same functionality, but without using Unitful.jl you can construct a similar object:
julia
GU = GadgetPhysical(l_unit::T=3.085678e21, m_unit::T=1.989e43, v_unit::T=1.e5;
a_scale::T=1.0, hpar::T=1.0,
γ_th::T=5.0/3.0, γ_CR::T=4.0/3.0, xH::T=0.76) where T
This uses the same conversions, but leaves out the actual unit strings.
Owner
- Name: Ludwig
- Login: LudwigBoess
- Kind: user
- Location: Munich
- Repositories: 20
- Profile: https://github.com/LudwigBoess
I'm a PhD student at the University Observatory Munich working on cosmological MHD simulations.
GitHub Events
Total
- Create event: 4
- Commit comment event: 1
- Release event: 1
- Delete event: 2
- Issue comment event: 2
- Push event: 63
- Pull request event: 4
Last Year
- Create event: 4
- Commit comment event: 1
- Release event: 1
- Delete event: 2
- Issue comment event: 2
- Push event: 63
- Pull request event: 4
Committers
Last synced: over 3 years ago
All Time
- Total Commits: 97
- Total Committers: 7
- Avg Commits per committer: 13.857
- Development Distribution Score (DDS): 0.309
Top Committers
| Name | Commits | |
|---|---|---|
| LudwigBoess | l****s@u****e | 67 |
| Ludwig Boess | d****g@c****e | 10 |
| Ludwig Böss | l****s@o****e | 9 |
| Ludwig | 3****s@u****m | 4 |
| github-actions[bot] | 4****]@u****m | 4 |
| Julia Package Butler | 2 | |
| CompatHelper Julia | c****y@j****g | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 1
- Total pull requests: 27
- Average time to close issues: less than a minute
- Average time to close pull requests: 25 days
- Total issue authors: 1
- Total pull request authors: 3
- Average comments per issue: 15.0
- Average comments per pull request: 0.78
- Merged pull requests: 22
- Bot issues: 0
- Bot pull requests: 9
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- JuliaTagBot (1)
Pull Request Authors
- LudwigBoess (18)
- github-actions[bot] (10)
- timholy (1)
- dependabot[bot] (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- julia 4 total
- Total dependent packages: 1
- Total dependent repositories: 0
- Total versions: 18
juliahub.com: GadgetUnits
Unit conversion utility for the cosmological Tree-SPH code Gadget
- Documentation: https://docs.juliahub.com/General/GadgetUnits/stable/
- License: MIT
-
Latest release: 0.6.2
published about 1 year ago
Rankings
Dependencies
- actions/checkout v2 composite
- davidanthoff/julia-pkgbutler releases/v1 composite
- actions/checkout v2 composite
- codecov/codecov-action v1 composite
- julia-actions/julia-buildpkg latest composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest latest composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- codecov/codecov-action v1 composite
- julia-actions/julia-buildpkg latest composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest latest composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/julia-buildpkg latest composite
- julia-actions/julia-docdeploy releases/v1 composite
- JuliaRegistries/TagBot v1 composite