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. Python API
  4. one document with many simulations

one document with many simulations

Scheduled Pinned Locked Moved Python API
5 Posts 2 Posters 584 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.
  • M Offline
    M Offline
    michaelsch
    wrote on last edited by michaelsch
    #1

    Hi what is best way to run multiple simulations and save the results.
    lets say each simulation has different property of location or frequency or even mesh.
    my general script :

    for in range(1,100)
       s4l.document.New()  # generated per simulation
       project_path = 'somedirectory generated'
       sim = lf.ElectroStaticSimulation()
       sim.Name = 'sim ' + str(i)
       sim.RunSimulation(wait=True) 
       document.AllSimulations.Add(sim)
       results = sim.Results()
       document.AllAlgorithms.Add(...)
    

    so genereted many folders each folder one simulation with .smash and outputs , if i try just one folder it just growing and growing. in both situations the Sim4life get stuck

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

      There is no need to create a new sim4life project for each simulation (a single sim4life file supports multiple simulations), you can just work off the same project file:

      Just comment out: s4l.document.New() # generated per simulation

      M 1 Reply Last reply
      1
      • M montanaro

        There is no need to create a new sim4life project for each simulation (a single sim4life file supports multiple simulations), you can just work off the same project file:

        Just comment out: s4l.document.New() # generated per simulation

        M Offline
        M Offline
        michaelsch
        wrote on last edited by
        #3

        @montanaro and how to run on all simulations, :
        start new, finish ,save?
        i tried to add many simulations to one document but i see each time save larger and larger files , so i suppose something isn't cleared.

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

          I think what you want is to run the simulations, extract some results, delete the simulation, and then run a new one? The more simulations you have the larger the files will be and simulation results typically take up a lot of space. You can create and run as many simulations as you like in any document, but if you want to get rid of any simulations you need to delete it manually. You can automate all of this with Python

          1 Reply Last reply
          0
          • M Offline
            M Offline
            michaelsch
            wrote on last edited by
            #5

            can you supply some code example ? thanks

            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