Skip to content

Error Doing Multiple Geant4 Simulations in one Julia REPL Session #499

@DineshGangavarapu

Description

@DineshGangavarapu

I am working at ORNL doing Julia (1.11) Geant4 simulations for minimizing PEN enclosure thickness. I keep encountering a recurring error where I am unable to perform more than one Geant4 simulation in a single Julia session. If I were to run my code, which includes two sources and a simulation for each, line by line, it would break down when I perform the second Geant4 simulation with a UndefRefError. This has been recurring and I have not been able to find a solution to it. Please find attached below a minimal working example.

using Geant4
using SolidStateDetectors
using Unitful
source_1 = MonoenergeticSource(
    "e-",                                 
    3.5u"MeV",                            
    CartesianPoint(0.065, 0., 0.05),      
    CartesianVector(-1,0,0),               
    10u"°"    ) 
source_2 = MonoenergeticSource(
    "e-",                                 
    2.25u"MeV",                            
    CartesianPoint(0.085, 0., 0.15),      
    CartesianVector(-2,0,0),               
    15u"°"    ) 
T = Float32
sim = Simulation{T}(SSD_examples[:InvertedCoaxInCryostat])
app = G4JLApplication(sim, source_1, verbose = false)
events = run_geant4_simulation(app, 1000)
sim_2 = Simulation{T}(SSD_examples[:InvertedCoaxInCryostat])
app_2 = G4JLApplication(sim_2, source_2, verbose = false)
events_2 = run_geant4_simulation(app_2, 1000)

CC @theHenks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions