GainMedium
GainMedium combines a MeshTopology with the material and state arrays
that the ASE calculation needs.
from HASEonGPU import GainMedium
medium = GainMedium(topology=topology)
Physical Properties
The most important pattern is to ask the property object for its expected shape, then create an array with that shape:
beta_shape = medium.get("betaCells").expectedShape
medium.get("betaCells").value = np.zeros(beta_shape)
You can set several properties at once:
medium.withPhysicalProperties(
betaCells=np.zeros(medium.get("betaCells").expectedShape),
betaVolume=np.zeros(medium.get("betaVolume").expectedShape),
claddingCellTypes=np.zeros(medium.get("claddingCellTypes").expectedShape, dtype=np.uint32),
refractiveIndices=[2.0, 1.0, 2.0, 1.0],
reflectivities=np.zeros(medium.get("reflectivities").expectedShape),
nTot=2.776e20,
crystalTFluo=9.41e-4,
claddingNumber=1,
claddingAbsorption=5.5,
)
withPhysicalProperties returns the same GainMedium instance, so it can
be chained.
Property Reference
betaCellsExcited-state fraction \(\beta_i\) at topology points and z-levels. Matrix shape:
(numberOfPoints, numberOfLevels).betaVolumePrism-centered excited-state fraction \(\beta_j\) used by the ASE ray integration. Matrix shape:
(numberOfTriangles, numberOfLevels - 1).claddingCellTypesTriangle-wise cladding type index. Shape:
(numberOfTriangles,).refractiveIndicesFour refractive indices:
[bottomInside, bottomOutside, topInside, topOutside].reflectivitiesSurface reflectivity per triangle. Matrix shape:
(2, numberOfTriangles)where row 0 is bottom and row 1 is top.nTotTotal active-ion concentration \(N_{\mathrm{tot}}\) in
cm^-3.crystalTFluoFluorescence lifetime \(\tau\).
claddingNumberCladding type selected for cladding absorption handling.
claddingAbsorptionAbsorption coefficient of the selected cladding.
Shape and Metadata Utilities
get(name) returns a property wrapper:
prop = medium.get("betaCells")
prop.name
prop.description
prop.dtype
prop.expectedShape
prop.value
prop.meta()
listProperties() returns metadata for all known physical properties:
for prop in medium.listProperties():
print(prop["name"], prop["expectedShape"], prop["isSet"])
set(name, value) validates and stores one property:
medium.set("nTot", 2.776e20)
medium.set("betaCells", np.zeros(medium.get("betaCells").expectedShape))
Arrays can be supplied either in matrix shape or flat Fortran order. Stored arrays are flattened internally for the HASEonGPU binding.
Indexing Helpers
GainMedium forwards beta-cell coordinate lookups for \(\beta_i\) to
its topology:
i, k = medium.betaCellIndexAt(x=0.0, y=0.0, z=0.0)
beta = medium.get("betaCells").value.reshape(
medium.get("betaCells").expectedShape,
order="F",
)
beta[i, k] = 0.5
medium.get("betaCells").value = beta
Convenience Dimensions
medium.numberOfPoints
medium.numberOfTriangles
medium.numberOfPrisms
medium.numberOfLevels
emptyBetaCells(fill=0.0) creates a correctly shaped beta array
\(\beta_i\):
medium.get("betaCells").value = medium.emptyBetaCells(fill=0.0)