Surface selection for inflatable structures

About the development of the FEM module/workbench.

Moderator: bernd

jedbrown
Posts: 11
Joined: Fri Mar 31, 2023 3:45 pm
Contact:

Surface selection for inflatable structures

Post by jedbrown »

Pneumatic actuators and inflatable structures have many logical surfaces on which to apply pressure boundary conditions. Previous forum posts indicate there is not a way of naming such surfaces when exporting STEP for offline meshing with Gmsh. This leads to a tedious manual process of selecting all the primitive surfaces on which a pressure boundary condition must be applied, be it in Gmsh directly or FEM workbench. I'm curious what would be practical to develop for this purpose. I'm envisioning an algorithm that starts with bounding curves (gaskets) and one interior point/surface, then traverses all neighboring surfaces that don't cross the bounding curves. I imagine it would be harder to implement filling a "volume" (implied by absence of structures) to find all surfaces, but that's closer to the physical process. Regardless of how those surfaces are found, they would be placed in a "Physical Surface" in Gmsh, which is written to the mesh file and available to solvers. Here's an example structure:

Image

We currently use or own solver (open source, scalable, good GPU support) and are considering adding support for it in FEM workbench. Finding a way to automate this aspect of pneumatic actuator analysis would make that a higher priority for us.
User avatar
NewJoker
Veteran
Posts: 2977
Joined: Sun Oct 11, 2020 7:49 pm

Re: Surface selection for inflatable structures

Post by NewJoker »

jedbrown wrote: Fri Mar 31, 2023 4:20 pm We currently use or own solver (open source, scalable, good GPU support) and are considering adding support for it in FEM workbench.
What is the name of this solver ?
jedbrown
Posts: 11
Joined: Fri Mar 31, 2023 3:45 pm
Contact:

Re: Surface selection for inflatable structures

Post by jedbrown »

NewJoker wrote: Fri Mar 31, 2023 5:17 pm What is the name of this solver ?
Ratel/. You can read about the methods in this paper, which tests scalability on hyperelastic analysis of Schwarz Primitive lattice structures with billions of DoFs.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Surface selection for inflatable structures

Post by saso »

jedbrown wrote: Fri Mar 31, 2023 4:20 pm I'm envisioning an algorithm that starts with bounding curves (gaskets) and one interior point/surface, then traverses all neighboring surfaces that don't cross the bounding curves. I imagine it would be harder to implement filling a "volume" (implied by absence of structures) to find all surfaces, but that's closer to the physical process.
You mean something like shown in the following video for Ansys Discovery, where first the faces at the openings are selected (inlet and outlet) and then a "seed" face that represents the interior, then all the internal faces are automatically selected and from it the internal volume is build... ? This selection technique is actually very common in many different applications, both in modeling and for further model preparation as in this case for CFD...

https://youtu.be/p9ny2Z-g6UY?list=PLtt6 ... qR18&t=322

Here you can see it also similar in Creo, they call it the "seed and boundary" selection method...

https://youtu.be/Tc9L0Uvl8xA?t=397
https://www.youtube.com/watch?v=az0XVscZHNM

I would not be surprised if someone has already made this work in one way or another also in FC :roll:

Here the discussion was about something similar but the code provided is not yet working for me as expected :?:
viewtopic.php?p=31933&hilit=seed+selection#p31933

Here is a modified version of that code that seems to give the expected "seed and boundary" functionality. First face one selects is the seed, all the next selected faces are the boundaries...

Code: Select all

# first face selected is the seed, all next selected faces are the boundaries
# WARNING! always review unknow scripts before running them, if you don't understand them, don't run them!

boundFace=[]
visitFace=[]
checkFace=[]
edge2Face={}

shape = FreeCADGui.Selection.getSelection()
subElement = FreeCADGui.Selection.getSelectionEx()
slen = len(subElement[0].SubElementNames)

for j in range(slen):
	if j == 0:
		seed = subElement[0].SubObjects[j]
	else:
		boundFace.append(subElement[0].SubObjects[j].hashCode())

for f in shape[0].Shape.Faces:
	for e in f.Edges:
		if e.hashCode() in edge2Face:
			edge2Face[e.hashCode()].append(f)
		else:
			edge2Face[e.hashCode()] = [f]

checkFace.append(seed)
visitFace.append(seed.hashCode())
while len(checkFace) > 0:
	face = checkFace.pop(0)
	for e in face.Edges:
		for f in edge2Face[e.hashCode()]:
			if f.hashCode() not in visitFace:
				if f.hashCode() not in boundFace:
					visitFace.append(f.hashCode())
					checkFace.append(f)

adjacency=[]
for f in shape[0].Shape.Faces:
	if f.hashCode() in visitFace:
		adjacency.append(f)

