Skip to content
  • Search
Skins
  • Light
  • Brite
  • 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. What is the proper workflow for generating unstructured/multidomain meshes?

What is the proper workflow for generating unstructured/multidomain meshes?

Scheduled Pinned Locked Moved Solved Python API
2 Posts 1 Posters 1.0k Views 1 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.
  • D Offline
    D Offline
    david_lloyd
    wrote on last edited by
    #1

    Hello! I've been working with the Python API for a while now primarily using voxelling and grid settings for structured solvers. Does the Python API support unstructured, multidomain meshing and unstructured solvers? If so, assuming I already have a model object that I want to mesh, what is the proper workflow to do so?

    Thanks!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      david_lloyd
      wrote on last edited by david_lloyd
      #2

      Nevermind, I found example code in the "tutorial_emlf_unstructured_neuron_electroceuticals.py" example file, see below:

      def CreateMesh():
      	""" Creates a Multidomain Mesh with predefined priorities between domains
              and specified global and local options                        	"""
      
      	sel=.05  # Suface Edge Length
      	mel=.002 # Min Edge Length
      	
      	#create multi-domain mesh
      	global_opt = xcm.GlobalUnstructuredMeshingOptions()
      	global_opt.SurfaceEdgeLength = sel
      	global_opt.MinEdgeLength = mel
      
      	# Gets all the entities in the folder 'Nerve_Model'	
      	entities=s4l.model.AllEntities()['Nerve_Model'].Entities
      	
      	local_opt_dict={}
      	for ent in entities:
      		local_opt = xcm.LocalUnstructuredMeshingOptions()
      		print((ent, ent.Name))
      		if 'Saline' in ent.Name :
      			local_opt.Priority=0
      		elif 'Silicone' in ent.Name :
      			local_opt.Priority=1
      		elif 'Electrode' in ent.Name :
      			local_opt.Priority=2
      		elif 'Nerve' in ent.Name :
      			local_opt.Priority=3
      		elif 'Interstitial' in ent.Name :
      			local_opt.Priority=4
      		elif 'Connective' == ent.Name :
      			local_opt.Priority=5
      		elif 'Connective_' in ent.Name :
      			local_opt.Priority=5
      		elif 'Blood' in ent.Name :
      			local_opt.Priority=6	
      		elif 'Fascicle' in ent.Name :
      			local_opt.Priority=7
      		local_opt_dict[ent]=local_opt	
      		print((local_opt.Priority))
      		
      	# Creates an unstructured mesh on the domains using the defined options
      	mesh = xcm.GenerateUnstructuredMesh(entities, global_opt, local_opt_dict)
      	
      	return
      

      I did have a followup, how do we optimize the surface edge length and minimum edge lengths?

      1 Reply Last reply
      0
      • D david_lloyd has marked this topic as solved on

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      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