General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Importing a CFD pressure load to Mechanical using Scripting

    • dc3g20
      Subscriber

      I have a Workbench system as shown: 

      A Fluent file provides a CFD pressure load to a wing model. To import this manually, I go to Mechanical > Static Structural > Imported Load (B3) and Insert Pressure. In the settings dropdown I then select which CFD surface I want as shown below, then apply that to the skin of my wing.

      I wish to automate this process for many wing models. However, I cannot find the function in Mechanical scripting to call a given 'CFD Surface' and import the associated pressure as a load. I tried using the 'Record' function and setting it up manually, which gives this code, but it gives an error 'AttributeError: 'NoneType' object has no attribute 'AddImportedPressure'':

      #region Context Menu Action
      imported_load_group_140 = DataModel.GetObjectById(140)
      imported_pressure_141 = imported_load_group_140.AddImportedPressure()
      #endregion

      #region Details View Action
      selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
      selection.Ids = [30]
      imported_pressure_141.Location = selection
      #endregion

      imported_load = DataModel.GetObjectById(141)
      imported_load.ImportLoad()
      # 

       

      Can anyone help me debug this code??

    • Erik Kostson
      Ansys Employee

       

       

       

      Hi

      Do not think that (choose cfd surface) is exposed .

      I believe the imported pressure load picks up the first cfd surface (in alphabetic order) from your named selections (ns) in the cfd simulation so if you call it acfdsurface it should pick it up automatic (the rest would be wall, inlet, and outlet ns so it will be first in that order and will be asigned to the imported pressue load added and under cfd surface).

      All the best

      Erik

       

       

       

       

       

       

Viewing 1 reply thread
  • You must be logged in to reply to this topic.