作者简介
本文作者:大龙猫_范文哲
本文由作者发布于技术邻平台,转载需取得作者授权。
大龙猫_范文哲,长期从事CAE仿真分析工作,专注于ANSYS Workbench,熟悉ANSYS中的静态\瞬态状态下的结构、电磁、温升及耦合场模块仿真。
在ANSYS仿真中经常会遇到一些动态的加载方法,加载的载荷(位移、力、电流、温度等)随着时间而变化,表示不同的状态。而相应的在workbench中可以方便的采用表格方法设置不同时间状态下加载的位移或受力等载荷。但是又实用需要APDL命令的方式书写不同时刻的载荷,但是函数库当中又没有相应的函数,那么如何书写呢,下面我们选取几个有代表性的书写方法
(1)三角波的使用
一个物体在一个平面上移动,从左到右匀速运动,然后再从右到左的匀速运动。如果次数多,则采用表格方式实现比较麻烦,而采用do循环命令的方式就可以方便的加载。
该方法可以采用三角波的形式,给物体一个位移,使它不断的左右移动,获取摩擦热或者应力应变等过程方法如下:
*do,x,1,25,1
cc=ABS(ASIN(ABS(SIN((x+PI()/2)/2)))-PI()/4)!取三角函数
time,x
f,load,ux,cc
*enddo
结果如图所示
其表达式为
(2)方波函数的使用
方波函数可以表达随时间变化过程中给定一定的载荷,过一段时间之后去除载荷(或者反向载荷),之后再重复以上的
过程,主要应用于电流相关的加载过程
pi=atan(1)*4
*do,i,1,15,1
*if,cos(2*pi*f*time)-cos(比例*pi),LE,0
f,load,ux,1000
*else
f,load,ux,0
*endif
*enddo
结果如图所示
更改比例值,可以改变上方方波所占的比例
(3)斜坡函数
斜坡函数可以表达随时间变化过程中加载的载荷逐渐增大,过一段时间从0开始重新加载,如此循环载荷,之后再重复
以上的过程,主要应用受力变化或循环位移等过程
*do,i,1,25,1
cc=mod(i,10) !取余数
time,i
f,load,ux,cc
*enddo
结果如图所示
(4)奇偶数判断
判断给定的标识是否为奇数或偶数,相应的可以给定不同的边界条件,同样可以应用于方波函数的加载
*do,i,1,15,1
*if,abs(nint(i/2)-i/2),le,0.3,then
aa=i
*else
aa=0
*endif
*enddo
另外附上帮众文档给定的数学函数
ABS(x)
Absolute value of x.
SIGN(x,y)
Absolute value of x with sign of y. y=0 results in positive sign.
CXABS(x,y)
Absolute value of the complex number x + yi ( )
EXP(x)
Exponential of x (ex).
LOG(x)
Natural log of x (ln (x)).
LOG10(x)
Common log of x (log10(x)).
SQRT(x)
Square root of x.
NINT(x)
Nearest integer to x.
MOD(x,y)
Remainder of x/y, computed as x - (INT(x/y) * y). y=0 returns zero (0).
RAND(x,y)
Random number (uniform distribution) in the range x to y (x = lower bound, y = upper bound).
GDIS(x,y)
Random sample of a Gaussian (normal) distribution with mean x and standard deviation y.
SIN(x), COS(x), TAN(x)
Sine, Cosine, and Tangent of x. x is in radians by default, but can be changed to degrees with *AFUN.
SINH(x), COSH(x), TANH(x)
Hyperbolic sine, Hyperbolic cosine, and Hyperbolic tangent of x.
ASIN(x), ACOS(x), ATAN(x)
Arcsine, Arccosine, and Arctangent of x. x must be between -1.0 and +1.0 for ASIN and ACOS. Output is in radians by default, but can be changed to degrees with *AFUN. Range of output is -pi/2 to +pi/2 for ASIN and ATAN, and 0 to pi for ACOS.
ATAN2(y,x)
Arctangent of y/x with the sign of each component considered. Output is in radians by default, but can be changed to degrees with *AFUN. Range of output is -pi to +pi.
VALCHR(CPARM)
Numerical value of CPARM (if CPARM is non-numeric, returns 0.0).
CHRVAL(PARM)
Character value of numerical parameter PARM. Number of decimal places depends on magnitude.
UPCASE(CPARM)
Upper case equivalent of CPARM.
LWCASE(CPARM)
Lower case equivalent of CPARM.
LARGEINT(x,y)
Forms a 64-bit pointer from low (x) and high (y) 32-bit integers.
如需获取excel的图像表达,请点击阅读原文
-END-