Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Simulations & Solvers
  4. How to use a script to automatically open an already run simulation

How to use a script to automatically open an already run simulation

Scheduled Pinned Locked Moved Simulations & Solvers
3 Posts 3 Posters 305 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pyf
    wrote on last edited by
    #1

    I need to add a temperature simulation to the EM simulation as well as the run

    S 1 Reply Last reply
    0
    • M Offline
      M Offline
      montanaro
      wrote on last edited by
      #2

      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()

      1 Reply Last reply
      0
      • P pyf

        I need to add a temperature simulation to the EM simulation as well as the run

        S Offline
        S Offline
        sayimgokyar
        wrote on last edited by
        #3

        @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 )

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Search