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

New shape: Quarterpipe #3960

Closed

Conversation

christophlohrmann
Copy link
Contributor

Description of changes:

  • introduce a new shape to smooth out the intersection between perpendicular surfaces

@KaiSzuttor
Copy link
Member

Are you sure that this is needed since the addition of Union shapes?

@christophlohrmann
Copy link
Contributor Author

I am pretty sure I cannot combine a rhomboid(direction = 1) with a cylinder(direction = -1) to achieve the desired effect. What I would get is a cylinder pipe with a box sticking into it.


A smoothed concave corner, which can be used to connect two walls or rhomboids in a smooth way.
The shape is constructed by removing a quarter cylinder of radius ``radius``
from a cuboid with side length ``radius``. It can be created via ::
Copy link
Member

Choose a reason for hiding this comment

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

i think you need to add a sketch to make this clear

@christophlohrmann
Copy link
Contributor Author

I realize that the direction parameter is not a good name, since it is used with a different meaning in other shapes. Any suggestions?

@jngrad
Copy link
Member

jngrad commented Oct 23, 2020

@christophlohrmann you'll have to merge the python branch into the PR to pass CI, all 3 runners are failing (#3895 (comment)).

@RudolfWeeber RudolfWeeber added this to the Espresso 4.2 milestone Oct 24, 2020
@KaiSzuttor
Copy link
Member

@RudolfWeeber

