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.
General

General

How do I check for the first iteration of the transient time step within a UDF?

    • FAQFAQ
      Participant

      It might be needed to identify the first iteration of a timestep in a UDF, for example when using a DEFINE_ADJUST macro which is called every iteration by default, even for transient analyses. The UDF below is an example that uses a if clause to check if the first iteration is currently being executed. The variable first_iteration is built in and no special declaration is needed. Also, if you want to run in reverse at the end of a time step, you can also use the DEFINE_EXECUTE_AT_END macro. DEFINE_ADJUST(myadjust,d) { if (first_iteration){ Message(“FIRST ITERATION!!n”); } }