Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
Ansys Products

Ansys Products

Discuss installation & licensing of our Ansys Teaching and Research products.

Request for Assistance in Making Script Iterative in CFX-post

    • Dr Fatima Razavi, PhD in MEC ENG
      Subscriber

      Dear Community Members,

       
      I hope this message finds you in good health and high spirits. 
       
      I have attached a script file, which functions appropriately as a *.cse file when executed through "play a session" in CFX-post. However, I require assistance in making it iterative so that it can load 120 timesteps and export each timestep as a separate CSV file. Despite my attempts to achieve this by installing Padre and familiarizing myself with Perl scripting, I have been unable to find a satisfactory solution.
       
      Therefore, I kindly request your support in making this script iterative. The attached file functions correctly, but as soon as I introduce a loop, it fails to execute properly. 
       
      In light of these challenges, I believe attending a workshop on scripting/automation in CFD would greatly benefit me. While I am proficient in Unix Bash Scripting, I recognize the need to expand my knowledge in this area.
       
      Thank you for your attention to this matter. I sincerely appreciate your assistance.
       
      Warm regards,
      Fatemeh.

      ---------------------------------------------------------------------------------
      ---------------------------------------------------------------------------------
      # Session file started:  2023/06/20 11:37:39
      # CFX-21.2
       
      # To avoid unnecessary file pre-processing and modifications, include
      # COMMAND FILE at the top of your session file.
      # If it is not included, the file is assumed to be older and will be
      # modified for backward compatibility.
      COMMAND FILE:
        CFX Post Version = 21.2
      END
       
       
      PLANE:Plane 1
        Apply Instancing Transform = On
        Apply Texture = Off
        Blend Texture = On
        Bound Radius = 0.5 [m]
        Colour = 0.75, 0.75, 0.75
        Colour Map = Default Colour Map
        Colour Mode = Variable
        Colour Scale = Logarithmic
        Colour Variable = Ragweed.Averaged Volume Fraction
        Colour Variable Boundary Values = Conservative
        Culling Mode = No Culling
        Direction 1 Bound = 1.0 [m]
        Direction 1 Orientation = 0 [degree]
        Direction 1 Points = 10
        Direction 2 Bound = 1.0 [m]
        Direction 2 Points = 10
        Domain List = /DOMAIN GROUP:All Domains
        Draw Contours = Off
        Draw Faces = On
        Draw Lines = Off
        Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform
        Invert Plane Bound = Off
        Lighting = On
        Line Colour = 0, 0, 0
        Line Colour Mode = Default
        Line Width = 1
        Max = 0.0
        Min = 0.0
        Normal = 1 , 0 , 0
        Number of Contours = 11
        Option = XY Plane
        Plane Bound = None
        Plane Type = Slice
        Point = 0 [m], 0 [m], 0 [m]
        Point 1 = 0 [m], 0 [m], 0 [m]
        Point 2 = 1 [m], 0 [m], 0 [m]
        Point 3 = 0 [m], 1 [m], 0 [m]
        Range = Global
        Render Edge Angle = 0 [degree]
        Specular Lighting = On
        Surface Drawing = Smooth Shading
        Texture Angle = 0
        Texture Direction = 0 , 1 , 0
        Texture File =
        Texture Material = Metal
        Texture Position = 0 , 0
        Texture Scale = 1
        Texture Type = Predefined
        Tile Texture = Off
        Transform Texture = Off
        Transparency = 0.0
        X = 0.0 [m]
        Y = 0.0 [m]
        Z = 1.6 [m]
        OBJECT VIEW TRANSFORM:
          Apply Reflection = Off
          Apply Rotation = Off
          Apply Scale = Off
          Apply Translation = Off
          Principal Axis = Z
          Reflection Plane Option = XY Plane
          Rotation Angle = 0.0 [degree]
          Rotation Axis From = 0 [m], 0 [m], 0 [m]
          Rotation Axis To = 0 [m], 0 [m], 0 [m]
          Rotation Axis Type = Principal Axis
          Scale Vector = 1 , 1 , 1
          Translation Vector = 0 [m], 0 [m], 0 [m]
          X = 0.0 [m]
          Y = 0.0 [m]
          Z = 0.0 [m]
        END
      END
       
      # Sending visibility action from ViewUtilities
      >show /PLANE:Plane 1, view=/VIEW:View 1
       
      ##################
      > load timestep=35388
       
      EXPORT:
        ANSYS Export Data = Element Heat Flux
        ANSYS File Format = ANSYS
        ANSYS Reference Temperature = 0.0 [K]
        ANSYS Specify Reference Temperature = Off
        ANSYS Supplemental HTC = 0.0 [W m^-2 K^-1]
        Additional Variable List =
        BC Profile Type = Inlet Velocity
        CSV Type = CSV
        Case Name = Case 2nd3min7ms
        Export Connectivity = Off
        Export Coord Frame = Global
        Export File = E:/Fatemeh (Live Runs)/BEST CFD Runs/2023-06-05-Transient-\
      8Diff-4PartInj-FansSQ-0TO180-7ms/2023-06-05-ExhaustsOnWall-8SwirrlDiffON-\
      4Aerosolizers-FansFwBw7msSynchronized-FansSQ_003/CSV Files/348.csv
        Export Geometry = On
        Export Location Aliases =
        Export Node Numbers = Off
        Export Null Data = On
        Export Type = Generic
        Export Units System = Current
        Export Variable Type = Current
        External Export Data = None
        Include File Information = Off
        Include Header = On
        Location = CeilingWall
        Location List = /PLANE:Plane 1
        Null Token = null
        Overwrite = On
        Precision = 8
        Separator = ", "
        Spatial Variables = X,Y,Z
        Variable List = Ragweed.Averaged Volume Fraction
        Vector Brackets = ()
        Vector Display = Scalar
      END
      >export
    • Rob
      Forum Moderator

      We can't cover scripting in much detail, but...

      Check the CFD Post documentation or CFX Reference manual section on power syntax. You can embed perl statements in a .cse file. Any line starting with an ! is interpreted as a perl statement. Italics as a colleague told me - I don't use CFX. 

      What we have done before is to create a couple of dummy models. Create a report (in CFD Post) for the first model, then read the new case (same geometry but different file name) into CFD Post & update the report. The state file should give you the command syntax, repeat & then modify to suit the real model.  For 120 models you may want to borrow a student or write a Python/AWK script to generate the full journal but that depends on how complex the Perl bit is. 

Viewing 1 reply thread
  • The topic ‘Request for Assistance in Making Script Iterative in CFX-post’ is closed to new replies.
[bingo_chatbox]