Last active
August 29, 2025 12:52
-
-
Save jginternational/87352ef38a6759726488c3c1a4935430 to your computer and use it in GitHub Desktop.
Create volume in STL - Artheria with 1 inlet and 2 outlets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proc CreateCovers { } { | |
| # Get all the layer lines based on the higher entity | |
| set all_lines [GiD_Geometry list -layer Fluid -higherentity 1 line] | |
| # Group by Z coordinate | |
| array set groups {} | |
| foreach l $all_lines { | |
| lassign [GiD_Geometry get line $l] types layer n1 n2 | |
| set zlist {} | |
| lassign [GiD_Geometry get point $n1] layer x y z | |
| lappend zlist $z | |
| lassign [GiD_Geometry get point $n2] layer x y z | |
| lappend zlist $z | |
| set zmean [expr {([lindex $zlist 0] + [lindex $zlist 1]) / 2.0}] | |
| set key [format "%.6f" $zmean] | |
| lappend groups($key) $l | |
| } | |
| # Sort keys decreasing so the first will be the inlet | |
| set zkeys [lsort -real -decreasing [array names groups]] | |
| # Create surfaces and assign to groups | |
| set idx 0 | |
| foreach z $zkeys { | |
| set lines $groups($z) | |
| if {[llength $lines] >= 3} { | |
| # Create surface | |
| set new_surface [GidUtils::CreateSurfaceFromBoundaryLines $lines] | |
| if {$idx == 0} { | |
| set name "Inlet" | |
| } else { | |
| set name "Outlet_[expr $idx -1]" | |
| } | |
| GiD_Groups create $name | |
| GiD_EntitiesGroups assign $name surfaces $new_surface | |
| incr idx | |
| } | |
| } | |
| } | |
| proc CrearVolume { } { | |
| set lines [list ] | |
| foreach group_name [list Skin Inlet Outlet_0 Outlet_1] { | |
| lappend lines {*}[GiD_EntitiesGroups get $group_name surfaces] | |
| } | |
| set volume [GidUtils::CreateVolumeFromBoundarySurfaces $lines] | |
| GiD_Groups create Fluid | |
| GiD_EntitiesGroups assign Fluid volumes $volume | |
| } | |
| # assume that the user has loaded the stl into GiD | |
| # GiD_Process MEscape Files STLRead $stl_path escape escape | |
| # assume that the user has created the geometry surfaces from the stl mesh | |
| # GiD_Process Mescape Geometry Edit ReConstruction OneSurfForEachElement Layer:Fluid escape |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment