-
-
October 26, 2021 at 5:35 pm
marcansyl
SubscriberHi 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
October 26, 2021 at 9:02 pmAndreas Koutras
Ansys EmployeeHi 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);
October 27, 2021 at 4:50 pmmarcansyl
SubscriberThanks,
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
October 27, 2021 at 7:08 pmAndreas Koutras
Ansys EmployeeHi 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.
Ansys Innovation SpaceTrending discussionsTop Contributors-
3190
-
1024
-
962
-
858
-
798
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
The Ansys Learning Forum is a public forum. You are prohibited from providing (i) information that is confidential to You, your employer, or any third party, (ii) Personal Data or individually identifiable health information, (iii) any information that is U.S. Government Classified, Controlled Unclassified Information, International Traffic in Arms Regulators (ITAR) or Export Administration Regulators (EAR) controlled or otherwise have been determined by the United States Government or by a foreign government to require protection against unauthorized disclosure for reasons of national security, or (iv) topics or information restricted by the People's Republic of China data protection and privacy laws.