Comment on lines 48 to 50
while (pos_delta_phi > 2 * Utils::pi()) {
pos_delta_phi -= Utils::pi();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to do this? According to std::atan2 the return value should be between [-pi, pi] if nothing goes wrong. If it is necessary, is std::fmod what you are looking for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out, I thought the result would be in [0,2 pi]. I will remove the loop

Comment on lines 117 to 122
if (dist < 0. and dist_top_bottom < 0) {
if (Utils::abs(dist_top_bottom) < Utils::abs(dist)) {
dist = dist_top_bottom;
vec = upper_lower * dist * m_axis;
}
}
Copy link
Contributor

@reinaual reinaual Nov 5, 2020

Choose a reason for hiding this comment

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

This expression can be evaluated by two comparisons

Suggested change
if (dist < 0. and dist_top_bottom < 0) {
if (Utils::abs(dist_top_bottom) < Utils::abs(dist)) {
dist = dist_top_bottom;
vec = upper_lower * dist * m_axis;
}
}
if (dist_top_bottom < 0 and dist_top_bottom > dist) {
dist = dist_top_bottom;
vec = upper_lower * dist * m_axis;
}

@RudolfWeeber
Copy link
Contributor

If I understand the description correctly:

  • this should be called edge rather than corner, or even QuaterPipe or Quatercylinder
  • The direction parameter might be called long_axis
  • the axis parameter bisector (English for "Wineklhalbierende", according to Google)

@RudolfWeeber
Copy link
Contributor

Is a review of the actual code still needed, or did someone do that already?

@christophlohrmann
Copy link
Contributor Author

QuaterPipe would be my favourite. I still like axis because it has the same meaning as for the Cylinder shape. bisector seems indeed be better than direction

@reinaual
Copy link
Contributor

reinaual commented Nov 5, 2020

Is a review of the actual code still needed, or did someone do that already?

I have not reviewed it, i just pointed out the things which i found by just briefly looking at the code.

vec = pos_projected - to_point_1;
dist = vec.norm();
} else {
if (pos_delta_phi >= 0.5 * m_delta_phi) {
Copy link
Contributor

Choose a reason for hiding this comment

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

i guess this can be brought to the outer layer with an else if

@KaiSzuttor
Copy link
Member

Is a review of the actual code still needed, or did someone do that already?

I have not reviewed it, i just pointed out the things which i found by just briefly looking at the code.

i think you just qualified for a full review 👍🏻😜

* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <boost/algorithm/clamp.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

I see where this is coming from but you don't need this.

Suggested change
#include <boost/algorithm/clamp.hpp>

Comment on lines 476 to 477
``axis`` is the axis of the cylinder,
orthogonal to the curve of the pipe.
Copy link
Contributor

Choose a reason for hiding this comment

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

this linebreak looks odd to me because the line below is even longer

Suggested change
``axis`` is the axis of the cylinder,
orthogonal to the curve of the pipe.
``axis`` is the axis of the cylinder, orthogonal to the curve of the pipe.


auto upper_lower = rel_z > 0 ? 1 : -1;
// signed distance to the closer top/bottom wall
auto dist_cover = Utils::abs(rel_z) - 0.5 * m_height;
Copy link
Contributor

Choose a reason for hiding this comment

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

you could replace the Utils:abs call which you have also done in all cases below

Suggested change
auto dist_cover = Utils::abs(rel_z) - 0.5 * m_height;
auto dist_cover = upper_lower * rel_z - 0.5 * m_height;

Comment on lines 98 to 99
bool in_zone_4_or_5 =
Utils::abs(dist_plane_1) < Utils::abs(dist_plane_2);
Copy link
Contributor

Choose a reason for hiding this comment

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

we already know the sign from the else if above...

Suggested change
bool in_zone_4_or_5 =
Utils::abs(dist_plane_1) < Utils::abs(dist_plane_2);
bool in_zone_4_or_5 = dist_plane_1 > dist_plane_2;

vec = pos_projected - to_point_2;
dist = vec.norm();
} else {
if (pos_norm < m_radius) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this can also be brought one layer out as an else if

Copy link
Member

@KaiSzuttor KaiSzuttor left a comment

Choose a reason for hiding this comment

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

i don't understand the sketch at all :D

*/

#include <shapes/Quarterpipe.hpp>
#include <utils/Vector.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <utils/Vector.hpp>
#include <utils/Vector.hpp>
#include <utils/constants.hpp>

// Distinguish the Zones
if (dist_plane_1 >= 0. and dist_plane_2 >= 0.) {
// Zone 9
auto corner_point = std::sqrt(2.) * m_radius * m_orientation;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto corner_point = std::sqrt(2.) * m_radius * m_orientation;
auto corner_point = Utils::sqrt_2() * m_radius * m_orientation;

shape=espressomd.shapes.Quarterpipe(center=[25, 15, 15], axis=[1, 0, 0],
orientation=[0, 1, 1], radius=25,
height=30),
particle_type=0, penetrable=True)
Copy link
Member

Choose a reason for hiding this comment

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

  • I'm not sure it is a good idea to have two sharp edges in a shape interacting with a LJ liquid; wouldn't it be safer to have e.g. 4 quaterpipes to form a pipe, or a quaterpipe with its X,Y,Z edge lengths equal to the box lengths?
  • the rasterization doesn't draw dots on the shape top and bottom surfaces, giving the impression the shape is hollow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the shape becomes unsafe when side walls touch the periodic boundaries. Then Particles can enter the interaction region from the other side and pick up a lot of potential energy that propels them through the box. I will change the height though to hide the top/bottom

@christophlohrmann christophlohrmann changed the title New shape: Smooth corner New shape: Qarterpipe Nov 11, 2020
@jngrad jngrad changed the title New shape: Qarterpipe New shape: Quarterpipe Nov 11, 2020
@RudolfWeeber
Copy link
Contributor

What is the status? Is there a conclusion about the sketch?

@KaiSzuttor
Copy link
Member

What is the status? Is there a conclusion about the sketch?

review in progress

@KaiSzuttor KaiSzuttor self-assigned this Nov 12, 2020
@KaiSzuttor
Copy link
Member

decided to extend the existing HollowConicalFrustum by a orientation and central angle argument.

@RudolfWeeber
Copy link
Contributor

RudolfWeeber commented Nov 12, 2020 via email

@KaiSzuttor
Copy link
Member

the cone with 0 conicity is a finite cylinder. if you further allow to specify the central angle you end up with a quarter pipe

@RudolfWeeber
Copy link
Contributor

RudolfWeeber commented Nov 13, 2020 via email

@KaiSzuttor
Copy link
Member

KaiSzuttor commented Nov 13, 2020

it's just a segment of the existing shape, thats not too far fetched

@RudolfWeeber
Copy link
Contributor

See #4014

@KaiSzuttor
Copy link
Member

this will be implemented by recycling the HollowConicalFrustum shape

@KaiSzuttor KaiSzuttor closed this Mar 25, 2021
@jngrad jngrad removed this from the Espresso 4.2 milestone Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants