I need to add a temperature simulation to the EM simulation as well as the run
How to use a script to automatically open an already run simulation
Have you created doing this manually and then right clicking on the final simulation and selecting 'To Python..'
once you have your simulation object there should be something like sim.Run()
@pyf
Hi,
This is what I found in the tutorial scripts for thermal simulations.
Check the RunTutorial function. It may help. Best.
def CreateModel():
...
def CreateEmFdtdSimulation():
...
return em_sim
def CreateThermalSimulation(em_sim):
...
return thermal_sim
def AnalyzeEmAndThermalSimulation(em_sim,thermal_sim):
# Create extractor for the two simulation output files
em_results = em_sim.Results()
thermal_results = thermal_sim.Results()
# overall field sensors
em_overall_field_sensor = em_results[ 'Overall Field' ]
em_overall_field_sensor.Normalization.Normalize = True
thermal_overall_field_sensor = thermal_results[ 'Overall Field' ]
# Create a slice viewer for the SAR
slice_field_viewer_sar = analysis.viewers.SliceFieldViewer()
slice_field_viewer_sar.Visualization.Smooth = True
slice_field_viewer_sar.Inputs[0].Connect( em_overall_field_sensor['SAR(x,y,z,f0)'] )
slice_field_viewer_sar.Update(0)
slice_field_viewer_sar.GotoMaxSlice()
document.AllAlgorithms.Add( slice_field_viewer_sar )
#THERMAL
slice_field_viewer_t = analysis.viewers.SliceFieldViewer()
slice_field_viewer_t.Visualization.Smooth = True
slice_field_viewer_t.Inputs[0].Connect( thermal_overall_field_sensor['T(x,y,z,t)'] )
slice_field_viewer_t.Update(0)
document.AllAlgorithms.Add( slice_field_viewer_t )
def RunTutorial( path ):
document.New()
CreateModel()
em_sim = CreateEmFdtdSimulation()
document.AllSimulations.Add(em_sim)
em_sim.UpdateGrid()
em_sim.CreateVoxels(path)
thermal_sim = CreateThermalSimulation(em_sim)
document.AllSimulations.Add(thermal_sim)
thermal_sim.UpdateGrid()
thermal_sim.CreateVoxels(path)
em_sim.RunSimulation(wait=True)
thermal_sim.RunSimulation(wait=True)
AnalyzeEmAndThermalSimulation(em_sim,thermal_sim)
if name == 'main':
RunTutorial( project_path )