Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shear #95

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ead977b
undid stylistic changes, adding shear
brianxchen Jan 29, 2021
8cc7904
Working shear
brianxchen Feb 5, 2021
fdbb78f
Actual working shear update
brianxchen Feb 5, 2021
91b54b0
Split updatePatch into two inlines - now consistent with pkdgrav
brianxchen Feb 11, 2021
ff3416f
changes to shearing patch
brianxchen Feb 26, 2021
47155b8
Shearing patch with too wide spread
brianxchen Mar 2, 2021
fda2894
Working shearing patch - tends to ideal line after a long time
brianxchen Mar 5, 2021
1b68a18
moved velocity update earlier
brianxchen Mar 19, 2021
8ed66ee
added orbital frequency to treepiece calls, shears correctly now
brianxchen May 3, 2021
6eb73d1
added dorbfreq to remaining drift calls
brianxchen May 3, 2021
050c1ff
attempted removal of dorbfreq in drift calls
brianxchen May 7, 2021
ad5d55f
fixed shear - moved checkparams before setperiodic
brianxchen May 10, 2021
1ec19f6
Merge branch 'master' of github.com:N-BodyShop/changa into Shear
trquinn May 24, 2021
91eb7bc
comments, whitespace changes
brianxchen Jun 13, 2021
1282b04
Add --enable-slidingpatch as a configure option.
trquinn Jun 14, 2021
e49553e
documentation, removed dOrbFreq from TreePiece::kick
brianxchen Jun 18, 2021
8edf991
Merge branch 'Shear' of https://github.com/brianxchen/changa into Shear
brianxchen Jun 18, 2021
716e4fc
changed vector components to .x, .y etc, added sliding patch ifdef to…
brianxchen Aug 9, 2021
56b2b32
typo fixes
brianxchen Aug 9, 2021
60dfdd9
ExternalGravity::applyPotential(): correct Hill acceleration.
trquinn Jul 1, 2023
a8b1890
Log SLIDING_PATCH and NO_HILL compile options.
trquinn Jul 1, 2023
1366287
SLIDING_PATCH: add predicted canonical y momentum for gas.
trquinn Jul 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ParallelGravity.h
Original file line number Diff line number Diff line change
Expand Up @@ -2001,8 +2001,12 @@ class TreePiece : public CBase_TreePiece {
Vector3D<cosmoType> fPeriod, ///< vector for dxPeriod and dyPeriod
double dOrbFreq) ///< Orbital frequency
{
#ifdef SLIDING_PATCH
return (ix < 0) ? fmod(0.5 * fPeriod[1] - 1.5 * ix * dOrbFreq * fPeriod[0] * t, fPeriod[1]) - 0.5 * fPeriod[1] :
trquinn marked this conversation as resolved.
Show resolved Hide resolved
(ix > 0) ? 0.5 * fPeriod[1] - fmod(0.5 * fPeriod[1] + 1.5 * ix * dOrbFreq * fPeriod[0] * t, fPeriod[1]) : 0.0;
#else
return 0;
#endif
}

inline Vector3D<cosmoType> decodeOffset(int reqID) {
Expand All @@ -2011,7 +2015,7 @@ class TreePiece : public CBase_TreePiece {
int y = ((offsetcode >> 3) & 0x7) - 3;
int z = ((offsetcode >> 6) & 0x7) - 3;

Vector3D<cosmoType> offset(x*fPeriod.x, y*fPeriod.y + SHEAR(x, totalTime, fPeriod[1], dOrbFreq), z*fPeriod.z);
Vector3D<cosmoType> offset(x*fPeriod.x, y*fPeriod.y + SHEAR(x, totalTime, fPeriod.y, dOrbFreq), z*fPeriod.z);
return offset;
}

Expand Down
16 changes: 8 additions & 8 deletions Sph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,11 +1120,11 @@ void DenDvDxSmoothParams::fcnSmooth(GravityParticle *p, int nSmooth,
dvy = (-p->vPred().y + q->vPred().y)*vFac;
dvz = (-p->vPred().z + q->vPred().z)*vFac;
#ifdef SLIDING_PATCH
if (dx < 0.0 && (p->position[0] - q->position[0] > 0.0)) {
dvy -= 1.5 * dOrbFreq * fPeriod[0];
if (dx < 0.0 && (p->position.x - q->position.x > 0.0)) {
dvy -= 1.5 * dOrbFreq * fPeriod.y;
Copy link
Member

Choose a reason for hiding this comment

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

Typo here (.y instead of .x); also on line 1127

}
else if (dx > 0.0 && (p->position[0] - q->position[0] < 0.0)) {
dvy += 1.5 * dOrbFreq * fPeriod[0];
else if (dx > 0.0 && (p->position.x - q->position.x < 0.0)) {
dvy += 1.5 * dOrbFreq * fPeriod.y;
}
#endif
dvxdx += dvx*dx*rs1;
Expand Down Expand Up @@ -1584,11 +1584,11 @@ void PressureSmoothParams::fcnSmooth(GravityParticle *p, int nSmooth,
params.dx = nnList[i].dx;
dv = p->vPred() - q->vPred();
#ifdef SLIDING_PATCH
if (params.dx.x < 0.0 && (p->position[0] - q->position[0] > 0.0)) {
dv[1] += 1.5 * dOrbFreq * fPeriod[0];
if (params.dx.x < 0.0 && (p->position.x - q->position.x > 0.0)) {
dv[1] += 1.5 * dOrbFreq * fPeriod.x;
}
else if (params.dx.x > 0.0 && (p->position[0] - q->position[0] < 0.0)) {
dv[1] -= 1.5 * dOrbFreq * fPeriod[0];
else if (params.dx.x > 0.0 && (p->position.x - q->position.x < 0.0)) {
dv[1] -= 1.5 * dOrbFreq * fPeriod.x;
}
#endif
params.dvdotdr = vFac*dot(dv, params.dx) + fDist2*H;
Expand Down
9 changes: 4 additions & 5 deletions TreePiece.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1469,8 +1469,7 @@ void TreePiece::calcEnergy(const CkCallback& cb) {

/**
* @brief closePatch performs a velocity update as part of the kick-cross-drift-cross-kick
algorithm described in Quinn et al. 2010
* at the edge of a sliding patch.
* algorithm described in Quinn et al. 2010
* @param bClosing bool indicating whether the patch is opening or closing
* @param dDelta timestep
* @param p particle to update
Expand All @@ -1479,14 +1478,14 @@ algorithm described in Quinn et al. 2010
inline void closePatch(int bClosing, double dDelta, GravityParticle *p, double dOrbFreq) {
#ifdef SLIDING_PATCH
if (bClosing) {
p->velocity[0] += 2.0 * dDelta * dOrbFreq * p->dPy;
p->velocity[1] = p->dPy - 2 * dOrbFreq * p->position[0];
p->velocity.x += 2.0 * dDelta * dOrbFreq * p->dPy;
p->velocity.y = p->dPy - 2 * dOrbFreq * p->position.x;
}
#endif
}
/**
* @brief openPatch performs a velocity update as part of the kick-cross-drift-cross-kick
algorithm described in Quinn et al. 2010
* algorithm described in Quinn et al. 2010
* @param bClosing bool indicating whether the patch is opening or closing
* @param dDelta timestep
* @param p particle to update
Expand Down