shell=Part.Shell(adjacency)
Part.show(shell)
Last edited by saso on Sun Apr 02, 2023 10:29 am, edited 4 times in total.
jedbrown
Posts: 11
Joined: Fri Mar 31, 2023 3:45 pm
Contact:

Re: Surface selection for inflatable structures

Post by jedbrown »

saso wrote: Sat Apr 01, 2023 10:06 am
You mean something like shown in the following video for Ansys Discovery, where first the faces at the openings are selected (inlet and outlet) and then a "seed" face that represents the interior and then all the internal faces are selected and from it the internal volume is build... ? This selection technique is actually very common in many different applications, both in modeling and for further model preparation as in this case for CFD...
Exactly (though I wasn't aware of that feature). The Creo version seems ambiguous for objects like a tube, where the surface could be on the inside or outside surface, thus a need have a seed.

Thanks for your helpful reply and for debugging the script. As you say this is quite common, should it be contributed upstream?
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Surface selection for inflatable structures

Post by saso »

jedbrown wrote: Sat Apr 01, 2023 3:31 pm Thanks for your helpful reply and for debugging the script. As you say this is quite common, should it be contributed upstream?
I have now updated my script above so that it should actually be useful. Before I did just a simple test that worked only on a special test case, now I have added the proper selection mechanism, so it can be used and tested on all shapes. First face one selects is the seed, all the next selected faces are the boundaries. It is actually still just a quick test script that should be improved further, but since I am not the best programmer, I will let that to others :)

About including it in the main code, I am sure this functionality can be usefully for many, as I said maybe it was actually already implemented somewhere, so it would be best that some of the main developers take this over and decide where and how it should be done.

seedselect.gif
seedselect.gif (508.39 KiB) Viewed 1518 times


Test file with the script...

PS: Embedded scripts can be copy/paste and run from the console or with eval(compile(FreeCAD.activeDocument().getObject("Text_document").Text, "<string>", "exec"))

And a general WARNING! Always review unknow scripts before running them, if you don't understand them, don't run them! :roll:

seed.FCStd
(12.09 KiB) Downloaded 35 times
Last edited by saso on Sun Apr 02, 2023 10:32 am, edited 3 times in total.
thschrader
Veteran
Posts: 3122
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Surface selection for inflatable structures

Post by thschrader »

saso wrote: Sat Apr 01, 2023 4:26 pm ... as I said maybe it was actually already implemented somewhere,...
FYI:
In the cfdof-wb (openfoam) there is an option to designate unselected faces by default.
The diagonals from the tower structure cant be selected with the cursor, but you can select
the strut and tick the box, so the rest of the lattice is assigned as boundary.
But before you must select the outer walls (inlet=blue, outlet, walls) of the channel,
otherwise they are assigned too.
cfdofWB_select_default_faces.JPG
cfdofWB_select_default_faces.JPG (79.11 KiB) Viewed 1454 times
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Surface selection for inflatable structures

Post by saso »

thschrader wrote: Sun Apr 02, 2023 8:02 am In the cfdof-wb (openfoam) there is an option to designate unselected faces by default.
Thanks, this seems to be a bit different, but it is also good to know about it yes. Is this lattice example your project or is it somewhere available as a demo project so I could check how this works...

jedbrown wrote: Sat Apr 01, 2023 3:31 pm ...
In the links to examples above we see a few a bit different implementations of this, one does only the selection (but other tools can then be used to make surfaces from the selection etc.); my example directly creates a surface (shell); in the ansys example a closed shell (volume) is created (interesting thing in this example is also that it seems to directly created the closed shell from several parts); some others also work on meshes,... What would be the preferred workflow for your needs?

---

I have also cleaned up a bit my code and tested it on a few a bit more complex models and it seems to work well...

Surface WB and Part WB tools can be used to close the holes of the extracted shell and make a closed shell (volume) or a solid out of it

shell.gif
shell.gif (691.16 KiB) Viewed 1197 times

Clipping planes can help in selecting more complex shapes with internal faces

cliping.gif
cliping.gif (805.85 KiB) Viewed 1207 times
Last edited by saso on Mon Apr 10, 2023 8:27 am, edited 1 time in total.
thschrader
Veteran
Posts: 3122
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Surface selection for inflatable structures

Post by thschrader »

saso wrote: Fri Apr 07, 2023 9:25 am Thanks, this seems to be a bit different, but it is also good to know about it yes. Is this lattice example your project or is it somewhere available as a demo project so I could check how this works...
...
Voila...
Schuss5_Mast_stripped.FCStd
(471.62 KiB) Downloaded 37 times
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Surface selection for inflatable structures

Post by saso »

thschrader wrote: Sat Apr 08, 2023 8:31 am Voila...
Thanks!
Post Reply