How can we automatically export far-field directivities from a parametric study?

Erik Kostson
Erik Kostson Member, Moderator, Employee Posts: 312
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭
edited February 24 in Structures

How can we automatically export far-field directivities from a harmonic acoustic analysis when performing a parametric study?

Best Answer

  • Erik Kostson
    Erik Kostson Member, Moderator, Employee Posts: 312
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited February 24 Answer ✓

    Below is one way of doing that (using python code object - after post). It assumes that we have a harmonic acoustic analysis with a results object called Far-field Maximum Scattered Pressure.

    Script:

    def after_post(this, solution):# Do not edit this line
        """
        Called after post processing.
        Keyword Arguments : 
            this -- the datamodel object instance of the python code object you are currently editing in the tree
            solution -- Solution
        """
    
        # To access properties created using the Property Provider, please use the following command.
        # this.GetCustomPropertyByPath("your_property_group_name/your_property_name")
    
        # To access scoping properties use the following to access geometry scoping and named selection respectively:
        # this.GetCustomPropertyByPath("your_property_group_name/your_property_name/Geometry Selection")
        # this.GetCustomPropertyByPath("your_property_group_name/your_property_name/Named Selection")
        myfile='D:\maxprefarfield.txt' # change as needed
        ffr=ExtAPI.DataModel.GetObjectsByName('Far-field Maximum Scattered Pressure')[0]
        ffr.Activate()
        ffr.ExportToTextFile(myfile)
    

    to get the current design point (say in order to include it in the saved file name use this:

    import wbjn
    dpn=wbjn.ExecuteCommand(ExtAPI,"returnValue(a+Parameters.GetActiveDesignPoint().Name)",a="DP")

This discussion has been closed.