Simufact.Welding 6.0 热源二次开发的小例子
最近做了一个Simufact.Welding 6.0 热源二次开发的小例子,与坛友共勉:
1 主要目的:开始随时间变化的焊接热源,如脉冲热源
2 基本要求:
1)脉冲热源频率:8Hz
2)脉宽30ms
3)其它略
3 软件安装
1)simufact.welding 6.0
2)VS2010
3)Intel Visual Fortran Composer XE 2013
3 基本步骤
3.1 软件设置
安装完之后需要配置path、Lib和include三个环境变量。
以下列出环境变量值作为参考(需要根据VS和fortran的安装位置不同进行相应的修改)。---注:以下部分为参考网上内容,需要根据具体实际修改,如下面采用的是VS2012,XE2015,根据需要修改
Path:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools
C:\Program Files (x86)\Intel\Composer XE 2015\redist\intel64\mkl
C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin
C:\Program Files (x86)\Intel\MPI\5.0.1.037\intel64\bin
C:\Program Files (x86)\Intel\Trace Analyzer and Collector\9.0.1.035\bin
Lib:
C:\Program Files (x86)\Intel\Composer XE 2015\compiler\lib\intel64
C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\amd64
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib
INCLUDE:
C:\Program Files (x86)\Intel\Composer XE 2015\compiler\include
C:\Program Files (x86)\Intel\Composer XE 2015\mkl\include
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Includea
3.2 常规建立并设置simufact.welding工程
建立如下常规的simufact.welding工程
(常规建立过程省略)
图1 常规工程
主要坐标系为:沿X方向宽50mm,沿y方向板厚10mm,沿z方向长度50mm,焊接沿着z负方向,焊接起始点坐标(50,10,-50)【单位mm】,建立对称的一半模型。
3.3 建立.f子函数
subroutine uweldflux(f,temflu,mibody,welddim,time)
c f(1) flux value (to be defined)
c f(2) derivative of flux with respect to temperature
c (to be defined; optional, this might improve the
c convergence behavior)
c
c temflu(1) estimated temperature
c temflu(2) previous volumetric flux
c temflu(3) temperature at beginning of increment
c temflu(4,5,6)integration point coordinates
c mibody(1) element number
c mibody(2) flux type
c mibody(3) integration point number
c mibody(4) flux index - not used if table input
c mibody(5) not used
c mibody(6) =1 : heat transfer
c =2 : joule
c =3 : bearing
c =4 : electrostatic
c =5 : magnetostatic
c =6 : acoustic
c mibody(7) internal element number
c mibody(8) layer number for heat transfer shells elements
c and volume flux
c mibody(9) Not used
c mibody(10) boundary condition number if table input
c time time
c
dimension mibody(*),temflu(*),welddim(*)
real*8 f
integer mibody
real*8 temflu,time,welddim
c* * * * * *
c OPEN(UNIT=10,FILE='HELLO.TXT',POSITION='APPEND')
a=0.003
b=0.003
c=0.003
v=0.01
T0=0.125
temp=0.03
xis=1
zq=ceiling(time/T0)
if(abs(MOD(time-temp,T0)).LT.1e-6) then
xis=0
c write(10,*) time, 111
else if(abs(MOD(time,T0)).LT.1e-6) then
xis=1
c write(10,*) time,222
else if ((time.LT.(zq*T0)).and.(time.GT.((zq-1)*T0+temp))) then
xis=0
c write(10,*) time, 333
else
xis=1
c write(10,*) time, 444
end if
d=0.05-v*time
q=7000*0.7
pi=3.14
x=temflu(4)
y=temflu(5)
z=temflu(6)
mibody(6)=1
y0=0.009
x0=0.05
heat=6*sqrt(3.0)*q/(a*b*c*pi)
ex=exp(-3*(z-d)**2/c**2-3*(y-y0)**2/b**2-3*(x-x0)**2/a**2)
f=heat*ex*xis
c write(10,*) time, xis,f
c close(10)
return
end
并存为文件名rey.f
3.4 开始子函数运行
1)点击常规项目的运行按钮
略
图2 点击运行按钮
点击后出现运行对话框,不用管它,直接关闭。
略
图3 运行对话框(直接关闭)
2)此时找到你常规工程下的_Run_文件夹位置并打开该文件夹
图4 该工程的_Run_文件夹
会发现该文件夹下面有Process.dat文件和run.bat文件。
3)用记事本方式打开并修改Process.dat文件(此步不可少!)
找到“WELD FLUX - Definitions of Motion and Flux Parameters for Weld Heat Source”这一行,并修改这一行下面的第5行第三列的值改为3,如下图中的6改为3
图5 修改前
图6 修改后
修改完成后保存。
4)用记事本打开并修改run.bat文件
图7 修改前
run.bat中的call后面为你的simufact.welding6.0安装后run_sfMarc.bat的位置
我的上述内容改为:
call "E:\software\special\simufact6\simufact\welding\6.0\solver\simufact\sfMarc\sf_tools\run_sfMarc.bat" -nthread_solver 2 -nthread_elem 2 -j F:\study\softwarestudy\software\simufact\marc_link\marc\Process\_Run_\Process.dat -u F:\study\softwarestudy\software\marc\udf_weldtool\rey.f -save yes
需要说明的是:
-j 后面增加刚才修改的Process.dat的位置
-u 后面增加刚才rey.f文件的位置
增加
-save yes
修改完成后并保存退出
5)命令运行run.bat
图8 点击红色框中的黑色小三角并选择“Open a shell”
图9 点击红色框中的黑色小三角并选择“Open a shell”
在出现的对话框中输入“run.bat”并回车
运行一段时间后可以看到Results出现,即可得到想要的结果。
热源的脉冲效果如下:
具体内容详见附件的文件“Simufact.Welding 6.0 热源二次开发初步教程.doc”
连专门做焊接仿真的软件都要自定义热源?
,
楼主有用abaqus做么