用VC_研发基于FLUENT的高压气淬过程数值模拟软件_英文_第1页
用VC_研发基于FLUENT的高压气淬过程数值模拟软件_英文_第2页
用VC_研发基于FLUENT的高压气淬过程数值模拟软件_英文_第3页
用VC_研发基于FLUENT的高压气淬过程数值模拟软件_英文_第4页
用VC_研发基于FLUENT的高压气淬过程数值模拟软件_英文_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第 10卷 第 15期 2010年 5月 167121815(2010 1523772206科 学 技 术 与 工 程Science Technol ogy and Engineering Vol 110 No 115 M ay 2010 2010 Sci 1Tech 1Engng 1用 VC+研发基于 F LUENT 的高压气淬过程数值模拟软件胡祥敏 黄 鹏1, 2(广东科学技术职业学院 , 珠海 519090; 华南理工大学机械工程学院 1, 广州 510641; 肇庆学院机械工程学院 2, 肇庆 526061摘 要 分析了 F LUE NT 的用户自定义函数 (UDF 的编译过程 , 提

2、出了一种在集成开发环境中编写和编译 UDF 的方法 。讨 论了用面向对象方法 (OO 编写 UDF 的优势和可能性 , 提出了通过修改 VC 开发环境选项和在程序中增加宏来实现 OO 开发 。 用 OO 法编程 , 用户可以使用 M FC 及其它的库比如 Object A RX 来加快开发过程 , 并降低开发难度 。基于以上方法开发了高压 气淬过程的数值模拟软件 , F LUE NT 用于计算气体流场和温度场 , 以及金属温度场 , 有限元软件 被 F LUE NT 调用 , 用于 计算金属内部的应力和应变 。关键词 数值模拟 F LUE NT 二次开发 高压气淬 中图法分类号 TP391.

3、75; 文献标志码 A2010年 3月 8日收到 F LUENT is one 2ume Method (F VM nu si m ulati on s oft 2ware, which has been widely used t o si m ulate the p r ocesses of constant and inconstant fl ow, comp ressible and unco mp ressible fl ow, evaporati on, and combus 2ti on . The s oft w are was written with C language,

4、 and a Secondary Devel opment I nterface (S D I of C language was p resented, which is used t o define material p r oper 2ties and boundary conditi ons, read and edit cell coordi 2nates and variables related t o fields .App licati onscopes are extended and the accuracy of calculati on is i m p r ove

5、d because of the UDF . Because F LUENT Cor 2porati on has not p resented an integrated s oft w are devel 2op ing t oolkits f or writing and editing UDFs, users can only write and edit UDFs in s oft w are such as a notepad and then comp ile the p r ogra m s at cons ole or DOS envi 2r onment, which ma

6、ke it very difficult t o edit p r ogra m s and t o find err ors . And t oday, C language has already ev olved t o C+language . One benefit of writing C+p r ogra m s is that object oriented method can be usedrefs . 1, 2, which can si m p lify the p r ocesses of p r o 2gra mm ing . Another benefit is

7、that s ome libraries like MFC and Object A RX can be used in p r ogra m s s o that the devel op ing p r ocesses can be much easier . It is ex 2pected t o write and comp ile C+OO F LUENT UDF in M icr os oft VC+I D E and devel op a high p ressure gas quenching syste m in this study .1 Ana lysis of Co

8、m p ili n g Processes of FL U 2ENT UD Fs F LUE NT p r ovides the comp iling envir on ment of UDFs, and its comp iling p r ocesses are as f oll ows:writ 2ing C style UDFs in word -editing s oft w are like note 2pad, and then calling a comp iling command in F LU 2ENT . The command p r oduces a file na

9、 med “ user _na me . c ” and the file is na med “ makefile ” . Every ele 2ment of an array of udf_datain “ user_name . c ” points t o a user functi on . The file na med “ makefile ” is a de 2scri p ti on file . Searching paths of header and libraryfiles,static libraries used in comp iling,and the p

10、r ocesses of comp iling are all described in this file . U 2sing the “ makefile ” as a para meter, F LUENT calls the C comp iler, and then a Dyna m ical L inking L ibrary (DLL is p r oduced 3. W hen the DLL is l oaded, F LUE NT gets the udf_dataarray and then gets all user 2 defined functi ons for u

11、sing .Foll owing the above p r ocesses, p r ogra mmers can write and co mp ile F LUENT UDFs in a s oft w are I nte 2 grated Devel opment Envir onment (I D E . I n I D E, comp iling op ti ons should be changed manually accord 2 ing t o the above descri p ti ons, which is not easy f or most of users .

12、2 Co mpili n g F L UENT U DFs i n VC+I DEW riting and co mp iling p r ogra m I D E many advantages . U like Object A RX t o write O p r ogra m s ben 2 efits writing large p r ogra m s and si m p lifying the p r ogra m 2 m ing p r ocesses . Thr ough this way, the user can input data t o the running p

13、 r ogra m s thr ough dial og windows . When pr ogra mm ing in VC+I D E, s o me pr oble m s should be considered . First, many C style functi ons pr ovided by F LUE NT Cor porati on should be used in the ne w syste m. They must be recognized by the VC+co mpiler . Second, UDFs and the udf_dataarray sh

14、ould be ex ported accord 2 ing t o C style . T o s olve these p r oble m s, a macr o na med “ extern “ C ” should be added t o the beginning of C + files .The step s of writing UDFs in VC +I D E can be described as f oll ows . First, running VC +I D E s oft 2 ware and selecting appwizard (dll , and

15、then getting a dll p r oject . Second, editing the I D E comp iler op ti ons, and including p r oject “ including paths ” and “ static li 2 braries paths ” . Third, adding correct F LUE NT static libraries t o the p r oject op ti ons dial og . Fourth, adding functi ons . cpp file t o the p r oject .

16、 UDFs will be written in the file . Fifth, writing correct user_name . cpp file and adding it t o the p r oject .The f or mat of C+files is as foll ows:#include“ stdafx . h ”extern “ C ” #include“ udf . h ”/userdefine functi onsThe above p r ocess can be done manually, and can als o be done by s oft

17、 w are 4s o that p r ogra mmers can concentrate on making UDFs .3 D evelop i n g S i m Software for H i gh Syste m by V C +Compared with quenching p r ocesses by water or oil, high p ressure gas quenching by nitr ogen or heliu m has advantages of unif or m heat transference, reducti on of part defor

18、 mati on, and no oxidati on . H igh p ressure gas quenching p r ocesses are widely used in mould in 2 dustry . Numerical si m ulati on of fl ow field and te mpera 2 ture field in quenched metal by F LUENT, and si m ula 2 ti on of stress field and strain field in metal by Finite Ele mentMethod (FE M

19、are vital t o testify the feasibil 2 ity of quenching p r ocesses, t o op ti m ize the p r ocesses, and t o op ti m ize the design of quenching st oves .For si m ulating fl ow field and te mperature field of high p ressure gas quenching, inlet gas vel ocity and temperature, and outlet p ressure can

20、be regarded as boundary conditi ons . I nlet gas vel ocity was p r ovided by the st ove manufacturer, and inlet gas te mperature was measured by the real 2ti m e method . The pur poses of UDFs in this syste m are t o realize the foll owing p r oces 2 ses:First, changing inlet te mperature and outlet

21、 back 2 fl ow te mperature . Second, modifying material p r oper 2 ties . Third, calculating the metal s olid phase change and the heat p r oduced by the change . Fourth, calcu 2 lating the radiati on energy . Fifth, creating dial ogs,which are used t o input data t o Fluent by the real 2ti m e meth

22、od . Sixth, at the end of every ti m e step, extrac 2 ting cells te mperature, and then calculating and out 2 putting nodes te mperature according t o the require 2 ments of FE M s oft w are, s o that the stress and strain of the metal can be calculated by FE M s oft w are .Because F LUE NT and FE M

23、 s oft w are use different grid syste m s, and F LUE NT out puts cells te mperature but FE M needs nodes te mperature, it is necessary t o inter polate FE M node te mperature by F LUENT cells te mperature, and it is als o necessary t o judge which F LUE NT cell every FE M node is in, and t o calcula

24、te the vect or fr om the cell center t o the node . I f the sum of volume of all the entities f or med by the FE M and F LUE NT cell surfaces t the ume of the cell, then . O ther 2 wise, the node is the cells in F LU 2 ENT have not been refined, the area and nor mal vec 2 t ors of all surface can be

25、 got by F LUENT macr os, but after grids have been refined, they cannot be got cor 2 rectly, excep t for nodes coordinates . So it is the p r o 2 gra mmer s duty t o judge how many points are on a p lane and the area of the p lane .For a tetrahedr on, three nodes are on a p lane . T o judge if a poi

26、nt is in the tetrahedr on, it is necessary t o get the sum of f our tetrahedr on volu me f or med by the point and three points of the tetrahedr ons, and the v ol 2 ume of the tetrahedr on . I f they are equal, the point is in the tetrahedr on . O ther wise, the point is outside the tetrahedr on .Fo

27、r a pyra m id, a vertex and a bott om should first be recognized . The characteristic of a bott om is that four points are on a p lane . Random ly select three points of four considered points, and build t w o p lanes, then calculate the nor mal vect ors of the t w o p lanes . I f the t w o vect ors

28、 are on the sa me directi on, then the f our points are on a p lane . This p r ocess can be p r ogra mmed by the user, and the user can als o use Object A RX p r o 2 vided by Aut odesk Cor porati on, s o that the p r ocess can be si m p lified .For a hexahedr on, a four point bott om and a f our poi

29、nt t op surface should first be recognized . The char 2 acteristic of a bott om is that f our points are on a p lane . The other four points are on the sa me side of the p lane . W hen the bott om and the t op surface have been recog 2 nized, the user can calculate the nor mal vect ors of the t w o

30、p lanes . I f the directi ons of the t w o p lanes are op 2 posite, the user can adjust sequences of the points on one p s o are on the sa me direc 2 . the f the t op surface s o that surface and those on the bott om ponding . W hen the hexahedr on has been rec 2 ognized, it is easy t o judge if a p

31、oint is in the Entity according t o the method menti oned bef ore .A si m p le method t o calculate the relati onshi p of F LUE NT cells and FE M nodes is t o judge if a FE M point is in a certain cell one by one . I n fact, this is a ti m e 2consu m ing method and the ti m e 2comp lexity is O (n ,

32、of which the n is the di m ensi on of the cells . One i m p r oved method is t o compare the distances fr om the point t o the cell centers one by one . Then, choo 2 sing the first m ini m al distance cells and judge whether the points are in those cells . The comp lexity of this method is O (n , t

33、oo . Because it just costs a little ti m e t o judge whether a point is in the cells, the i m 2 p r oved method is a ti m e 2saving method . Another i m 2 p r oved method uses a m ini 2stack data structure . The comp licity of the method is just half of the t w o methods menti oned before .The runni

34、ng of the s oft w are can be described as foll o ws:when the s oft w are starts, it calls initialized functi ons . The first ai m of the functi ons is t o extract F LUE NT cells and corres ponding nodes coordinates . The second ai m is t o l oad FEPG FE M node messagefiles and extract nodes . The th

35、ird ai m is t o judge which cell each node is in one by one and get the vect or fr om the cell centre t o the FEPG node . W hen a ti m e step is over, the te mperature of the nodes can be inter polated by cells te mperature and te mperature grads and the vect ors, and then a F ORT RAN binary file ou

36、t puts . Then Calling FEPG FE M Fortran or C p r ogra m s and calculating the stress and strain filed in the metal . Fi 2nally, calculate the p r oble m s of the next ti m e step, un 2til the ti m e is over .The hierarchy structure of user defined classes can be exp ressed as f oll ows fig . 1Fig .

37、1 H ierarchy structure of user defined classesSome i m portant classes:Class HEntityPublic:static AcGePoint3d original _point; /AcGePoint3d is definedby Object A RX AcGePoint3dA rray points; /pointsof the entity bool operat or <(HEntity&en ; /comparingthe distance fr omentity en t o the origi

38、nal_pointand the distance fr om this entity t o the original_point. virtual bool isPointI n It (AcGePoint3d&po =0; /virtualfunc 2ti on, t o judge if po is int o the entity . double distanceTo (AcGePoint3d &p ; /calculatingthe distancefor m p t o the center of the entity virtual AcGePoint3d c

39、enter ( ; /calculatingthe center of thecell . int cell_id;/I D of a F LUENT cell Class HPlaneEntity:public HEntityPublic: virtual double get A rea ( ; /calculatingthe area of a p lane entity virtual bool isPointI n It (AcGePoint3d&po =0; / virtual nor malize ( ; /arrangingthe points of the entit

40、ypoints sequential Triangle and quadrangle are inherited fr om HEntity, and the decla 2rati ons of the t w o classes are the sa me as HEntity . Class HBodyEntity:public HEntityPublic: virtual bool isPointI n It (AcGePoint3d& ; virtual void nor malize ( ; virtual double volume ( ; /calculatingthe

41、 volume of the 3D enti 2ty . Tetrahedr on, pyra m id and hexahedr on are all in 2herited fr om HBodyEntity, the declarati ons of the three are .A high p ressure gas quenching st ove (model VG Q150 was studied as an exa mp le . The inner di m en 2si on of the st ove is 1200×1320mm 2. The dia met

42、erof the 96sy mmetrical distributed inlet is 22mm. The vel ocity of the inlet gas p r ovided by the st ove manufac 2ture is 35m /s . The inlet gas te mperature was measured by a real 2ti m e method . The p ressure in the st ove was four bars . The dra wing of the st ove is sho wn in fig . 2.The fl o

43、w field distributi on in the st ove was shown in fig . 3. The te mperature field was shown in fig . 4. The calcu 2lated and experi m ental te mperature hist ory was shown in fig . 5. The te mperature of FEPG nodes is written in a file . After opening it in FEPG, the te mperature filed is sho wn in fig . 6. This exa mp le de mons

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论