-
Notifications
You must be signed in to change notification settings - Fork 24
Added new functionality to generate DEM from SPH generator that allow… #409
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
95a9a2a
9bf18d3
7d90fe8
9a16603
aa3e67d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,15 +20,17 @@ namespace Spheral { | |
| template<typename Dimension> | ||
| CylinderSolidBoundary<Dimension>:: | ||
| CylinderSolidBoundary(const Vector& point, | ||
| const Vector& axis, | ||
| const Scalar radius, | ||
| const Scalar length): | ||
| const Vector& axis, | ||
| const Scalar radius, | ||
| const Scalar length, | ||
| const RotationType& angularVelocity): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If angularVelocity must be aligned with the axis this should be enforced somehow
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would you suggest for enforcement of that? I feel like keeping it a simple vector makes sense for conveying that it can't do complex rotation. But I'm open to ideas. |
||
| SolidBoundaryBase<Dimension>(), | ||
| mPoint(point), | ||
| mAxis(axis), | ||
| mRadius(radius), | ||
| mLength(length), | ||
| mVelocity(Vector::zero){ | ||
| mVelocity(Vector::zero), | ||
| mAngularVelocity(angularVelocity){ | ||
| } | ||
|
|
||
| template<typename Dimension> | ||
|
|
@@ -52,7 +54,15 @@ template<typename Dimension> | |
| typename Dimension::Vector | ||
| CylinderSolidBoundary<Dimension>:: | ||
| localVelocity(const Vector& position) const { | ||
| return mVelocity; | ||
| // Calculate the vector from the axis of rotation to the position | ||
| const auto p = position - mPoint; | ||
| const auto pnMag = p.dot(mAxis); | ||
| const auto pn = pnMag * mAxis; | ||
| const auto r = p - pn; // Radial vector from the axis to the position | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you remove the radial component here on the position, would that assume that mAngularVelocity and mAxis are aligned?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I assume that the angular velocity is always around the central axis |
||
|
|
||
| // Calculate the tangential velocity due to angular velocity | ||
| const auto tangentialVelocity = DEMDimension<Dimension>::cross(r,mAngularVelocity); | ||
| return mVelocity + tangentialVelocity; | ||
| } | ||
|
|
||
| template<typename Dimension> | ||
|
|
@@ -62,18 +72,25 @@ registerState(DataBase<Dimension>& dataBase, | |
| State<Dimension>& state) { | ||
| const auto boundaryKey = "CylinderSolidBoundary_" + std::to_string(std::abs(this->uniqueIndex())); | ||
| const auto pointKey = boundaryKey +"_point"; | ||
| const auto axisKey = boundaryKey +"_axis"; | ||
| const auto radiusKey = boundaryKey +"_radius"; | ||
| const auto lengthKey = boundaryKey +"_length"; | ||
| const auto velocityKey = boundaryKey +"_velocity"; | ||
| //const auto normalKey = boundaryKey +"_normal"; | ||
| const auto angularVelocityKey = boundaryKey + "_angularVelocity"; // Key for angular velocity | ||
| state.enroll(pointKey,mPoint); | ||
| state.enroll(pointKey,mVelocity); | ||
| //state.enroll(pointKey,mNormal); | ||
| state.enroll(axisKey,mAxis); | ||
| state.enroll(radiusKey,mRadius); | ||
| state.enroll(lengthKey,mLength); | ||
| state.enroll(velocityKey,mVelocity); | ||
| state.enroll(angularVelocityKey, mAngularVelocity); // Enroll angular velocity | ||
| } | ||
|
|
||
| template<typename Dimension> | ||
| void | ||
| CylinderSolidBoundary<Dimension>:: | ||
| update(const double multiplier, const double t, const double dt) { | ||
| mPoint += multiplier*mVelocity; | ||
| // If we want more complex rotation we'll need more complex logic here. | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
@@ -88,6 +105,7 @@ dumpState(FileIO& file, const string& pathName) const { | |
| file.write(mRadius, pathName + "/radius"); | ||
| file.write(mLength, pathName + "/length"); | ||
| file.write(mVelocity, pathName + "/velocity"); | ||
| file.write(mAngularVelocity, pathName + "/omega"); // Write angular velocity | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -100,6 +118,7 @@ restoreState(const FileIO& file, const string& pathName) { | |
| file.read(mRadius, pathName + "/radius"); | ||
| file.read(mLength, pathName + "/length"); | ||
| file.read(mVelocity, pathName + "/velocity"); | ||
| file.read(mAngularVelocity, pathName + "/omega"); // Read angular velocity | ||
| } | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.