diff --git a/sirepo/package_data/static/js/silas.js b/sirepo/package_data/static/js/silas.js index b10a74e68d..a6c1e0fef2 100644 --- a/sirepo/package_data/static/js/silas.js +++ b/sirepo/package_data/static/js/silas.js @@ -352,7 +352,7 @@ SIREPO.beamlineItemLogic('crystalView', function(panelState, silasService, $scop ['l_scale'], item.propagationType === 'n0n2_lct' || item.propagationType === 'abcd_lct', ['origin'], hasCrystals, ['reuseCrystal'], item.origin === 'reuse', - ['title', 'length', 'nslice'], item.origin === 'new', + ['title', 'length', 'nslice', 'inversion_mesh_extent', 'crystal_alpha'], item.origin === 'new', ['A', 'B', 'C', 'D'], false, ]); panelState.enableField(item.type, 'pump_wavelength', false); @@ -819,7 +819,7 @@ const intensityViewHandler = function(appState, beamlineService, panelState, $sc const idx = SIREPO.SINGLE_FRAME_ANIMATION.indexOf(modelKey()); if (m.reportType == 'parameter' || (! isCrystal(e) && ['total_intensity', 'total_phase'].includes(m.watchpointPlot)) - || (isCrystal(e) && m.crystalPlot === 'excited_states_longitudinal') + || (isCrystal(e) && (m.crystalPlot === 'excited_states_longitudinal' || m.crystalPlot === 'total_excited_states')) ) { if (idx < 0) { SIREPO.SINGLE_FRAME_ANIMATION.push(modelKey()); diff --git a/sirepo/package_data/static/json/silas-schema.json b/sirepo/package_data/static/json/silas-schema.json index 83f0c48f1d..2c2eb04a13 100644 --- a/sirepo/package_data/static/json/silas-schema.json +++ b/sirepo/package_data/static/json/silas-schema.json @@ -10,6 +10,7 @@ ["reuse", "Use Existing"] ], "CrystalPlot": [ + ["total_excited_states", "Total Excited States"], ["excited_states", "Excited States by Slice"], ["excited_states_longitudinal", "Excited States Longitudinal Distribution"] ], @@ -116,13 +117,13 @@ "initial_temp": ["Inital Temperature [°C]", "Float", 0.0], "mesh_density": ["Mesh Density", "Integer", 80], "title": ["Element Name", "String", "Crystal"], - "A": ["A", "Float", 0.99736924], - "B": ["B", "Float", 0.0141972275], - "C": ["C", "Float", -0.260693], - "D": ["D", "Float", 0.99892682], + "A": ["A", "Float", 0.99765495], + "B": ["B", "Float", 1.41975385], + "C": ["C", "Float", -0.0023775], + "D": ["D", "Float", 0.99896716], "length": ["Length [cm]", "Float", 2], "l_scale": ["Length Scale Factor for LCT Propagation", "Float", 0.001], - "calc_type": ["Propagation Calculation Type", "PropCalcType", "fenics"], + "calc_type": ["Propagation Calculation Type", "PropCalcType", "analytical"], "inversion_n_cells": ["Mesh Cell Count", "Integer", 64], "inversion_mesh_extent": ["Crystal Radius [m]", "Float", 0.01], "crystal_alpha": ["Crystal Alpha [1/m]", "Float", 120.0], @@ -135,9 +136,9 @@ "origin": ["Crystal", "CrystalOrigin", "new"], "n0n2Plot": ["", "N0n2Plot", "n0n2Plot"], "reuseCrystal": ["Select Crystal", "SelectCrystal", 0], - "pump_offset_x": ["Pump Offset X [m]", "Float", 0], - "pump_offset_y": ["Pump Offset X [m]", "Float", 0], - "pump_rep_rate": ["Pump Rep Rate [Hz]", "Float", 1000.0] + "pump_offset_x": ["Pump Offset X [m]", "Float", 0.0], + "pump_offset_y": ["Pump Offset X [m]", "Float", 0.0], + "pump_rep_rate": ["Pump Rep Rate [Hz]", "Float", 1.0] }, "crystalAnimation": {}, "crystalSettings": { @@ -176,7 +177,7 @@ "poltype": ["Polarization", "GaussianBeamPolarization", "1"], "tau_fwhm": ["FWHM Length [ps]", "Float", 23.5865], "tau_0": ["Fourier-limited pulse length of a given spectral bandwidth [ps]", "Float", 23.5865], - "chirp": ["Chirp", "Float", 1.0], + "chirp": ["Chirp", "Float", 0.0012459], "pulseE": ["Total Laser Pulse Energy [J]", "Float", 0.001], "distribution": ["Distribution Type", "DistributionType", "gaussian"], "sigx_waist": ["Horizontal Beam Size [m]", "Float", 0.001, "Size is in terms of RMS"], @@ -228,7 +229,7 @@ }, "watchpointReport": { "_super": ["_", "model", "initialIntensityReport"], - "crystalPlot": ["Value to Plot", "CrystalPlot", "excited_states"] + "crystalPlot": ["Value to Plot", "CrystalPlot", "total_excited_states"] } }, "strings": { @@ -267,6 +268,7 @@ "pump_waist", "pump_rep_rate", "pump_gaussian_order", + "calc_type", "pump_pulse_profile", "pump_wavelength", "pump_offset_x", diff --git a/sirepo/package_data/template/silas/examples/bella.json b/sirepo/package_data/template/silas/examples/bella.json new file mode 100644 index 0000000000..7c942f19b2 --- /dev/null +++ b/sirepo/package_data/template/silas/examples/bella.json @@ -0,0 +1,670 @@ +{ + "models": { + "beamline": [ + { + "A": 1, + "B": 0.025, + "C": 0, + "D": 1, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 106.4, + "icon": "ti-sapphire-crystal.png", + "id": 2, + "initial_temp": 0, + "inversion_mesh_extent": 0.005, + "inversion_n_cells": 128, + "l_scale": 0.005416618968367257, + "length": 2.5, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "new", + "position": 1.375, + "propagationType": "n0n2_srw", + "pump_energy": 0.82, + "pump_gaussian_order": 8, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "hog", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.00382, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 0, + "title": "Amp2", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 8, + "position": 2.75, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99736924, + "B": 0.0141972275, + "C": -0.260693, + "D": 0.99892682, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 3, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 4.125, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1000, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 2, + "title": "Amp2", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 9, + "position": 5.5, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99736924, + "B": 0.0141972275, + "C": -0.260693, + "D": 0.99892682, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 4, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 6.875, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1000, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 2, + "title": "Amp2", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 10, + "position": 8.25, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99736924, + "B": 0.0141972275, + "C": -0.260693, + "D": 0.99892682, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 5, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 9.625, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1000, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 2, + "title": "Amp2", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 7, + "position": 11, + "propagationType": "default", + "title": "Watchpoint", + "type": "watch" + }, + { + "_super": "beamElement", + "id": 11, + "position": 11, + "propagationType": "default", + "title": "Splitter", + "transmitted_fraction": 0.4, + "type": "splitter" + }, + { + "_super": "beamElement", + "id": 12, + "position": 11, + "propagationType": "default", + "title": "After Splitter", + "type": "watch" + }, + { + "_super": "beamElement", + "drift_length_1": 1.9, + "drift_length_2": 0.1, + "drift_length_3": 0.54, + "focal_length_1": -0.1, + "focal_length_2": 0.2, + "id": 13, + "position": 11, + "propagationType": "default", + "title": "Telescope 1", + "type": "telescope" + }, + { + "_super": "beamElement", + "id": 14, + "position": 11, + "propagationType": "default", + "title": "After Telescope 1", + "type": "watch" + }, + { + "A": 1, + "B": 0.025, + "C": 0, + "D": 1, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 106.4, + "icon": "ti-sapphire-crystal.png", + "id": 15, + "initial_temp": 0, + "inversion_mesh_extent": 0.0075, + "inversion_n_cells": 128, + "l_scale": 0.005416618968367257, + "length": 2.5, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "new", + "position": 12.375, + "propagationType": "n0n2_srw", + "pump_energy": 2.75, + "pump_gaussian_order": 8, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "hog", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.0073, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 2, + "title": "Amp3", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 16, + "position": 13.75, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99765495, + "B": 1.41975385, + "C": -0.0023775, + "D": 0.99896716, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 17, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 15.125, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 15, + "title": "Amp3", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 18, + "position": 16.5, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99765495, + "B": 1.41975385, + "C": -0.0023775, + "D": 0.99896716, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 19, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 17.875, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 15, + "title": "Amp3", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 20, + "position": 19.25, + "propagationType": "default", + "title": "Watchpoint", + "type": "watch" + }, + { + "_super": "beamElement", + "drift_length_1": 1, + "drift_length_2": 0.3, + "drift_length_3": 0.66, + "focal_length_1": -0.3, + "focal_length_2": 0.6, + "id": 21, + "position": 19.25, + "propagationType": "default", + "title": "Telescope 2", + "type": "telescope" + }, + { + "_super": "beamElement", + "id": 22, + "position": 19.25, + "propagationType": "default", + "title": "After Telescope 2", + "type": "watch" + }, + { + "A": 1, + "B": 0.025, + "C": 0, + "D": 1, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 106.4, + "icon": "ti-sapphire-crystal.png", + "id": 23, + "initial_temp": 0, + "inversion_mesh_extent": 0.015, + "inversion_n_cells": 128, + "l_scale": 0.005416618968367257, + "length": 2.5, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "new", + "position": 20.625, + "propagationType": "n0n2_srw", + "pump_energy": 7, + "pump_gaussian_order": 8, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "hog", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.0154, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 2, + "title": "Amp4", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 24, + "position": 22, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99765495, + "B": 1.41975385, + "C": -0.0023775, + "D": 0.99896716, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 25, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 23.375, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 23, + "title": "Amp4", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 26, + "position": 24.75, + "propagationType": "default", + "title": "Mirror", + "type": "mirror2" + }, + { + "A": 0.99765495, + "B": 1.41975385, + "C": -0.0023775, + "D": 0.99896716, + "_super": "beamElement", + "calc_type": "analytical", + "crystal_alpha": 120, + "icon": "ti-sapphire-crystal.png", + "id": 27, + "initial_temp": 0, + "inversion_mesh_extent": 0.01, + "inversion_n_cells": 64, + "l_scale": 0.001, + "length": 2, + "mesh_density": 80, + "n0n2Plot": "n0n2Plot", + "nslice": 10, + "origin": "reuse", + "position": 26.125, + "propagationType": "n0n2_srw", + "pump_energy": 0.0211, + "pump_gaussian_order": 2, + "pump_offset_x": 0, + "pump_offset_y": 0, + "pump_pulse_profile": "gaussian", + "pump_rep_rate": 1, + "pump_type": "dual", + "pump_waist": 0.00164, + "pump_wavelength": 5.32e-07, + "reuseCrystal": 23, + "title": "Amp4", + "type": "crystal" + }, + { + "_super": "beamElement", + "id": 28, + "position": 27.5, + "propagationType": "default", + "title": "Watchpoint", + "type": "watch" + } + ], + "beamlineAnimation0": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation12": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation14": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation15": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation17": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation19": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation2": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation20": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation22": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation23": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation25": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation27": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation28": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation3": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation4": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation5": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "beamlineAnimation7": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "crystalPlot": "total_excited_states", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "crystal3dAnimation": {}, + "crystalAnimation": {}, + "crystalCylinder": { + "T0": 20, + "alpha": 0, + "crystal": 0, + "crystalLength": 2, + "dT": 3.8, + "diameter": 7, + "diffusionConstant": 0.0565, + "pump_pulse_profile": "", + "supergaussian": 8, + "wdT": 1 + }, + "crystalSettings": { + "meshDensity": 30, + "plotInterval": 10, + "steps": 100, + "time": 1, + "tolerance": 0.008 + }, + "initialIntensityReport": { + "colorMap": "viridis", + "watchpointPlot": "total_intensity" + }, + "laserPulse": { + "ccd": "", + "chirp": 0.1320281, + "distribution": "gaussian", + "meta": "", + "nslice": 5, + "num_sig_long": 12, + "num_sig_trans": 20, + "nx_slice": 512, + "ny_slice": 512, + "phase_flatten_cutoff": 0.7, + "photon_e_ev": 1.5498, + "poltype": "1", + "pulseE": 0.002, + "sigx_waist": 0.0021609183233, + "sigy_waist": 0.0021609183233, + "tau_0": 0.02474873, + "tau_fwhm": 212.132034356, + "wfs": "" + }, + "laserPulse2Animation": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "reportType": "3d", + "watchpointPlot": "total_phase" + }, + "laserPulseAnimation": { + "_super": "initialIntensityReport", + "colorMap": "viridis", + "reportType": "3d", + "watchpointPlot": "total_intensity" + }, + "plot2Animation": {}, + "plotAnimation": {}, + "simulation": { + "distanceFromSource": 0, + "documentationUrl": "", + "folder": "/Examples", + "name": "100TW BELLA amplifier with 3 crystals" + } + }, + "simulationType": "silas" +} diff --git a/sirepo/package_data/template/silas/examples/multiple-pass-single-crystal.json b/sirepo/package_data/template/silas/examples/multiple-pass-single-crystal.json index c5da6dde6c..008544aef8 100644 --- a/sirepo/package_data/template/silas/examples/multiple-pass-single-crystal.json +++ b/sirepo/package_data/template/silas/examples/multiple-pass-single-crystal.json @@ -15,7 +15,7 @@ "C": -0.260693, "D": 0.99892682, "_super": "beamElement", - "calc_type": "fenics", + "calc_type": "analytical", "crystal_alpha": 106.4, "icon": "ti-sapphire-crystal.png", "id": 2, @@ -49,7 +49,7 @@ "pump_gaussian_order": 8, "pump_offset_x": 0, "pump_offset_y": 0, - "pump_rep_rate": 1000, + "pump_rep_rate": 1, "pump_type": "dual", "pump_waist": 0.00382, "pump_wavelength": 5.32e-07, @@ -95,7 +95,7 @@ "C": -0.260693, "D": 0.99892682, "_super": "beamElement", - "calc_type": "fenics", + "calc_type": "analytical", "crystal_alpha": 120, "icon": "ti-sapphire-crystal.png", "id": 4, @@ -175,7 +175,7 @@ "C": -0.260693, "D": 0.99892682, "_super": "beamElement", - "calc_type": "fenics", + "calc_type": "analytical", "crystal_alpha": 120, "icon": "ti-sapphire-crystal.png", "id": 6, @@ -255,7 +255,7 @@ "C": -0.260693, "D": 0.99892682, "_super": "beamElement", - "calc_type": "fenics", + "calc_type": "analytical", "crystal_alpha": 120, "icon": "ti-sapphire-crystal.png", "id": 8, @@ -339,7 +339,7 @@ }, "laserPulse": { "ccd": "", - "chirp": 0, + "chirp": 1.385e-4, "distribution": "gaussian", "meta": "", "nslice": 10, diff --git a/sirepo/package_data/template/silas/examples/single-crystal.json b/sirepo/package_data/template/silas/examples/single-crystal.json index 2865a56062..1be12e1a37 100644 --- a/sirepo/package_data/template/silas/examples/single-crystal.json +++ b/sirepo/package_data/template/silas/examples/single-crystal.json @@ -72,7 +72,7 @@ }, "laserPulse": { "ccd": "", - "chirp": 0, + "chirp": 0.0012459, "distribution": "gaussian", "meta": "", "nslice": 3, diff --git a/sirepo/package_data/template/silas/parameters.py.jinja b/sirepo/package_data/template/silas/parameters.py.jinja index 7a7a4f08bc..b7356b2e95 100644 --- a/sirepo/package_data/template/silas/parameters.py.jinja +++ b/sirepo/package_data/template/silas/parameters.py.jinja @@ -91,6 +91,13 @@ def laser_pulse_ranges(wavefront): } +def crystal_ranges(crystal): + e = crystal.params.pop_inversion_mesh_extent + return { + "x": [-e, e], + "y": [-e, e], + } + def propagate(pulse, elements, beamline): crystal_count = 0 for idx in beamline: @@ -101,17 +108,24 @@ def propagate(pulse, elements, beamline): for s in range(e[0].nslice): h5_data[s] = PKDict( excited_states=e[0].slice[s].pop_inversion_mesh, - ranges=laser_pulse_ranges(pulse.slice_wfr(0)), + ranges=crystal_ranges(e[0]), ) + # write summary values in first slice + ( + h5_data[0].excited_states_longitudinal, + h5_data[0].total_excited_states, + ) = e[0].extract_excited_states() crystal_count += 1 template_common.write_dict_to_h5(h5_data, f"crystal{crystal_count}.h5") return pulse +crystal_init = set() def get_element(elements, index): e = elements[index] - if isinstance(e[0], Crystal): - e[0].calc_n0n2(set_n=True, mesh_density=e[2], heat_load=e[3]) + if isinstance(e[0], Crystal) and index not in crystal_init: + crystal_init.add(index) + e[0].calc_n0n2(set_n=True, mesh_density=e[2], heat_load=e[3], method=e[4]) return e diff --git a/sirepo/template/silas.py b/sirepo/template/silas.py index 9ca9793328..040d673b2e 100644 --- a/sirepo/template/silas.py +++ b/sirepo/template/silas.py @@ -22,7 +22,7 @@ _CRYSTAL_CSV_FILE = "crystal.csv" _RESULTS_FILE = "results{}.h5" _CRYSTAL_FILE = "crystal{}.h5" -_MAX_H5_READ_TRIES = 3 +_MAX_H5_READ_TRIES = 10 _ABCD_DELTA = 1e-3 @@ -173,7 +173,9 @@ def _determinant(matrix): pop_inversion_pump_offset_x=data.model.pump_offset_x, pop_inversion_pump_offset_y=data.model.pump_offset_y, ) - ).calc_n0n2(set_n=True, mesh_density=data.model.mesh_density) + ).calc_n0n2( + method=data.model.calc_type, set_n=True, mesh_density=data.model.mesh_density + ) d = _determinant(n) if abs(d - 1) > _ABCD_DELTA: return PKDict( @@ -228,9 +230,11 @@ def _file(element, count): crystal=_CRYSTAL_FILE.format(count.crystal), )[element.type] - def _frames(element, data): + def _frames(element, data, crystals): if element.type == "watch": return data.models.laserPulse.nslice + if element.reuseCrystal: + return crystals[element.reuseCrystal].nslice return element.nslice _initial_intensity_percent_complete(run_dir, res, data, ("beamlineAnimation0",)) @@ -239,16 +243,19 @@ def _frames(element, data): crystal=1, ) total_count = 1 + crystals = PKDict() for e in data.models.beamline: if e.type in ("watch", "crystal"): total_count += 1 _output_append( - _frames(e, data), + _frames(e, data, crystals), _file(e, count), count, e, res, ) + if e.type == "crystal": + crystals[e.id] = e res.percentComplete = res.frameCount * 100 / total_count return res @@ -388,6 +395,7 @@ def _generate_crystal(crystal): ["{crystal.propagationType}", True, False], {crystal.mesh_density}, "{crystal.pump_pulse_profile}", + "{crystal.calc_type}", ),\n""" @@ -463,11 +471,12 @@ class _LaserPulsePlot(PKDict): phase="Phase Slice #{slice_index}", intensity="Intensity Slice #{slice_index}", photons="Photons Slice #{slice_index}", + total_excited_states="Total Number of Excited States", ) _X_LABELS = PKDict( excited_states_longitudinal="Crystal Slice", - longitudinal_photons="Crystal width [cm]", + longitudinal_photons="Pulse Slice", longitudinal_intensity="Pulse Slice", longitudinal_frequency="Pulse Slice", longitudinal_wavelength="Pulse Slice", @@ -480,21 +489,9 @@ class _LaserPulsePlot(PKDict): phase="Phase [rad]", photons="Photons [1/m³]", excited_states="Number [1/m³]", + total_excited_states="", ) - def _cell_volume(self): - if self._is_crystal(): - return ( - ( - (2 * self.element.inversion_mesh_extent) - / self.element.inversion_n_cells - ) - ** 2 - * self.element.length - / self.element.nslice - ) - return None - def _fname(self): if self._is_crystal(): return _CRYSTAL_FILE @@ -516,19 +513,10 @@ def _plot_label(self): slice_index=self.slice_index + 1 ) - def _nslice(self, file): - if self._is_crystal(): - return self.element.nslice - return len(file) - def _x_label(self): return self._X_LABELS[self.plot_type] def _y_value(self, index, file): - if self._is_crystal(): - return numpy.sum( - numpy.array(file[f"{index}/excited_states"]) * self._cell_volume() - ) y = numpy.array(file[f"{index}/{self.plot_type}"]) if self.plot_type in self._SCALAR_PLOTS: return y @@ -540,12 +528,14 @@ def _z_label(self): def _gen_longitudinal(self, element_file): x = [] y = [] - nslice = self._nslice(element_file) - if self.element: - self.element.nslice = nslice - for idx in range(nslice): - x.append(self._index(idx)) - y.append(self._y_value(idx, element_file)) + + if self._is_crystal(): + x = (numpy.arange(len(element_file)) + 1).tolist() + y = (numpy.array(element_file["0/excited_states_longitudinal"])).tolist() + else: + for idx in range(len(element_file)): + x.append(self._index(idx)) + y.append(self._y_value(idx, element_file)) return template_common.parameter_plot( x, [ @@ -568,6 +558,8 @@ def gen(self): ) as f: if self._is_longitudinal_plot(): return self._gen_longitudinal(f) + if self.plot_type == "total_excited_states": + self.slice_index = 0 d = template_common.h5_to_dict(f, str(self.slice_index)) r = d.ranges z = d[self.plot_type] @@ -647,11 +639,3 @@ def _report_to_file_index(sim_in, report): return count_by_type[e.type], e count_by_type[e.type] += 1 raise AssertionError("{} report not found: {}".format(element_type, report)) - - -def _slice_n_field(crystal, field): - return ( - crystal[field][0 : crystal.nslice] - if crystal.nslice <= 6 - else f"interpolate_across_slice({crystal.length * 1e-2}, {crystal.nslice}, {crystal[field]})" - )