DualSPHysics / DesignSPHysics

Module for FreeCAD intended to use with DualSPHysics fluid simulator.
Other
104 stars 38 forks source link

Normal Generation for mDBC in 3D from an .STL #167

Closed aepoc closed 9 months ago

aepoc commented 9 months ago

Hey There, I am having some trouble with large and complex geometry in 3D; Specifically with the normal generation tool. The geometry is a fairly complicated .stl with curved & sloped floors and walls, that was generated in Solidworks and when viewed in Paraview, the normals all seem to be pointing in the +X direction (There should be a significant amount of normals in +/-X, +/-Y and +/-Z). I have tried saving the stl in both binary and ascii formats with the same results. I noticed today that in Solidworks there is an option to "Do not translate STL output data to positive space" as I save the stl... I haven't tried it yet but perhaps this is why my normals are showing up in paraview as all +X direction.

In 2D this geometry was imported and if I set initials to true: Normals - Parts, I was able to get mDBC to work without losing particles through the geometry (even though the normals didn't look correct in Paraview either - all +X direction as with the 3D simulation). Anyway, "Normals - Parts" is not an option with 3D and none of the other options for Initials seem to work.

Is there a way to generate the normals manually or fix them somehow? I would really like to get this simulation running with mDBC (works fine with DBC, no DDT and no shifting - When I use Fourtakas Full and a shifting algorithm I lose some particles out of some corners of my geometry. I am using 2 boundary layers with the fourtakas full as my geometry is 30mm thick and my DP is .02m or 20mm... Should I modify the geometry to be a multiple of .02 so that I can add more layers or will the simulation just force # of layers regardless of geometry thickness and DP?

Any help/advice/direction/personal experience would be much appreciated!

Zahramht commented 9 months ago

Hey There, I am having some trouble with large and complex geometry in 3D; Specifically with the normal generation tool. The geometry is a fairly complicated .stl with curved & sloped floors and walls, that was generated in Solidworks and when viewed in Paraview, the normals all seem to be pointing in the +X direction (There should be a significant amount of normals in +/-X, +/-Y and +/-Z). I have tried saving the stl in both binary and ascii formats with the same results. I noticed today that in Solidworks there is an option to "Do not translate STL output data to positive space" as I save the stl... I haven't tried it yet but perhaps this is why my normals are showing up in paraview as all +X direction.

In 2D this geometry was imported and if I set initials to true: Normals - Parts, I was able to get mDBC to work without losing particles through the geometry (even though the normals didn't look correct in Paraview either - all +X direction as with the 3D simulation). Anyway, "Normals - Parts" is not an option with 3D and none of the other options for Initials seem to work.

Is there a way to generate the normals manually or fix them somehow? I would really like to get this simulation running with mDBC (works fine with DBC, no DDT and no shifting - When I use Fourtakas Full and a shifting algorithm I lose some particles out of some corners of my geometry. I am using 2 boundary layers with the fourtakas full as my geometry is 30mm thick and my DP is .02m or 20mm... Should I modify the geometry to be a multiple of .02 so that I can add more layers or will the simulation just force # of layers regardless of geometry thickness and DP?

Any help/advice/direction/personal experience would be much appreciated!

Hello Have you found a way to create normal vectors on Freecad? if so may I kindly ask for your contact information or if you have found any tutorial?

aepoc commented 9 months ago

_Hello Have you found a way to create normal vectors on Freecad? if so may I kindly ask for your contact information or if you have found any tutorial?_

Hey there, It seems as though the generation of normals for use with mDBC is only available in the full version of the code and not included in the FreeCad Macro. It looks as though Dualsphysics has created or updated some tools that should make it easier to generate normals for mDBC in their latest release (v5.2).

I have only done some examples this way but have yet to set up my own simulation without using the FreeCad macro. I'm hoping to use the xml generated from FreeCad's Gencase as a jumping off point. The plan is to edit the xml with bits and pieces from my Designsphysics case and Dualsphysics examples... I'll let you know if I have any luck running my simulation without the GUI...

Zahramht commented 9 months ago

Hello,

Thank you for your message. I am also trying to work with the XML file and modify it with my own set up which so far couldn't figure out the code and the reason behind each line.

I would appreciate your help through it if you have come up with any tutorial.

kindest regards

Zahra


From: aepoc @.***> Sent: Monday, December 18, 2023 9:47:25 PM To: DualSPHysics/DesignSPHysics Cc: Mohsenitakallu, Zahra; Comment Subject: Re: [DualSPHysics/DesignSPHysics] Normal Generation for mDBC in 3D from an .STL (Issue #167)

Hello Have you found a way to create normal vectors on Freecad? if so may I kindly ask for your contact information or if you have found any tutorial?

Hey there, It seems as though the generation of normals for use with mDBC is only available in the full version of the code and not included in the FreeCad Macro. It looks as though Dualsphysics has created or updated some tools that should make it easier to generate normals for mDBC in their latest release (v5.2).

I have only done some examples this way but have yet to set up my own simulation without using the FreeCad macro. I'm hoping to use the xml generated from FreeCad's Gencase as a jumping off point. The plan is to edit the xml with bits and pieces from Designsphysics and Dualsphysics examples... I'll let you know if I have any luck running my simulation without the GUI...

— Reply to this email directly, view it on GitHubhttps://github.com/DualSPHysics/DesignSPHysics/issues/167#issuecomment-1861600455, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BDBJTHCHWU2ZOITLWXZBQSLYKCTV3AVCNFSM6AAAAABAC4A2YOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRRGYYDANBVGU. You are receiving this because you commented.Message ID: @.***>

imestevez commented 9 months ago

The normal vector generation of mDBC for an external geometry in 3D is not available using DesignSPHysics yet. However, you can handle the normal vector generation directly unsing DualSPHysics and modifying the XML file. In the following link you can download the full package of the code, which includes several examples on using mDBC and guides: https://dual.sphysics.org/downloads/