We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.
LS Dyna

LS Dyna

Topics related to LS-DYNA, Autodyn, Explicit STR and more.

Variable to refer to current time in user defined function

    • marcansyl
      Subscriber

      Hi all,


      I am currently defining a user-defined function using Beam in Solid. I want to refer to the current time in my function ? What is the global variable used by LS Dyna for the time. My analysis is run for a time range between 0 and 400, and my timestep is 1. This means I will have 401 different times for the function to be called. And What I want to know is how to call the current time each time the function is called. is it "t" ? "time" ? or ...?


      Thanks,

      Marc

    • Andreas Koutras
      Ansys Employee
      Hi Marc, add the following line to confirm that the current time is printed in the terminal screen. Let me know if this works.
      print(time);
    • marcansyl
      Subscriber
      Thanks,
      I still cannot use the time as condition in if in my code.
      what I want is to have for instance : if (time>200) {shear=0;}
      when I do that, it gives me shear = 0 for all time between 0 and 400.

      Marc

    • Andreas Koutras
      Ansys Employee
      Hi Marc, check your function with a simple model. What happens to "shear" when time<200? The "time" variable works . Take a look at the sample function below. It will be much more challenging to implement a model in the umat package.
      *DEFINE_FUNCTION
      $#fidheading
      99
      $#function
      float force(float slip,float leng, float *stiff)
      {
      float force;
      if (time>5.e-4) {force=0.1;}
      print(time);
      print(force);
      *stiff=100000.0;
      return force;
      }
Viewing 3 reply threads
  • The topic ‘Variable to refer to current time in user defined function’ is closed to new replies.