Skip to content

Commit

Permalink
Incorporate Gravity property into calculation of acceleration due to …
Browse files Browse the repository at this point in the history
…newtonian gravity
  • Loading branch information
LBPHacker committed Oct 15, 2019
1 parent a50b172 commit 6b85231
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/simulation/Simulation.cpp
Expand Up @@ -3825,16 +3825,10 @@ void Simulation::UpdateParticles(int start, int end)
break;
}
//Get some gravity from the gravity map
if (t==PT_ANAR)
if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
{
// perhaps we should have a ptypes variable for this
pGravX -= gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
pGravY -= gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
}
else if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
{
pGravX += gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
pGravX += elements[t].Gravity * gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
pGravY += elements[t].Gravity * gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
}
}
else
Expand Down

2 comments on commit 6b85231

@6nop6nop
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks,

although this breaks it for PHOT because it has zero for gravity.

something like

pGravX += elements[t].Gravity == 0 ? gravx[(y/CELL)*(XRES/CELL)+(x/CELL)] : elements[t].Gravity * gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
pGravY += elements[t].Gravity == 0 ? gravy[(y/CELL)*(XRES/CELL)+(x/CELL)] : elements[t].Gravity * gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];

?

@LBPHacker
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this needs more fine-tuning, I'm aware of what you're bringing up and also bunch of other problems. Will try to fix them in a bit if I get the time.

Please sign in to comment.