Using Blender to create solids for Gerris
From Gerris
(Difference between revisions)
| Revision as of 14:13, 14 March 2008 Prhlava (Talk | contribs) ← Previous diff |
Current revision GeordieMcBain (Talk | contribs) (→Transform the wing.gts - linked transform to its page and reformatted code automatically using two-space indent) |
||
| Line 1: | Line 1: | ||
| - | == Using Blender to create solids for Gerris == | ||
| This is a short introduction to using [http://www.blender.org Blender] for creation of solid bodies for inclusion in Gerris simulation. | This is a short introduction to using [http://www.blender.org Blender] for creation of solid bodies for inclusion in Gerris simulation. | ||
| === How to create a wing === | === How to create a wing === | ||
| ==== Start with an empty scene (camera and light is OK) ==== | ==== Start with an empty scene (camera and light is OK) ==== | ||
| - | [[Image:blender_1_001.jpeg|thumb|frame|Start]] | + | [[Image:blender_1_001.jpeg|Start]] |
| ==== Add Bezier curve ==== | ==== Add Bezier curve ==== | ||
| Line 11: | Line 10: | ||
| </pre> | </pre> | ||
| - | [[Image:blender_1_002.jpeg|thumb]] | + | [[Image:blender_1_002.jpeg]] |
| ==== Close the curve ==== | ==== Close the curve ==== | ||
| Line 19: | Line 18: | ||
| </pre> | </pre> | ||
| - | [[Image:blender_1_003.jpeg|thumb]] | + | [[Image:blender_1_003.jpeg]] |
| ==== Subdivide it ==== | ==== Subdivide it ==== | ||
| Line 27: | Line 26: | ||
| </pre> | </pre> | ||
| - | [[Image:blender_1_004.jpeg|thumb]] | + | [[Image:blender_1_004.jpeg]] |
| ==== Disable the Back and Front for the curve ==== | ==== Disable the Back and Front for the curve ==== | ||
| Line 39: | Line 38: | ||
| ==== Convert the curve to mesh ==== | ==== Convert the curve to mesh ==== | ||
| - | Switch to object mode - <TAB>. | + | <pre> |
| + | <TAB> - Switch to object mode | ||
| + | </pre> | ||
| (object) -> convert object type: Mesh | (object) -> convert object type: Mesh | ||
| - | [[Image:blender_1_005.jpeg|thumb]] | + | [[Image:blender_1_005.jpeg]] |
| - | [[Image:blender_1_006.jpeg|thumb]] | + | [[Image:blender_1_006.jpeg]] |
| ==== Close the top and bottom parts of the mesh ==== | ==== Close the top and bottom parts of the mesh ==== | ||
| - | |||
| - | Switch to the side view | ||
| <pre> | <pre> | ||
| + | numpad<3> - switch to the side view | ||
| <Tab> | <Tab> | ||
| <B> - border select (select the top nodes) | <B> - border select (select the top nodes) | ||
| Line 58: | Line 58: | ||
| (mesh) -> faces -> fill | (mesh) -> faces -> fill | ||
| - | [[Image:blender_1_007.jpeg|thumb]] | + | [[Image:blender_1_007.jpeg]] |
| <pre> | <pre> | ||
| Line 65: | Line 65: | ||
| </pre> | </pre> | ||
| - | [[Image:blender_1_008.jpeg|thumb]] | + | (mesh) -> faces -> fill |
| + | |||
| + | [[Image:blender_1_008.jpeg]] | ||
| ==== Recalculate normals ==== | ==== Recalculate normals ==== | ||
| Line 78: | Line 80: | ||
| (mesh) -> normals -> recalculate inside | (mesh) -> normals -> recalculate inside | ||
| - | [[Image:blender_1_009.jpeg|thumb|frame|The result]] | + | [[Image:blender_1_009.jpeg|The result]] |
| ==== Export the mesh in STL format ==== | ==== Export the mesh in STL format ==== | ||
| Line 95: | Line 97: | ||
| ==== Convert from .stl to .gts ==== | ==== Convert from .stl to .gts ==== | ||
| - | <pre> | + | [[stl2gts]] < wing.stl > wing.gts |
| - | stl2gts < wing.stl > wing.gts | + | |
| - | </pre> | + | |
| ==== Transform the wing.gts ==== | ==== Transform the wing.gts ==== | ||
| - | <pre> | + | [[transform]] -o < wing.gts | transform -t 1 > blender_1.gts |
| - | transform -o < wing.gts | transform -t 1 > blender_1.gts | + | |
| - | </pre> | + | |
| The first transform normalizes the wing, the 2nd one moves it to 2nd cell along X axis. The resulting file "blender_1.gts" is ready for use in Gerris simulation. | The first transform normalizes the wing, the 2nd one moves it to 2nd cell along X axis. The resulting file "blender_1.gts" is ready for use in Gerris simulation. | ||
| === Example simulation === | === Example simulation === | ||
| - | [[media:blender_1.gfs|gfs]] | ||
| - | [[media:blender_1.gfv|gfv]] | ||
| - | [[media:blender_1.gts|gts]] | ||
| - | [[Image:blender_1_simulation.jpeg|thumb|frame|The result]] | + | (download links below) |
| + | |||
| + | <pre> | ||
| + | 4 3 GfsSimulation GfsBox GfsGEdge {} { | ||
| + | Time { end = 100 } | ||
| + | Solid blender_1.gts | ||
| + | Refine 6 | ||
| + | RefineSolid 8 | ||
| + | Init {} { U = 1 } | ||
| + | OutputTime { istep = 10 } stderr | ||
| + | |||
| + | OutputSimulation { istep = 4 } stdout | ||
| + | |||
| + | # EventScript { istep = 4 } { echo "Save stdout { width = 1024 height = 768 }" } | ||
| + | |||
| + | } | ||
| + | GfsBox { left = BoundaryInflowConstant 1 top = BoundaryOutflow bottom = BoundaryOutflow } | ||
| + | GfsBox { top = BoundaryOutflow bottom = BoundaryOutflow } | ||
| + | GfsBox { top = BoundaryOutflow bottom = BoundaryOutflow } | ||
| + | GfsBox { right = BoundaryOutflow top = BoundaryOutflow bottom = BoundaryOutflow } | ||
| + | 1 2 right | ||
| + | 2 3 right | ||
| + | 3 4 right | ||
| + | </pre> | ||
| + | |||
| + | Simulation files (use "right click" + "save as" to download): | ||
| + | |||
| + | [http://www.dearm.co.uk/blender/blender_1.gfs gfs] | ||
| + | [http://www.dearm.co.uk/blender/blender_1.gfv gfv] | ||
| + | [http://www.dearm.co.uk/blender/blender_1.gts gts] | ||
| + | |||
| + | To run the simulation: | ||
| + | |||
| + | <pre> | ||
| + | gerris2D blender_1.gfs | gfsview2D blender_1.gfv | ||
| + | </pre> | ||
| + | |||
| + | [[Image:blender_1_simulation.jpeg|frame|The result]] | ||
Current revision
This is a short introduction to using Blender for creation of solid bodies for inclusion in Gerris simulation.
[edit]
How to create a wing
[edit]
Start with an empty scene (camera and light is OK)
[edit]
Add Bezier curve
<space> -> add -> curve -> bezier curve
[edit]
Close the curve
<TAB> <C>
[edit]
Subdivide it
(curve) -> segments -> subdivide
[edit]
Disable the Back and Front for the curve
De-select "Back" and "Front" (this is done in bottom window in blender)
[edit]
Extrude the curve
Set the extrude level to 1
[edit]
Convert the curve to mesh
<TAB> - Switch to object mode
(object) -> convert object type: Mesh
[edit]
Close the top and bottom parts of the mesh
numpad<3> - switch to the side view <Tab> <B> - border select (select the top nodes)
(mesh) -> faces -> fill
<A> <B> - border select (select the bottom nodes)
(mesh) -> faces -> fill
[edit]
Recalculate normals
<A> <A>
Now you should have all mesh nodes selected.
(mesh) -> normals -> recalculate inside
[edit]
Export the mesh in STL format
<TAB> - go to object mode
Select the wing...
(File) -> Export -> STL
Save the file as wing.stl
[edit]
STL to GTS
[edit]
Convert from .stl to .gts
stl2gts < wing.stl > wing.gts
[edit]
Transform the wing.gts
transform -o < wing.gts | transform -t 1 > blender_1.gts
The first transform normalizes the wing, the 2nd one moves it to 2nd cell along X axis. The resulting file "blender_1.gts" is ready for use in Gerris simulation.
[edit]
Example simulation
(download links below)
4 3 GfsSimulation GfsBox GfsGEdge {} {
Time { end = 100 }
Solid blender_1.gts
Refine 6
RefineSolid 8
Init {} { U = 1 }
OutputTime { istep = 10 } stderr
OutputSimulation { istep = 4 } stdout
# EventScript { istep = 4 } { echo "Save stdout { width = 1024 height = 768 }" }
}
GfsBox { left = BoundaryInflowConstant 1 top = BoundaryOutflow bottom = BoundaryOutflow }
GfsBox { top = BoundaryOutflow bottom = BoundaryOutflow }
GfsBox { top = BoundaryOutflow bottom = BoundaryOutflow }
GfsBox { right = BoundaryOutflow top = BoundaryOutflow bottom = BoundaryOutflow }
1 2 right
2 3 right
3 4 right
Simulation files (use "right click" + "save as" to download):
To run the simulation:
gerris2D blender_1.gfs | gfsview2D blender_1.gfv











