Skip to content
Snippets Groups Projects

Merge Gizmo-SPH into the master branch

Merged Matthieu Schaller requested to merge gizmo_new into master

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
254 253 __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
255 254 struct part* p) {
256 255
257 float momentum[3];
258 256 const float volume = p->geometry.volume;
259 257 const float m = p->conserved.mass;
260 258 p->primitives.rho = m / volume;
261 259
262 /* P actually contains internal energy at this point */
263 p->primitives.P *= hydro_gamma_minus_one * p->primitives.rho;
260 p->conserved.momentum[0] = m * p->primitives.v[0];
261 p->conserved.momentum[1] = m * p->primitives.v[1];
262 p->conserved.momentum[2] = m * p->primitives.v[2];
263 p->conserved.energy *= m;
  • Matthieu Schaller
    Matthieu Schaller @matthieu started a thread on commit 72945cae
  • 254 253 __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
    255 254 struct part* p) {
    256 255
    257 float momentum[3];
    258 256 const float volume = p->geometry.volume;
    259 257 const float m = p->conserved.mass;
    260 258 p->primitives.rho = m / volume;
    261 259
    262 /* P actually contains internal energy at this point */
    263 p->primitives.P *= hydro_gamma_minus_one * p->primitives.rho;
    260 p->conserved.momentum[0] = m * p->primitives.v[0];
    261 p->conserved.momentum[1] = m * p->primitives.v[1];
    262 p->conserved.momentum[2] = m * p->primitives.v[2];
    263 p->conserved.energy *= m;
  • 254 253 __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
    255 254 struct part* p) {
    256 255
    257 float momentum[3];
    258 256 const float volume = p->geometry.volume;
    259 257 const float m = p->conserved.mass;
    260 258 p->primitives.rho = m / volume;
    261 259
    262 /* P actually contains internal energy at this point */
    263 p->primitives.P *= hydro_gamma_minus_one * p->primitives.rho;
    260 p->conserved.momentum[0] = m * p->primitives.v[0];
    261 p->conserved.momentum[1] = m * p->primitives.v[1];
    262 p->conserved.momentum[2] = m * p->primitives.v[2];
    263 p->conserved.energy *= m;
    • No, in the last version that I have the internal energy (not per unit mass) is calculated from the pressure. The pressure initially contains the internal energy per unit mass and is then converted into the pressure.

      If u is the internal energy per unit mass, then P = (gamma-1) * rhou; conserved.energy = P / (gamma-1) * volume = um.

      What you have now is conserved.energy = um (which is correct), and P = (gamma-1)rhomu (which is not correct). If you put the p->conserved.energy *= m below the computation of P, it will be correct.

      Edited by Bert Vandenbroucke
  • 254 253 __attribute__((always_inline)) INLINE static void hydro_convert_quantities(
    255 254 struct part* p) {
    256 255
    257 float momentum[3];
    258 256 const float volume = p->geometry.volume;
    259 257 const float m = p->conserved.mass;
    260 258 p->primitives.rho = m / volume;
    261 259
    262 /* P actually contains internal energy at this point */
    263 p->primitives.P *= hydro_gamma_minus_one * p->primitives.rho;
    260 p->conserved.momentum[0] = m * p->primitives.v[0];
    261 p->conserved.momentum[1] = m * p->primitives.v[1];
    262 p->conserved.momentum[2] = m * p->primitives.v[2];
    263 p->conserved.energy *= m;
    • Not that it really matters though. The pressure you compute here is never actually used and is recalculated after the second density loop during the first real time step.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading