-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optical photon simulation #886
Comments
From today's discussion: We'll almost certainly want to have a separate photon event loop that operates either in parallel or serially with the main tracking loop, immediately after along-step. graph TB
subgraph generate
scintillation
cerenkov
initializers["buffered secondaries"]
end
subgraph physics
pre-step --> propagate
propagate --> boundary
boundary --> reflection["reflection*"]
boundary --> cross["cross boundary"]
cross --> refraction["refraction*"]
cross --> absorb
propagate --> volume-interaction
volume-interaction --> absorption
volume-interaction --> scatter["scatter*"]
volume-interaction --> reemission["reemission*"]
end
steps --> generate
generate --> physics
absorb --> hits
absorption --> kill
hits --> kill
Asterisks denote multiple models per action Much of the loop should look almost identical to the celeritas one. Note that like Geant4, generating optical photons violates conservation of energy. If we want detailed energy balance, we'd have to subtract the generated photon energy from the local dE/dx, and tally photon absorption inside SD regions to create hits. This detailed balance is not needed for known applications. Step propertiesTwo cases:
Input to photon event loop can be translated and copied to GPU (like acceleritas offloading), or transferred natively on device memory, and needs the following properties:
Possibly for GPU we can pass in the geometry and a track ID so that we can copy the initial state. The number of photons generated per step (the yield) depends on dE/dx, the particle type, and the "yield factor". Volume Interaction
Surface crossingSurface processes (e.g. diffraction) require materials on both sides of a surface, so we need to be able to query the new material and safely perform actions on the boundary, and potentially ignore the boundary crossing in favor of reflection, or at least be able to restore the state to the other surface side. |
First step:
Optical track data:
Comparison problem:
graph TB
gun["gun or external"]
subgraph main-celeritas-loop
scintillation
cerenkov
end
subgraph photon-input-data
scintillation-dist
cerenkov-dist
end
scintillation-dist
cerenkov-dist
scintillation --> scintillation-dist
cerenkov --> cerenkov-dist
gun --> photon-primary
subgraph photon-generator
scintillation-dist --> scintillation-generator
cerenkov-dist --> cerenkov-generator
end
scintillation-generator --> photon-primary
cerenkov-generator --> photon-primary
Initial tasks
Later:
Much later:
|
OpticalInitStateData will be shared between:
For each pre-generator: TODO: do we want StepStateTrackView??
|
Plan for this week's optical physics hackathon: basic optical tracking loop
|
The full listEverything we need for a nicely integrated complete optical physics package Main "core" transport loop
Geant4 integrationPossible integration from least to most difficult
Optical stepping loop
Minimal working exampleload up geant4 physics, just EM tracking with celer-sim on EM particles, create but don't use cerenkov/scintillation; CPU only to make it even easier
|
Separate tasks from today for most minimal case:
Later:
|
TODO:
How to treat missing data?
Model/physics construction ordering:
Physics implicit actions:
|
Pseudo-code from hacking with @hhollenb : struct OpticalModelXs
{
ItemMap<OpticalModelId, GridId> per_model_mfp;
};
struct OpticalPhysicsData
{
// ItemMap<OpticalMaterialId, OpticalModelXs> per_material_modelxs;
Collection<OpticalModelXs, W, M, OpticalMaterialId> model_xs;
Collection<GenericGridData>;
// ....
};
void calc_step_limit()
{
auto models = params[opt_mat];
real_type total_xs{0};
for (ModelId mod_id : models)
{
auto xs = 1/phys.calc_mfp(opt_mat, mod_id);
pstep.per_model_xs(mod_id) = xs;
total_xs += xs;
}
// Normalize per-process xs
// Calculate step limit by multiplying into sampled MFP
limit.step = physics.interaction_mfp() / total_macro_xs;
}
OpticalPhys()
{
HostVal data;
OpticalPhysicsBuilder builder{&data};
for (mat : materials)
{
for (mod : models)
{
OpticalXsBuilder local_builder(&builder ,mat, mod_id);
mod.build(local_builder);
// Assert that the correct data was inserted?
}
}
}
class OpticalPhysicsBuilder
{
public:
OpticalProperties const& props();
OpticalModelId action_to_model(ActionId) const;
GridId add_xs(...);
private:
DedupeCollectionBuilder<real_type> reals_;
};
class OpticalXsBuilder
{
public:
OpticalXsBuilder(OpticalPhysicsBuilder* phys,
OpticalMaterialId,
OpticalModelId);
void add_xs(...)
{
return phys->insert_grid(...);
}
private:
};
// Call once *per model*
void Absorption::build(OpticalXsBuilder& builder)
{
CELER_EXPECT(builder.opt_mat_id() < import_.size());
builder.add_xs(import_[opt_mat_id.get()].absorption_length);
} |
This large issue is split into:
Requirements discussion
This is an initial draft for supporting optical photon simulation and a placeholder to collect and identify sub-tasks
for implementing related codes and testing. Your additional input, refinement and contributions are welcome.
Major categories and sub-tasks:
Optical materials and properties
Automatically populate common optical materials such as Water, Liquid Xeon and ArgonOpticalPropertyParams
(constant properties, vectors of properties such as momentum dependent optical properties)OpticalPropertyView
from material IDOptical photon physics
Photino
(an object returned from processes of optical photon generation, which will be passed to the loop of optical photon propagation) —OpticalPhotonDistribution
and relatedstep limiter
(mfp) andinteractor
(final state sampling) and executing them on HPC systemsI/O
OpticalTrackView
orOpticalPhotonInput
for an optical actionTesting and physics validation/verification
Performance evaluation
Offloading interfaces and integration on experiment frameworks
Future work
Optical properties
where PTYPE = [PROTON|DEUTERON|TRITON|ALPHA|IONS|ELECTRON] if GetScintillationYieldByParticleType is used,
and * in G4OpRayleigh are needed for the on-the-fly m.f.p calculation if the property RAYLEIGH is not provided.
The text was updated successfully, but these errors were encountered: