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的圖像表達
作者:范文哲(fwz0703@163.com,公眾號:CAE_ANSYS)
工程師必備
- 項目客服
- 培訓客服
- 平臺客服
TOP




















