Geometry¶
Material manager¶
GRAS provides a material manager that allows the user to define arbitrary materials in run-time. This manager is a copy of the MULASSIS material manager and so it provides the same functionalty (please refer to the MULASSIS documentation 11).
A material can be defined both,
by its chemical formula and density
from the NIST list of materials available in Geant4 (see Geant4 ‘User’s Guide: For Application Developers’, Appendix 8)
Once this material is defined, it is available for the different geometry builders described below (particularly, the materials will be available for MULASSIS and Gmsh MSH geometries).
Examples of material definition
/geometry/material/add LiquidWater H2-0 1.0 /geometry/material/AddNIST G4_KEVLAR
Geometry formats¶
The geometry can be defined in several formats:
a GDML text file
a set of macro scripting commands defining a MULASSIS-type layered geometry
a set of macro scripting commands defining a GEMAT-type layered geometry
a Gmsh MSH file (ASCII) containing a tetrahedral mesh
a C++ class
additionally, the geometry can be also defined by the combinantion of some of the above options, loading one or more files as geometry parts and placing/rotating them arbitrarily. Currently only GDML and Gmsh MSH geometries are supported.
The input mode for the geometry model type is selectable via UI commands at run time. If no type is specified, the C++ geometry construction class is used.
Script example:
/gras/geometry/type [gdml | mulassis | gemat | gmsh | multi]
GDML¶
The standard input format for the geometry is via an external file, whose format is defined by the Geometry Description Mark-up Language (GDML) 11. The input file name in which the geometry model is stored is also selectable at run time. A geometry “setup” has to be specified, as in principle a single GDML file can contain more than one set-up. The setup name is specified in the GDML file, at the end. For more information on the GDML format, please refer to the GDML documentation.
After the GDML reading, Geant4 by default strips each name from any suffix starting with 0x (such as 0x12345678). Such a suffix is often added by automated geometry format translators in order to guarantee the uniqueness of each object in the GDML XML file. One can use the UI command ‘’/gdml/setNameStripFlag [true/false]’’ to disable such stripping feature and retain the suffix, which can be useful for example for geometry debugging purposes.
Script example:
/gras/geometry/type gdml /gdml/file satellite.gdml /gdml/setup Default /gdml/setNameStripFlag false
MULASSIS¶
The geometry can be specified in MULASSIS format. A layered geometry can be defined using the MULASSIS script commands. The layered geometry can have a slab or sphere or cylinder shape.
/geometry/layer/shape slab | sphere | cylinder
Script example:
/gras/geometry/type mulassis /geometry/layer/delete 0 /geometry/material/add Cadmium_Telluride Cd-Te 5.850E+00 /geometry/layer/shape slab /geometry/layer/add 0 Aluminium 2 4.000E+00 mm /geometry/layer/add 1 Cadmium_Telluride 8 0.300E+00 mm /geometry/layer/list /geometry/update
With the update
command the MULASSIS geometry automatically sets the
position and direction of the source based on geometry shape and total
layer thickness. The GPS centre position of the source is set at the
edge of the most external layer, aimed towards the layers.
The MULASSIS geometry case uses a point source, but mimics a surface (thanks to symmetry considerations). A dedicated algorithm guarantees that the (mimicked) source surface shape and size are taken into account for the global normalisation factor:
SLAB: source square surface area equal to the area of the slabs, with (full) side length 100x the total thickness of all layers;
SPHERE: full sphere surface, with radius equal to the MULASSIS position of the GPS vertex, at 1.001 x the total layer thickness;
CYLINDER: full cylinder side surface, with radius equal to the MULASSIS position of the GPS vertex, at 1.001 x the total layer thickness.
A more complete example is provided in the dedicated test available at tests/geometry/mulassis.
For more information on the MULASSIS material and geometry input format, please refer to the MULASSIS documentation 11.
GEMAT¶
The geometry can be specified in GEMAT format. A layered slab geometry with a user defined transverse dimension can be defined using the GEMAT script commands. Inside the layers, volumes of various shapes can be inserted.
Script example:
/gras/geometry/type gemat /geometry/layer/xysize 5.60 um # # Define the layers # /geometry/layer/delete 0 /geometry/layer/add 0 Silicon 2 4.360E+00 um /geometry/layer/list # # Define the depletion volumes # /geometry/SV/delete 0 /geometry/SV/add/boxshell 1 -1 -1.3 1.5 1.0 -0.5 -0.5 0.5 0.25 Silicon 10 um /geometry/SV/add/boxshell 1 1 1.3 1.0 0.5 0.5 0.5 0.5 0.25 Silicon 4 um /geometry/SV/list # /geometry/update
A complete example is provided in the dedicated test available at tests/geometry/gemat
For more information on the GEMAT material and geometry input format, please refer to the GEMAT documentation.
GMSH - MSH¶
The user can input a geometry model described in Gmsh MSH format. This format is the native meshing output from Gmsh tool . According the developers:
Gmsh is a 3D finite element grid generator with a build-in CAD engine and post-processor. Its design goal is to provide a fast, light and user-friendly meshing tool with parametric input and advanced visualization capabilities.
GRAS supports the loading of Gmsh 3D tetrahedral meshes defined in plain-text ASCII format. Datailed information of this format cam be found in the Gmsh documentation.
Options:¶
Material information: As Gmsh MSH format does not include any information about the material properties of the mesh elements, the user can explicitly assign them a Geant4 material. The material needs either to exist in the Geant4 NIST list of materials, or to have been previously defined using GRAS material manager UI commands. In the case no material is specifed, vacuum will be assigned to all mesh elements by default.
Length unit: Coordinates/points in Gmsh MSH are dimensionless. The user can specify a Geant4 length unit to be applied to all mesh elements. If no unit is specified, it is considered that the mesh dimensions are defined in mm.
Transformations: Translation and rotations of the mesh as a whole are possible.
Script example
/gras/geometry/type gmsh /gmsh/file myGeometry.gmsh /gmsh/lengthUnit mm /gmsh/material Aluminium /gmsh/translate 10 0 15 mm /gmsh/rotateX 45 deg
C++¶
The user can provide a C++ class with the geometry description (as in standard Geant4 applications). For help on the definition of the geometry in C++, please consult the Geant4 web pages. This mode requires the recompilation of the GRAS tool.
In case no specific geometry type is selected, and the user did not recompile GRAS with his/her own C++ geometry, GRAS provides a simple standard geometry model (hard coded in C++), loaded as a default. This model can be used for test purposes, and is available also when the GDML libraries are not available for the complete GRAS installation.
Multi : Multiple Geometries in a Single Mother Mass World¶
The user can specify a geometry description by combining some of the above geometry format possibilities. Currently GRAS only supports the combination of one or more GDML and/or Gmsh MSH geometries.
The user can add an unlimited number of geometries, either GDML or Gmsh MSH, and place/rotate them arbitrarily.
Note that the user is the responsible of possible overlappings between the different loaded geometries.
/gras/geometry/type multi /multi/addGDML Part01 /multi/gdml/Part01/file MyGeometry01.gdml /multi/gdml/Part01/translate 20. 0. 0. mm /multi/gdml/Part01/rotateY 90 deg /multi/addGDML Part02 /multi/gdml/Part02/file MyGeometry02.gdml /multi/gdml/Part02/translate 0. 10. 0. mm /multi/gdml/Part02/rotateZ 45 deg [...] /multi/addGMSH Part03 /multi/gmsh/Part03/file MyGmshGeom.msh /multi/gmsh/Part03/lengthUnit mm /multi/gmsh/Part03/material Aluminium /multi/gmsh/Part03/translate 0. 0. 0. mm /multi/gmsh/Part03/rotateX 90 deg [...]
By default the World solid is defined as a G4Box which has dimensions to encompass all the individual GDML and Gmsh volumes after placement with an added margin of 10% in the X, Y and Z directions. The centre of the box is the origin of the coordinate system used to define GDML/Gmsh placements. The user may instead request a World volume which is spherical (again centred at the origin of the coordinate system) using the command:
/multi/setWorldSolid SPHERE
The margin applied to the size of the World volume may be changed using the command:
/multi/setWorldMargin 0.025
where in this case, the margin applied is 2.5%.
The name of the World physical volume will, by default, be set to
“World”, but the user can override this using the
/multi/setWorldName
command.
To avoid conflicts in the names of the physical volumes when the same
GDML/Gmsh volume is inserted more than once (but with different
placements), the physical, logical and solid volume names are modified
when the GDML files are read and geometry constructed. By default, the
names are prefixed with the module names used in the /multi/addGDML
and /multi/addGMSH
commands, with the prefix delimited at the start
and end with the characters < >
. Therefore, for the above example
the prefixes will be <Part01>
, <Part02>
and <Part03>
. It is
possible to use different characters enclosing the module name,
‘’e.g.’’:
/multi/setPrefixLeftMarker <<_Module_ /multi/setPrefixRightMarker _>>
will change the prefixes to <<\_Module_Part01\_>>
,
<<\_Module_Part02\_>>
and <<\_Module_Part03\_>>
.
Using the /multi/setModuleNameAsPrefix
and
mult/<module_name>/SetPrefixLevel
commands is also possible to force
GRAS not to add any prefixes or to change whether they are applied to
just the physical volumes or to the physical and logical volumes or to
all volume types. This can be applied for all modules (GDML or Gmsh
files loaded) or only specific modules. However, please use these
options with care as you risk inadvertently performing a radiation
analysis on the wrong volume.
Multi : Multiple Geometries in a Layered Mass (Parallel) Worlds¶
The same /multi
commands can be used to construct layered mass
worlds. This is advantageous when one wishes to place one or more
physical volumes inside other physical volumes without having to define
complex Boolean solids to ensure the geometry is valid. The layer is
determined by an integer added at the end of the /multi/addGDML
or
/multi/addGMSH
commands. An integer value of 0 (zero) or if the
integer is omitted means the geometry module will be inserted into or as
the Mother mass world. Integers >0 indicate mass layers (parallel)
worlds ordered by increasing layer number. As with the previous case
GRAS only supports the combination of one or more GDML and/or Gmsh
geometries.
In the following example, three cylindrical habitat modules are inserted as mass layer 1 into a Mother (layer 0) geometry representing Mars. The axes of the habitats are 0.8m above the surface of Mars and therefore the modules are partially buried in the surface. In each of the habitats is placed a single ICRP anthropomorphic phantom, and a fourth phantom is also placed outside. All the phantoms are in mass layer 2.
/gras/geometry/type multi /multi/addGDML Mars 0 /multi/gdml/Mars/file MarsSurfaceBox.gdml /multi/gdml/Mars/setup World /multi/addGDML Hab1 1 /multi/gdml/Hab1/file ColumbusLikeModule_Cyl_2cm.gdml /multi/gdml/Hab1/translate 0.0 7.0 0.8 m /multi/addGDML Hab2 1 /multi/gdml/Hab2/file ColumbusLikeModule_Cyl_2cm.gdml /multi/gdml/Hab2/translate 0.0 0.0 0.8 m /multi/addGDML Hab3 1 /multi/gdml/Hab3/file ColumbusLikeModule_Cyl_2cm.gdml /multi/gdml/Hab3/translate 7.0 3.5 0.8 m /multi/gdml/Hab3/rotateZ 90.0 deg /multi/addGDML Alex 2 /multi/gdml/Alex/file MIRDMale.gdml /multi/gdml/Alex/translate 0.0 7.0 0.8 m /multi/addGDML Beth 2 /multi/gdml/Beth/file MIRDFemale.gdml /multi/gdml/Beth/translate 0.0 0.0 0.8 m /multi/addGDML Chris 2 /multi/gdml/Chris/file MIRDMale.gdml /multi/gdml/Chris/translate 7.0 3.5 0.8 m /multi/addGDML Doc 2 /multi/gdml/Doc/file MIRDFemale.gdml /multi/gdml/Doc/translate 2.0 3.5 0.8 m /multi/instantiateParallelConstructors
Once again, the ability to differentiate between volumes after a GDML file is loaded several times is possible since module names are, by default, prefixed to the GDML/Gmsh volume names.
Geometry utilities¶
The user can obtain information on the content of the geometry model. For the moment, the UI Command:/gras/geometry/util/listLogicalVolumes provides a list of the volumes and in addition their mass. Please note that similar information can be obtained with the ASCIITree (ATree) visualisation driver, included in Geant4.
The user can also modify the material associated to a volume by name
with the Command: /gras/geometry/util/setVolumeMaterial
or
/gras/geometry/util/setPhysicalVolumeMaterial
. The wildcard
character ‘*’ can be used in volume names.
Script example:
/gras/geometry/util/listLogicalVolumes /gras/geometry/util/setVolumeMaterial World_log Vacuum /gras/geometry/util/setPhysicalVolumeMaterial World Vacuum /gras/geometry/util/setVolumeMaterial Detector* GalliumArsenide /gras/geometry/util/setPhysicalVolumeMaterial Detector* GalliumArsenide
GRAS/trunk/r2242