fusion-energy / cad_to_dagmc

Convert CAD geometry (STP files) or Cadquery assemblies to DAGMC h5m files
MIT License
19 stars 5 forks source link

Volume of Meshed object changed from CAD model #44

Open Adambar24 opened 1 year ago

Adambar24 commented 1 year ago

Hi All,

I have created a h5m model using the cad_to_dagmc conversion. It uses the DEMO model found in paramak. The layers of the blanket have been sliced into thin segments for better resolution of the neutronics in OpenMC. I have found a change in volume of the layers before and after the mesh that is up to 20% difference in some of the layers. I used CAD to give me the volumes of the objects before hand. I then converted the files to h5m and used OpenMC's stochastic volumes finder and found large differences between the two. There seems to be some issue when creating the mesh of the object. Any help or work around would be helpful. Below is the difference between the two measurements for each layer

OpenMC | FreeCAD | Percentage Diff

8832000 | 7985387 | 90.4142549818841 18238000 | 18305705 | 100.37123039807 20200000 | 18745010 | 92.7970792079208 19248000 | 19182706 | 99.6607751454697 21572000 | 19619631 | 90.9495225292045 24232000 | 20056649 | 82.7692679102014 24184000 | 20494116 | 84.7424578233543 23466000 | 20931891 | 89.2009332651496 23490000 | 21370217 | 90.9758067262665 25524000 | 21809467 | 85.446900955963 24600000 | 22249448 | 90.4449105691057 25080000 | 22690541 | 90.4726515151515 24934000 | 23133006 | 92.7769551616267 22920000 | 23577108 | 102.866963350785 22330000 | 24023068 | 107.582033139275 22372000 | 24470972 | 109.38213838727 22996000 | 24921086 | 108.371395025222

shimwell commented 1 year ago

Thanks for posting, I wonder if the min_mesh_size and max_mesh_size can be made smaller to get a better mesh, I think they default to 1 and 10 but perhaps try 0.1 and 0.2

Adambar24 commented 1 year ago

Thanks Jonathan, I have tired this method out and confusingly got a larger deviation from the expected. There are no errors but in OpenMC the error was not at the magnitude to make a difference to the results. The previous results were completed with a max mesh size of 6 and the newer results with a max mesh size of 2. Both with a minimum of 1.

OpenMC FreeCAD Percentage Diff
7952200 7985387 100.417331053042
11224200 18305705 163.091400723437
14287200 18745010 131.201425051795
12628400 19182706 151.901317664946
14636200 19619631 134.04866700373
17770200 20056649 112.866760081485
17750800 20494116 115.454604862879
17316400 20931891 120.87899909912
16977600 21370217 125.873015031571
18126200 21809467 120.320127770851
16726200 22249448 133.021535076706
16534400 22690541 137.232321705051
14691600 23133006 157.457363391326
13121400 23577108 179.684393433628
12141400 24023068 197.860773881101
11732400 24470972 208.576011728206
11853800 24921086 210.2371054008

I have been attempting some workarounds which include: Creating each part individually -> Struggling to input multiple h5m files into OpenMC with dagmc_universe Converting to a single stp then converting to h5m -> Currently on going Using Cubit and the dagmc plugin -> I cannot seem to get cubit to load the plugin it might be some compatibility issue , i am unsure

I think if I could get the cubit plugin working this would be the most robust

shimwell commented 5 months ago

cubit now ships with dagmc included and no longer needs the plugin installing