CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[Gmsh] Prism model in GMSH

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 24, 2013, 14:02
Smile Prism model in GMSH
  #1
New Member
 
Goth ydamil
Join Date: Mar 2013
Posts: 13
Rep Power: 13
djamel is on a distinguished road
Hello everybody this is a 3D model in GMSH.
may be it helps you.
Attached Files
File Type: txt prism.txt (665 Bytes, 19 views)
djamel is offline   Reply With Quote

Old   June 4, 2023, 20:08
Default
  #2
New Member
 
Nick C Howlett
Join Date: Oct 2021
Posts: 3
Rep Power: 4
nhowlett is on a distinguished road
Following on from djamel, below is code to create prisms of 1 element depth (for 2D simulations in OpenFoam, for example).


Code:
# Rectangular domain with boundary condition for a jet inlet. Rectangle is 
# extruded 1 element deep (for compatibility with OpenFOAM), creating 
# prisms.
#
# Successfully executed using Gmsh version 4.11.1
#
# prerequisites
import gmsh
import sys
gmsh.initialize()
gmsh.clear()

# modify
name = "mesh2dJetWithoutBall"
meshSize = 1
length = 350
height = 20

gmsh.model.add(name)

# create surface (bounding & mouth as separate entities)
gmsh.model.geo.addPoint(0,         -(height / 2),     0, meshSize, 1)
gmsh.model.geo.addPoint(length, -(height / 2),     0, meshSize, 2)
gmsh.model.geo.addPoint(length,  (height / 2),     0, meshSize, 3)
gmsh.model.geo.addPoint(0,       (height / 2),  0, meshSize, 4)
gmsh.model.geo.addPoint(0,                      1,  0, meshSize, 5)
gmsh.model.geo.addPoint(0,                      -1,     0, meshSize, 6)

gmsh.model.geo.addLine(1, 2, 1)
gmsh.model.geo.addLine(2, 3, 2)
gmsh.model.geo.addLine(3, 4, 3)
gmsh.model.geo.addLine(4, 5, 4)
gmsh.model.geo.addLine(5, 6, 5)
gmsh.model.geo.addLine(6, 1, 6)

gmsh.model.geo.addCurveLoop([1, 2, 3, 4, 5, 6], 1)
gmsh.model.geo.addPlaneSurface([1], 1)
gmsh.model.geo.synchronize()

# define slice (volume) geometry and mesh of slice dimension (depth)
dz = 1
dataExtrusion = gmsh.model.geo.extrude(
  [(2, 1)], 0, 0, dz, [0, 1], [0, 1.0], recombine = True)
gmsh.model.geo.synchronize()

# create BC's
gmsh.model.addPhysicalGroup(2, [33], name = "mouth")
gmsh.model.addPhysicalGroup(2, [17, 21, 25, 29, 37], name = "atmos")
gmsh.model.addPhysicalGroup(2, [1, 38], name = "slice")

# mesh then save
gmsh.model.mesh.generate(3)
gmsh.write(name + ".msh")

# view in GUI
gmsh.fltk.run()
gmsh.finalize()
nhowlett is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coupling RPI wall boiling model with population balance model in Fluent softice2006 Fluent Multiphase 1 April 19, 2023 02:09
coalChemistryFoam: "Foam::error::printStack(Foam::Ostream&) at ??:?" musabai OpenFOAM Running, Solving & CFD 2 February 20, 2015 14:07
Is it possible to model natural convection in a 2D horizontal model in fluent caitoc FLUENT 1 May 5, 2014 13:32
Problems bout CFD model of biomass gasification, Downdraft gasifier wanglong FLUENT 2 November 25, 2009 23:27
Advanced Turbulence Modeling in Fluent, Realizable k-epsilon Model Jonas Larsson FLUENT 5 March 13, 2000 03:27


All times are GMT -4. The time now is 08:50.