Material

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Material

Post by keithsloan52 »

The FreeCAD implementation of Materials does not lend itself easy to dealing with GDML materials ( I have already asked for enhancements).

Now my understanding of FreeCAD implementation of Material is that it is aimed at FEM and Arch workbench.
That Objects don't have a Material, it is. implemented in the ViewProvider?

The challenges of GDML materials are
  • There are a largish list of predefined Materials for Geant4
  • Same for Geant4 Elements
  • GDML Material properties are a lot more complicated than those used by FEM and Arch
  • GDML file can define there own materials
So the GDML workbench uses it own Materials Objects and GDML Objects have an enumerate property that point to the GDMLMaterial.

Now some users find it confusing that FreeCAD offers various dialogs etc that refer/display FreeCAD Material.

My question would a more sophisticated ViewProvider be able to address this?

For example is there a way to control the Material Combo Box in this Dialog?
Image 08-09-2022 at 08.29.jpg
Image 08-09-2022 at 08.29.jpg (228.99 KiB) Viewed 833 times
As far as I know there is no way to under program control add/remove materials from the list displayed

The GDML workbench splits the Materials into Groups and the Dialogs currently look like
Image 08-09-2022 at 08.29 (1).jpg
Image 08-09-2022 at 08.29 (1).jpg (82.72 KiB) Viewed 833 times
Image 08-09-2022 at 08.30.jpg
Image 08-09-2022 at 08.30.jpg (84.21 KiB) Viewed 833 times
I know with FC 0.20 one can have enumerate properties with Groups but the display in the Properties Window is not great.
mitgnome
Posts: 1
Joined: Sun Mar 12, 2023 1:58 pm

Re: Material

Post by mitgnome »

I am trying to use Freecad with the GDML workbench to make a simple gdml model that I can import into Geant4.

I sort of have it working, but am stuck with trying to assign a material that is not in the G4 database to a GDMLBox

I would like to create the material Invar as the material for this GDMLBox, but there is no such thing such as G4_Invar.

Invar is simply 64% Fe + 36% Ni, both of these are G4Elements.

I am somewhat stuck on how to make this material and assign it the the GDMLBox

Any suggestions would be appreciated.

Rick
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: Material

Post by keithsloan52 »

mitgnome wrote: Wed Mar 15, 2023 10:40 pm I am trying to use Freecad with the GDML workbench to make a simple gdml model that I can import into Geant4.

I sort of have it working, but am stuck with trying to assign a material that is not in the G4 database to a GDMLBox

I would like to create the material Invar as the material for this GDMLBox, but there is no such thing such as G4_Invar.

Invar is simply 64% Fe + 36% Ni, both of these are G4Elements.

I am somewhat stuck on how to make this material and assign it the the GDMLBox

Any suggestions would be appreciated.

Rick
At the current time for Materials not in the G4 database you have to create a xml file with the material definition(s).

That is something like the following

Code: Select all

<xml>
  <materials>
  <material formula="Invar" name="Invar" >
        <D unit="g/cm3" value="0.95" />
        <fraction n="0.64" ref="G4_Fe"/>
        <fraction n="0.36" ref="G4_Ni"/>
</material>
</materials>
</xml>
Not sure what you g/cm3 value should be.
Save as Invar.xml ( Note: xml extension, not gdml)
You can then import the xml file to the current document

Alternatively if you have an existing gdml file with the material defined, you can load it,
select the Materials Group, the file export, choose xml as the file type, this will give you a xml file that you can import
into you FreeCAD doc ( Best to do this when you first create a new document with the GDML workbench active.
Post Reply