General Mechanical

General Mechanical

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

Set up time steps more efficiently

    • zzhang868
      Subscriber

      Hi all, I’m wondering if we can use APDL commands under "Analysis Settings" to automate the process of inputting data for each time step, instead of doing it manually. Would this be more efficient?


      This is my current script:

      ! Define the temperature values for each cycle (2400 seconds cycle)
      *DIM,TEMP_ARRAY,ARRAY,5,1
      TEMP_ARRAY(1) = 0   ! Temperature at 0 seconds
      TEMP_ARRAY(2) = 0   ! Temperature at 600 seconds
      TEMP_ARRAY(3) = 125 ! Temperature at 1200 seconds
      TEMP_ARRAY(4) = 125 ! Temperature at 1800 seconds
      TEMP_ARRAY(5) = 0   ! Temperature at 2400 seconds
       
      ! Loop over each of the 400 steps (100 cycles total)
      *DO,I,1,400
          ! Calculate the index in the temperature array (cycles every 5 steps)
          INDEX = MOD(I-1,5) + 1
          
          ! Apply the temperature at the current step
          ALLSEL,ALL
          SF,ALL,CONV,TEMP_ARRAY(INDEX)
      *ENDDO

      Since I have input some data via GUI, I am wondering whether APDL commands will overread what I have input manually. Any suggestions would be appreciated! Thanks!

    • mjmiddle
      Ansys Employee

      You can aqply a load by APDL if you want. You are applying it by independent SF command so it won't override any load Mechanical defines unless a native load in Mechanical also creates this SF comand on the same nodes.
      However, your APDL code is not right because it just keeps applying the same 5 index values over again without a time index or TIME command or issuing SOLVE command each time. You can use a table that contains the time and magnitude data in the SF command. See the help for the SF command:
      https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v242/en/ans_cmd/Hlp_C_SF.html

      Example: The following table has 4 rows, with times 0 sec, 0.3 sec, 0.7 sec, 1 sec

      *DIM,_convec_data,TABLE,4,1,1,TIME, , , 0
      ! Time values
      *TAXIS,_convec_data(1),1,0.,0.3,0.7,1.
      ! Load values
      _convec_data(1,1,1) = 10.2
      _convec_data(2,1,1) = 11.4
      _convec_data(3,1,1) = 12.6
      _convec_data(4,1,1) = 14.0
      sf,all,conv,%_convec_data%

      You should also apply another table for the value 2 as the bulk fluid temperatures:
      SF, Nlist, Lab, VALUE, VALUE2, – ,MESHFLAG

    • mjmiddle
      Ansys Employee

      In a native Mechanical convection load, you could also paste the data from Excel by selecting rows, then right clicking to choose "Paste Cell":

      You could also use python scripting in Mechanical to create the convection load and populate the table data. Table data uses a "field" variable. See all the sections under:

      https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/v242/en/act_script/mech_apis_BoundaryConditions.html 

    • zzhang868
      Subscriber

      Thank you! If I set up "convection" halfway using the GUI and then plan to use APDL, will the contents in APDL overwrite the manually input settings from the GUI?

    • mjmiddle
      Ansys Employee

      In most cases, probably not unless you were careful to use the same IDs written by Mechanical, such as real constants, element type IDs, etc...

      The loads you define by APDL will usually be separate and additional from what Mechanical writes.

      But there could be some conflict applying the same type of load on the same nodes or elements.

    • zzhang868
      Subscriber

      Thanks! I am wondering if it’s possible to use APDL to set up "Analysis Settings" directly, instead of manually entering the "Number of Steps" and "Step End Time" in the GUI. When dealing with many time steps, setting up the "Step End Time" for each step manually can be time-consuming. If it is doable, could you please share a detailed procedure to avoid any conflicts between the GUI and APDL?

    • mjmiddle
      Ansys Employee

      Not really if you have multiple load steps, and it sounds like the reason you want to do this is because you have a large amount of load steps. You would need to completely replace all the time stepping and solve commands in APDL. You could use a *DO loop for this. This will overide all the solve commands that Mechanical writes for each load step and could really mess things up with your loading for any loading that changes between load steps, such as activation state of loads/supports. You are better setting up the load steps in Mechanical not APDL. Check out the "Analysis Settings Importer" extension in the ACT Store:

      https://catalog.ansys.com

    • zzhang868
      Subscriber

      I see. If I’ve set up a few time steps using the GUI and then switch to using this app, do I need to clear my GUI settings, or will they be overwritten? Similarly, with APDL, if I manually input steps in the GUI, do I need to clear those settings before using APDL? Additionally, how do I clean up the settings in the GUI? Do I have to load a new module? Thanks!

    • zzhang868
      Subscriber
      I have a few questions regarding the usage of the suggested extention.
       
      In the example csv "AS.csv", we have

       
      However, if I want to set "Time Stepping" to be "Off", how can I set up the left settings (e.g., time step, time integration)?
       
       
      I tried using the following format, but it didn’t import the settings correctly.
       
       
      Could you please provide a sample CSV file with "time stepping" turned off and the other follow-up settings included (i.e., the setting in the ANSYS screenshot, 2nd screenshot in this message)?
       
      Additionally, my ANSYS version is 2023R2, but the latest version of the app is from 2019. I'm not sure if this might affect the functionality of ANSYS.

      Thank you so much!
    • mjmiddle
      Ansys Employee

      Sorry, but free ACT extensions are not supported and I don't have great expertise with this extension. There is a doc file inside the download that contains a pdf file for instructions on how to use the extension. You can edit the extension's python file for your own needs.

      Yes, it was last updated for Ansys 19.0 so may not work correctly in newer versions.

      • zzhang868
        Subscriber

        Thank you all the same!

Viewing 9 reply threads
  • You must be logged in to reply to this topic.