How to automate pressure load on FSI faces in vibro-acoustics?

Erik Kostson
Member, Moderator, Employee Posts: 323
✭✭✭✭
So say we have 2 named selections (NS), called fs1 and fs2. How can we loop through them and apply a pressure load and find the correct structural body only associated with that face/NS using scripting?
0
Best Answers
-
Below is one way of doing this (it uses and assumes that on the shared FSI face, we need to get the structural body and not the Fluid/Acoustic body with Water Liquid material, for the shared reference body):
- model=ExtAPI.DataModel.Project.Model # refer to Model
- analysis = model.Analyses[0]
- solution = analysis.Solution
- impLoadGrp = ExtAPI.DataModel.GetObjectsByName('Imported Load (A2) ')[0] # change as needed
- geodata = ExtAPI.DataModel.GeoData
- ans=model.NamedSelections.Children
- for ns in ans:
- presload=impLoadGrp.AddImportedPressure()
- presload.Location=ns
- my_geob = geodata.GeoEntityById(ns.Location.Ids[0]).Bodies
- for myb in my_geob:
- my_treeb = ExtAPI.DataModel.Project.Model.Geometry.GetBody(myb)
- if my_treeb.Material != 'Water Liquid':
- presload.SharedRefBody=my_treeb
0 -
or if we have all of the FSI faces in one named selection instead (called here myfsi - change name as needed), then the below might help:
- model=ExtAPI.DataModel.Project.Model # refer to Model
- analysis = model.Analyses[0]
- solution = analysis.Solution
- impLoadGrp = ExtAPI.DataModel.GetObjectsByName('Imported Load (A2) ')[0] # change as needed
- geodata = ExtAPI.DataModel.GeoData
- ns=ExtAPI.DataModel.GetObjectsByName('myfsi')[0] # change name of NS as needed
- nsids=ns.Location.Ids
- for nsi in nsids:
- presload=impLoadGrp.AddImportedPressure()
- selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
- selection.Ids=[nsi]
- presload.Location=selection
- selection=ExtAPI.SelectionManager.ClearSelection()
- my_geob = geodata.GeoEntityById(nsi).Bodies
- for myb in my_geob:
- my_treeb = ExtAPI.DataModel.Project.Model.Geometry.GetBody(myb)
- if my_treeb.Material != 'Water Liquid':
- presload.SharedRefBody=my_treeb
0
This discussion has been closed.