// Jupiter Auroral Simulation // GEANT4-10.6.2 // Gabriel Bridges Aug, 2020 // Geometry construction // includes // user headers #include "ConstructJupiter.hh" #include "JupiterMessenger.hh" #include "JovianField.hh" #include "global.h" // material managment #include "G4Material.hh" #include "G4NistManager.hh" // geometry #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4Box.hh" #include "G4Tubs.hh" #include "G4TransportationManager.hh" // managment #include "G4SDManager.hh" #include "G4GeometryManager.hh" #include "G4RunManager.hh" // generic construction #include "G4GeometryTolerance.hh" #include "G4Region.hh" #include "G4RegionStore.hh" #include "G4PhysicalVolumeStore.hh" #include "G4LogicalVolumeStore.hh" #include "G4SolidStore.hh" #include "G4ProductionCuts.hh" // generic utilities #include "G4String.hh" #include "G4UserLimits.hh" #include "G4Colour.hh" #include "G4ios.hh" #include "G4SystemOfUnits.hh" // constructor ConstructJupiter::ConstructJupiter() :WorldSolid(0),WorldLogical(0),WorldPhysical(0) // initialize World volumes before execution { DefineMaterials(); // call DefineMaterials jovianMessenger = new JupiterMessenger(this);// let Messenger handle geometry management extern global_struct global; } // destructor ConstructJupiter::~ConstructJupiter() { delete jovianMessenger; } // Material definitions void ConstructJupiter::DefineMaterials() { // initialize NIST Manager nistManager = G4NistManager::Instance(); // gather NIST materials Galactic = nistManager->FindOrBuildMaterial("G4_Galactic"); Hy = nistManager->FindOrBuildMaterial("H"); He = nistManager->FindOrBuildMaterial("He"); // IPM density = 2.376e-15*g/cm3; temperature = 10*kelvin; pressure = 1.0e-8*bar; IPM = new G4Material("Vacuum", density, nel = 1, kStateGas, temperature, pressure); IPM -> AddMaterial(Galactic, 100*perCent); // Jovian Atmoshpere z = 80000*km;// height of my column numberDensity = (1e24*1/cm2)/z; // number density = column density/column height massHy = 3.35e-24*g; massHe = 6.65e-24*g; density = 0.864*massHy*numberDensity + 0.136*massHe*numberDensity; temperature = 400*kelvin; avo = 6.022e23;// avogadros numbers molarDensity = numberDensity/avo; idealConst = 8.314e1*cm3*bar/kelvin; pressure = molarDensity*temperature*idealConst; jovianAtmo_mat = new G4Material("Jovian_Atmo", density, nel = 2, kStateGas, temperature, pressure); Hy_mass_frac = 0.6136; He_mass_frac = 0.3864; jovianAtmo_mat -> AddMaterial(Hy, Hy_mass_frac); jovianAtmo_mat -> AddMaterial(He, He_mass_frac); // Print materials G4cout << *(G4Material::GetMaterialTable()) << G4endl; } // Construction method, returns G4VPhysicalVolume G4VPhysicalVolume* ConstructJupiter::Construct() { return JupiterConstruction(); } G4VPhysicalVolume* ConstructJupiter::JupiterConstruction() { extern global_struct global; overlap = global.CheckOverlap; //------------------------------------------------ // Sensitive detectors //------------------------------------------------ DetectoManager = G4SDManager::GetSDMpointer(); SensitiveSlab = new JupiterSD("SensitiveSlab"); DetectoManager -> AddNewDetector(SensitiveSlab); //------------------------------------------------ // Magnetic field //------------------------------------------------ Jovian_B_field = new JovianField(); G4FieldManager* globalFieldMgr = G4TransportationManager::GetTransportationManager() -> GetFieldManager(); globalFieldMgr -> SetDetectorField(Jovian_B_field); globalFieldMgr -> CreateChordFinder(Jovian_B_field); //------------------------------------------------ // Copy Number //------------------------------------------------ CopyAtmo = 1; CopySlab = 0; CopyWorld = -1; //--------- Definitions of Solids, Logical Volumes, Physical Volumes --------- //------------------------------------------------ // World //------------------------------------------------ WorldLength = 85000.0*km; WorldSolid = new G4Box("SolidWorld", WorldLength*0.5, WorldLength*0.5, WorldLength*0.5); WorldLogical = new G4LogicalVolume(WorldSolid, IPM, "World", 0, 0, 0); WorldPhysical = new G4PVPlacement(0, G4ThreeVector(), WorldLogical, "World", 0, false, CopyWorld, true); //------------------------------------------------ // Atmoshpere //------------------------------------------------ // cylinder with 80,000km height (corresponds to JUNO's altitude) AtmoLength = 80000*km; AtmoRadius = 20000*km; AtmoSolid = new G4Tubs("Atmosphere_Solid", 0, AtmoRadius, 0.5*AtmoLength, 0, 360*degree); AtmoLogical = new G4LogicalVolume(AtmoSolid, jovianAtmo_mat, "Atmosphere_Logic"); AtmoPhysical = new G4PVPlacement(0, G4ThreeVector(), AtmoLogical, "Atmosphere_Physical", WorldLogical, false, CopyAtmo); //------------------------------------------------ // Detector //------------------------------------------------ // thin disk sitting on top of the atmosphere column DetectorThick = 1.0*km; DetectorRadius = 20000*km; DetectorSolid = new G4Tubs("Detector_Solid", 0, DetectorRadius, 0.5*DetectorThick, 0, 360*degree); DetectorLogical = new G4LogicalVolume(DetectorSolid, IPM, "Detector_Logic"); DetectorPhysical = new G4PVPlacement(0, G4ThreeVector(0,0,40000.5*km), DetectorLogical, "Detector_Physical", WorldLogical, false, CopySlab); DetectorLogical -> SetSensitiveDetector(SensitiveSlab); //------------------------------------------------ // Visualization attributes //------------------------------------------------ TransparentVisAtt = new G4VisAttributes(G4Colour(1.00, 1.00, 1.00, 0.0)); WorldVisAtt = new G4VisAttributes(G4Colour(1.00, 1.00, 1.00, 0.0)); AtmoVisAtt = new G4VisAttributes(G4Colour(0.8, 0.8, 0.8, 0.4)); DetectVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0, 0.5)); WorldLogical -> SetVisAttributes(WorldVisAtt); AtmoLogical -> SetVisAttributes(AtmoVisAtt); DetectorLogical -> SetVisAttributes(DetectVisAtt); return WorldPhysical; } // Geometry updater void ConstructJupiter::UpdateGeometry() { // Cleanup old geometry G4GeometryManager::GetInstance()->OpenGeometry(); G4PhysicalVolumeStore::GetInstance()->Clean(); G4LogicalVolumeStore::GetInstance()->Clean(); G4SolidStore::GetInstance()->Clean(); G4RunManager::GetRunManager()->DefineWorldVolume(JupiterConstruction()); G4RunManager::GetRunManager()->GeometryHasBeenModified(); }