Quickstart Tutorial
This tutorial uses the supplied mie2D.jcmp project with layout.jcm,
materials.jcm, and sources.jcm. It prints installation information, uses
solve to solve
the project, and exports its declared first postprocess,
ElectromagneticFieldEnergyFlux.
Complete the Installation guide before you run this tutorial. The command below uses the four files listed on this page from the tutorial root.
Run the tutorial from the tutorial root:
python quickstart/run.py
Python File
import jcmsuite
# Print information about the currently installed version of JCMsuite
jcmsuite.info()
# Run the Project
result = jcmsuite.solve("mie2D.jcmp")
# Show the postprocess names declared by the Project.
print(result.postprocesses.titles())
# Access the results of the first postprocess and export it to a dictionary
flux_results = result.postprocesses[0].to_dict()
# Print the exported results
print(flux_results)
Project Files
mie2D.jcmp
Project {
InfoLevel = 3
Electromagnetics {
TimeHarmonic {
Scattering {
FieldComponents = Electric
Accuracy {
FiniteElementDegree = 3
Refinement {
MaxNumberSteps = 0
PreRefinements = 0
}
}
}
}
}
}
# computes the energy flux of the scattered field into the exterior domain
PostProcess {
FluxIntegration {
FieldBagPath = "./mie2D_results/fieldbag.jcm"
OutputFileName = "./mie2D_results/energyflux_scattered.jcm"
OutputQuantity = ElectromagneticFieldEnergyFlux
InterfaceType = ExteriorDomain
}
}
# exports computed field on cartesian grid
PostProcess {
ExportFields {
FieldBagPath = "./mie2D_results/fieldbag.jcm"
OutputFileName = "./mie2D_results/fieldbag_cartesian.jcm"
Cartesian {
NGridPointsX = 200
NGridPointsY = 200
}
}
}
layout.jcm
Layout2D {
UnitOfLength = 1e-6
MeshOptions {
MaximumSideLength = 0.1
}
Objects {
# Computational domain
Parallelogram {
Name = "ComputationalDomain"
DomainId = 1
Priority = ComputationalDomain
Width = 4
Height = 4
Boundary {
Class = Transparent
}
}
# Scatterer (rod)
Circle {
Name = "Rod"
DomainId = 2
Priority = 1
Radius = 0.5
RefineAll = 4
}
}
}
materials.jcm
# material properties for the surroundings (air)
Material {
DomainId = 1
RelPermittivity = 1.0
RelPermeability = 1.0
}
# material properties the glass rod
Material {
DomainId = 2
RelPermittivity = 2.3104 # 1.52^2
RelPermeability = 1.0
}
sources.jcm
SourceBag {
Source {
ElectricFieldStrength {
PlaneWave {
K = [1.14239732857811e7 0.0 0.0]
Amplitude = [0 0 1]
}
}
}
}