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
81ab30eb
Commit
81ab30eb
authored
6 years ago
by
Folkert Nobels
Browse files
Options
Downloads
Patches
Plain Diff
Update star formation routine
parent
5c9fad64
No related branches found
No related tags found
1 merge request
!705
Star formation following Schaye08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/starformation/schaye08/starformation.h
+20
-4
20 additions, 4 deletions
src/starformation/schaye08/starformation.h
with
20 additions
and
4 deletions
src/starformation/schaye08/starformation.h
+
20
−
4
View file @
81ab30eb
...
...
@@ -84,8 +84,8 @@ static int starformation_potential_to_become_star(
/* Calculate the internal energy using the density and entropy */
/* Ask Matthieu about p->entropy vs xp->entropy_full */
const
double
internal_energy
=
gas
_internal_energy
_from_entropy
(
p
->
rho
,
p
->
entropy
);
const
double
internal_energy
=
hydro_get_physical
_internal_energy
(
p
,
xp
,
cosmo
);
/* Calculate the temperature over mu of the gas */
/* Temporary part of the code!! */
...
...
@@ -124,13 +124,29 @@ static int starformation_potential_to_become_star(
/*
* @brief Calculate if the gas particle is converted
*
* @param starform the star formation struct
* @param p the gas particles with their properties
* @param xp the additional gas particle properties
* @param cosmo the cosmological properties
*
* */
static
void
starformation_convert_to_gas
(
const
struct
star_formation
*
starform
,
const
struct
star_formation
*
starform
,
const
struct
parts
*
p
,
const
struct
xparts
*
xp
,
const
struct
cosmology
*
cosmo
){
/* Set a dummy seed for testing */
const
int
globalseed
=
42
;
const
double
prop
=
Astar
*
pressure
*
dt
;
/* Get the pressure */
const
double
pressure
=
hydro_get_physical_pressure
(
p
,
xp
,
cosmo
);
/* Calculate the propability of forming a star */
const
double
prop
=
Astar
*
pressure
*
p
->
time_bin
;
/* Generate a random number between 0 and 1. */
const
double
randomnumber
=
rand_r
(
&
globalseed
)
*
inv_RAND_MAX
;
/* Calculate if we form a star */
if
(
prop
>
randomnumber
)
{
message
(
"Create a STAR!!"
);
}
...
...
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