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. RuntimeError: Failed to create voxels. No valid grid configuration available.

RuntimeError: Failed to create voxels. No valid grid configuration available.

Scheduled Pinned Locked Moved Python API
5 Posts 2 Posters 124 Views 2 Watching
  • 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
    mypi
    wrote last edited by
    #1

    Modifying the jupyter tutorial for the pTxCoil emfdtd, where I have basically just replaced the model with my own, I am incapable of voxeling:

    The modelling checks out fine. It plots everything and it looks sane. In the Simulation section, the usual stuff shows up,

    Can anyone discuss why voxeling sometimes fail...

    This is a summary of the many lines error output:

    Error : Unable to retrieve information from model analyzer for entity id ffa14448-e74a-4fb1-add7-d970a1b4afeb
    Error : Unable to analyze components: Grid driver task(s) failed.
    Error : Failed to update grid after processing all components.
    Error : Unable to compute grid.
    ...
    Traceback (most recent call last):
    File "...johndoe.py", line 713, in <module>
    main()
    File "..johndoe.py", line 709, in main
    RunTutorial(project_path)
    File "..johndoe.py", line 681, in RunTutorial
    sim.CreateVoxels(smash_path)
    File "C:\Program Files\Sim4Life_8.2.0.16876\Python\Lib\site-packages\s4l_v1\simulation_emfdtd_impl.py", line 1005, in CreateVoxels
    self.raw.CreateVoxels()
    RuntimeError: Failed to create voxels. No valid grid configuration available.

    def RunTutorial(smash_path):
        document.New()
        CreateModel()
    
        sim = CreateSimulation(use_graphcard=False)
    
        document.AllSimulations.Add(sim)
    
        sim.UpdateGrid()
        sim.CreateVoxels(smash_path)
        # Note, keep this flag to true even if no further processing is being done
        # ask PC or MaG
        sim.RunSimulation(True)  # True = wait until simulation has finished
    
    
    def main(data_path=None, project_dir=None):
        """
        data_path = path to a folder that contains data for this simulation (e.g. model files)
        project_dir = path to a folder where this project and its results will be saved
        """
        import os
        import sys
    
        print("Python ", sys.version)
        print("Running in ", os.getcwd(), "@", os.environ["COMPUTERNAME"])
    
        if project_dir is None:
            project_dir = os.path.expanduser(
                os.path.join("~", "Documents", "s4l_python_tutorials")
            )
    
        if not os.path.exists(project_dir):
            os.makedirs(project_dir)
    
        fname = os.path.splitext(os.path.basename(_CFILE))[0] + ".smash"
        project_path = os.path.join(project_dir, fname)
    
        RunTutorial(project_path)
    
    
    if __name__ == "__main__":
        main()
    
    1 Reply Last reply
    0
    • brynB Offline
      brynB Offline
      bryn
      ZMT
      wrote last edited by bryn
      #2

      Not sure what is wrong, but I would look for the model entity with the Id "ffa14448-e74a-4fb1-add7-d970a1b4afeb", i.e.,

      import XCore
      import XCoreModeling as xcm
      
      all_entities = xcm.GetActiveModel().GetEntities()
      all_entities = xcm.CollectEntities(all_entities)
      
      for entity in all_entities:
          if entity.Id = XCore.Uuid("ffa14448-e74a-4fb1-add7-d970a1b4afeb"):
              print(f"Entity {entity.Name}: valid={entity.Valid}, type={type(entity)}")
      

      For some reason the gridder cannot process it. "Valid==False" means it was deleted from the model, but you still have an (invalid) handle.

      M 1 Reply Last reply
      0
      • brynB bryn

        Not sure what is wrong, but I would look for the model entity with the Id "ffa14448-e74a-4fb1-add7-d970a1b4afeb", i.e.,

        import XCore
        import XCoreModeling as xcm
        
        all_entities = xcm.GetActiveModel().GetEntities()
        all_entities = xcm.CollectEntities(all_entities)
        
        for entity in all_entities:
            if entity.Id = XCore.Uuid("ffa14448-e74a-4fb1-add7-d970a1b4afeb"):
                print(f"Entity {entity.Name}: valid={entity.Valid}, type={type(entity)}")
        

        For some reason the gridder cannot process it. "Valid==False" means it was deleted from the model, but you still have an (invalid) handle.

        M Offline
        M Offline
        mypi
        wrote last edited by
        #3

        @bryn
        Thank for the advice bryn. It turned out my phantom was passed on as an entitygroup and not a solid with a volume. When extracting it, the voxeling completed for that and the rest of the parts... It currently runs, but I will try your suggestion when it is done.

        1 Reply Last reply
        0
        • brynB Offline
          brynB Offline
          bryn
          ZMT
          wrote last edited by bryn
          #4

          Hmm, i wonder if that is a bug. The EntityGroup should not be assigned to any simulation settings, like grid settings.

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

            So my problem was solved for the simple phantom a sphere. It can be voxeled. I am having a discussion with chatgpt about how to load Duke into the simulation section because currently it wont be voxeled. Is there a simple few lines of code that loads Duke and all the default tissue electrical properties or is it necessary to assign each tissue type in a loop or via thousands lines of code (as I have seen elsewhere)....

            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