In earlier versions of pyelmer solver-specific keywords were used, for maintainability reasons these are not included any longer. There are two video tutorial on pyelmer (using deprecated solver-specific keywords):Ī presentation from the elmer webinar series (using these two examples) can be found here. t20) generate unstructured 1D, 2D and 3D. Note, that it may also be worth trying pygmsh, which is build on top of the rather complicated gmsh python API used in this example. Gmsh uses OpenCASCADE to import such files, including label and color information from STEP and IGES files (see e.g. An advanced object-oriente gmsh interface using the OpenCASCADE kernel, which facilitates the detection of the boundaries is used in crystal_growth_2d.py. add_physical_group, get_boundaries_in_box used in the example). Some utility functions for the geometry generation with gmsh are provided in pyelmer/gmsh.py (e.g. Advanced examplesĪdditional examples can be found on GitHub in the examples directory: An alternative version of this example, without using the pre-defined materials and solvers, can be found in the examples folder. The pre-defined materials and solvers can be found in the directory pyelmer/examples/2D_heat_transfer/data. # scan log for errors and warnings err, warn, stats = scan_logfile( sim_dir) # execute ElmerGrid & ElmerSolver execute. InitialCondition( sim, "T0", ) # 20 ☌ sim. load_solver( "ResultOutputSolver", sim)Įqn = elmer. run() # comment this line out if your system doesn't support the gmsh GUI gmsh. Ph_bottom = add_physical_group( 1,, "bottom") # detect boundaries line = get_boundaries_in_box( 0, 0, 0, 1, 0, 0, 2, water) Ph_water = add_physical_group( 2,, "water") # create connection between the two bodies factory. setNumber( "General.Terminal", 1)įactory = gmsh. post import scan_logfile from objectgmsh import add_physical_group, get_boundaries_in_box # set up working directory sim_dir = "./simdata" if not os. Import os import gmsh from pyelmer import elmer from pyelmer import execute from pyelmer. Alternatively, it is also possible to manually set the body-ids of the mesh created with the tool of your choice. Note, that you may also use the build-in "geo-style" kernel in python. The example uses the OpenCASCADE geometry kernel of gmsh. You may consider this as a very simple model of the heat distribution when boiling water in a pot: At the bottom a constant temperature of 80☌, and at the top a constant temperature of 20☌ is set. The domain consists of two quadratic bodies stacked on top of each other, the lower one is water and the upper one is air. The following example shows the setup of a simple heat transfer simulation. Bryan Bishop wrote: > Hey Christophe, > I was browsing some OpenCASCADE code today and found that > src/OpenGl/gl2ps.cxx was written by you. write_sif( './simulation_directory/') Examples # create material and add it to sim air = elmer. elmer as elmer # simulation object sim = elmer. open the step, mark boundary parts, save without meshing as STL -> stores boundary information if "Mesh.Import pyelmer.> Info : Done writing '/some/path/filename.step' > I am using the gmsh package from debian sid > Info : Gmsh version : 2.6. I understand that the OpenCascade STL mesh fulfills our requirement but it is not accessible as a standard Mesh in the mesh module as far as I know. geo : we never translate between CAD formats. What we need is a mesh that represents the surface of the part with a somewhat minimal number of elements. Generating the 3D mesh works really well but it takes time (obviously) and is inefficient for 3D rendering. We are trying to generate a preview/visualisation surface alongside the 3D mesh for complex curved parts.
0 Comments
Leave a Reply. |