Open gglamzn opened 1 month ago
Thanks for raising the issue and adding so much detail.
I wonder if it is possible to include the CAD file in the attached zip file.
One thing I would check is the units, often cad produces geometry in mm and openmc/dagmc assume accept units in cm so that might be the issue. I think there is a scaling option on cad-to-dagmc so that is easy to fix.
Hello,
I have a zip file containing the codes as well as the CAD geometry in .step format. For your information, the geometry is based on a square with dimensions of 14x14 meters. It consists of three volumes: the two walls and the floor, all made of different varieties of concrete.
Have a good day, Best regards
I loaded the step file and I see the coordinates of the inner square are much bigger than the plotted region
the mouse icon shows this area is 1500mm which openmc / dagmc will assume is in cm so it will be 1500cm.
perhaps you can scale your gmesh or we can add a scaling argument to the MeshToDagmc class
so the mesh would need scaling to put it into the plotted region
Hello,
Indeed, the point you're showing me is at the correct coordinates, at least the ones I intended on the CAD model when I did the model . I understand the issue you're pointing out. How can I modify the functions to incorporate the scaling you suggest?
It's true that when I created the geometry in the CAD software, I used a scale in meters. Perhaps for future modeling, I should use a scale in centimeters to match the base scale used in OpenMC/DAGMC ?
Have a nice day.
Best regards,
Hello,
I am sorry to bother you again, but despite your advice, I have not been able to solve my problem.
I did not find the scaling button on Gmsh. I am having difficulty understanding how I can implement a scaling argument in the MeshToDagmc class function. Could you please provide me with some assistance?
Best regards.
The values of the coordiates could be divided by a scaling factor
Hi ,
I get that but how could I get acess to the step file coordinates?
As your scripts pass in a gmsh mesh file then I think you might want to scale the mesh. I would recommend looking in the gmsh docs for a suitable function. Perhaps Mesh.MeshSizeFactor
does the job. If you find a way to do it in gmsh then we can add an argument to the MeshToDagmc
class that makes use of the gmsh capability.
Hello,
Since the last time, I searched the gmsh library for a function to scale the geometry. Unfortunately, I got a bit lost in the documentation and decided to proceed differently.
I found a method that seems to work:
I create my CAD geometry in centimeters, with a scale factor of 1/10. When I import the geometry into gmsh, a factor of 10 seems to be applied to the geometry.
Since these two factors cancel each other out, I then convert the geometry to .h5m format.
I then verify the consistency of the distances with openmc_plot, and with this method, it seems that I achieve the desired importation with the correct dimensions. I'm able to conduct simulations that more closely resemble what I should expect.
I have two questions:
Is this method, despite being somewhat unconventional but seemingly functional, actually a mirage that I have misinterpreted? How could I create a box around my geometry and fill all the empty space, including the space between the walls of the CAD geometry, with air if possible?
I have attached several files within this message: the different basement files at various stages of conversion, the functions to convert to .h5m and display the geometry, and some images. docs.zip
Best regards
Is this method, despite being somewhat unconventional but seemingly functional, actually a mirage that I have misinterpreted?
units in CAD can be a bit of a mess, the often (but not always default to mm) sometimes not included in the step file, sometimes they are. Most DAGMC workflows ignore the units in CAD files and just assume the numbers provided are in cm. So I guess what you have is the normal way of going from CAD to neutronics.
How could I create a box around my geometry and fill all the empty space, including the space between the walls of the CAD geometry, with air if possible?
I think you want the implicit material option. DAGMC adds a void material to any space not covered by cad geometry. this is called an implicit void. The material assignment can be changed and you can ask DAGMC to use air instead of a void.
take a peak at this section of code https://github.com/fusion-energy/cad_to_dagmc/blob/5cd38e4ddb9c1db86192bace38629a341c41d8cb/src/cad_to_dagmc/core.py#L337-L341
see it has a argument called implicit_complement_material_tag
. you would assign that to a string (perhaps 'air') and make a material named 'air' on the openmc side and that should work :crossed_fingers:
Hi , I want to thank you for your precious insinghts throughout all the problems I faced .
I've been able to fill with air all the empty space as the png that I attached to this mail.
Best regards. cad_filled.zip
OneDrive_1_16-07-2024.zip](https://github.com/user-attachments/files/16256217/OneDrive_1_16-07-2024.zip)` Hello,
I wanted to perform a DAGMC simulation of a geometry as follows:
It is a very simple geometry with two wall thicknesses and a floor, all made of concrete.
Here is how I proceed to convert and simulate the geometry (.step file) created in a CAD software:
First, I use GMSH to create the mesh, and then I use Python:
First function:
convert_file.py
Conversion from .msh to .h5m, applying the different materials to the 3 volumes (WALL1, WALL2, floor).
Second function:
gmsh_sim.py
CAD Geometry Simulation Script
The goal of my import is to have a box surrounding my CAD geometry by about 1 meter on all sides. I also want to fill the box with air, knowing that the concrete materials have already been assigned to the volumes.
I perform my simulation and I do not get anything that resembles what might be expected. There is no attenuation in the flux at the walls.
In my opinion, the function that collects data from the output file tallies.out is correct as I have used it in other simulations and it displayed expected results. I think that the way I coded the geometry import in gmsh_sim.py and the setup of the cells and universes might be incorrect, and this could be the source of the wrong results . Finally , to compare , I added a plot of openmc simulation with an openmc-made geometry wich is similar to the cad model so you can see what I would want to except orignally from the malfunctionnin simulation
Could you please help me?
Have a good day.
Best regards.