sysh320 发表于 2006-8-12 12:21

我也是正在做偶合分析的,希望大家都留下自己的见解

sysh320 发表于 2006-8-22 15:13

耦合小程序

最近用到耦合,写了一段小程序,奉献出来,与大家共享。

如果有很多节点,每两个节点位置相同,如果将这些杂乱无章的节点

耦合,是件很麻烦的事,可用这段程序,轻松解决。

cpnum=0

cmsel,s,n-zhong !需要耦合的节点

*GET,n_num,NODE,,COUNT, , , , !节点总数

*do,i,1,n_num

cmsel,s,n-zhong

*GET,n_lowest,NODE,,NUM,MIN, , , , !号码最小的节点

*GET,n_x,NODE,n_lowest,LOC,X !该节点坐标

*GET,n_y,NODE,n_lowest,LOC,Y

*GET,n_z,NODE,n_lowest,LOC,Z

NSEL,s,LOC,X,n_x-0.3,n_x+0.3 !寻找与该节点位置相同的节点

NSEL,R,LOC,Y,n_y-0.3,n_y+0.3

NSEL,R,LOC,z,n_z-0.3,n_z+0.3

cm,n_cp_cp,node !位置相同的节点形成一个组

cmsel,s,n-zhong

cmsel,u,n_cp_cp
cm,n-zhong,node !取消这些点后剩余的点形成组

*GET,n_num_1,NODE,,COUNT, , , , !节点总数

*if,n_num_1,lt,2,exit !如果节点数小于二则退出

cmsel,s,n_cp_cp
*GET,n_num,NODE,,COUNT, , , ,

*if,n_num,gt,1,then

CP,cpnum+1,ux,all

CP,cpnum+2,uy,all

CP,cpnum+3,uz,all

cpnum=cpnum+3

*else

*endif
*enddo



该段程序可用

CPINTF,UX,0.001
CPINTF,UY,0.001
CPINTF,UZ,0.001
代替

sysh320 发表于 2006-8-22 15:13

*DO,I,2,296,3
CP,I,UX,I,I+2
*ENDDO
*DO,I,2,296,3
CP,I,UY,I,I+2
*ENDDO
*DO,I,2,296,3
CP,I,UZ,I,I+2
*ENDDO
DK,1, , , ,0,UX,UY,UZ, , , ,

以上几句改为:

*DO,I,2,296,3
CP,NEXT,ALL,I,I+2
*ENDDO
DK,1, , , ,0,ALL

或CPINTF,ALL,0.001

因为你选用的单元有六个自由度,如果只约束三个,程序是不会运行的.

另:三次循环语句的I相等,约束UY时,UX的耦合就被删掉了,最后只剩UZ了。

sysh320 发表于 2006-8-22 15:14

这样修改:
c***耦合练习
/PREP7
K,1,0,0
K,2,0.1,0
L,1,2
K,300,0,-10000
LGEN,100,1,,,0.1,,,2
ET,1,BEAM188
MP,EX,1,2.1e11
MP,PRXY,1,0.3
MP,DENS,1,0.783e4
SECTYPE, 1, BEAM, T, , 0
SECOFFSET, CENT
SECDATA,0.06,0.03,0.003,0.006,0,0,0,0,0,0
LSEL,ALL
LATT,1,1,1,,300
LESIZE,ALL,,,1,,1,,,1
LMESH,ALL
cpintf,all
DK,1,ux,0, , ,UY,UZ
DK,200, , , , ,UY,UZ
ACEL,0,9.8,0,
FINISH

sysh320 发表于 2006-8-22 15:17

一个流固耦合的例子

*SET,RAD,0.8
*SET,h,1   
*SET,g,9.8
*SET,OMEGAR,2   
*SET,ROU,1000   
/PREP7
ET,1,FLUID79
KEYOPT,1,3,1
MP,EX,1,2E9
MP,DENS,1,ROU   
K,1
K,2,RAD
K,3,RAD,H   
K,4,,,H
K,4,,H
A,1,2,3,4   
LESIZE,ALL,,,10
AMESH,ALL   
FINISH
/SOL
DL,2,,UX
DL,1,,UY
NSEL,S,LOC,X
DSYM,SYMM,X
D,ALL,UX
D,ALL,UX
NSEL,ALL
ACEL,,G
OMEGA,,OMEGAR   
SOLVE   
FINISH
/POST1
SET,LAST
PLNSOL,U,X,0,1
*SET,UCENT,UY(22)   
*SET,UEDGE,UY(12)   
*SET,UELEV,UEDGE-UCENT

这个例子关于装有水的水杯旋转,是轴对称问题,为了简化,所以选择了平面模型。

sysh320 发表于 2006-8-22 15:19

有关ansys 流固耦合模拟仿真

ansys从9.0发展到10.0,一个最大的进步就是流固耦合计算更加规范,这一点已远领先于其他同类软件,实现了单向耦合到即时双向耦合的飞跃,使用户对于解决流固耦合问题又多了一种选择,希望大家对多种方法-----物理环境转换,fsi,mfx等进行讨论,提供一下案例

本人抛砖引玉:
使用物理环境法进行流固耦合的实例及讲解
流道中有一橡胶垫阻碍水的流动,入口速度为2m/s,其他参数将在命令流中详细给出。求解水通过此流道的压力降,以及稳态条件下橡胶垫的变形。

/prep7
/sho,gasket,grph
shpp,off
ET,1,141   ! Fluid - static mesh
ET,2,56,   ! Hyperelastic element
!!!!!!! Fluid Structure Interaction - Multiphysics
!!!!!!!   Deformation of a gasket in a flow field.
!
!!!!!!! Element plots are written to the file gasket.grph.
!
!   - Water flows in a vertical pipe through a construction
!   formed by a rubber gasket.
!   - Determine the equilibrium position of the gasket and
!   the resulting flow field
!
!       |       |
!       |       |
!       |----------| Boundary of "morphing fluid"
!       |   ______|
!       |   |______ gasket
!       |       |
!       |----------| Boundary of "morphing fluid" (sf)
!       |       |
!
!! 1. Build the model of the entire domain:
!!   Fluid region - static mesh
!!   
!!   Gasket leaves a hole in the center of the duct
!!   Morphing Fluid region is a user defined region around
!!   the gasket. The fluid mesh here will deform and be
!!   updated as the gasket deforms.
!!
!!   Parameterize Dimensions in the flow direction
!!
yent = 0.0   ! Y coordinate of the entrance to the pipe
dyen = 1.0   ! Undeformed geometry flow entrance length
ysf1 = yent+dyen ! Y coordinate of entrance to the morphing fluid region
dsf1 = 0.5   ! Thickness of upstream
ygas = ysf1+dsf1 ! Y coordinate of the bottom of the gasket
dg = 0.02   ! Thickness of the gasket
dg2=dg/2.
ytg = ygas+dg   ! Y coordinate of the initial top of the gasket
dsf2 = 0.5   ! Thickness of downstream region
ysf2 = ytg + dsf2! Y of Top of the downstream morphing fluids region
dyex = 6.0   ! Exit fluid length
x = 0.       ! Location of the axisymmetric Centerline
dgasr =.20   ! Initial span of gasket
piper = 0.3   ! Radius of the pipe
xrgap = piper-dgasr!! radius of completely unobtructed flow passage
!!
!!! Create geometry
!!
rect,xrgap,piper,ygas,ytg   ! A1:Gasket (keypoints 1-4)
rect,x,piper,ysf1,ysf2   ! A2: Morphing fluid region
rect,x,piper,yent,ysf1   ! A3: Fluid region with static mesh
rect,x,piper,ysf2,ysf2+dyex   ! A4: Fluid region with static mesh
aovlap,all
k,22,xrgap+dg2,ygas+dg2
rarc = dg2*1.1
larc,1,4,22,rarc
al,6,4
adelete,7
al,6,3,22,7,8,5,21,1

!!Mesh Division information
ngap = 10       ! Number elements across the gap
ngas = 10       ! Number of elements along the gasket
rgas = -2       ! Spacing ratio along gasket
nflu = ngap+ngas ! Number of elements across the fluid region
raflu = -3   ! Space fluid elements near the walls and center
nenty =8       ! Elements along flow - entrance
raent =5       ! Size ratio in the inlet region
nfl1 = 20       ! Elements along flow - first morph.fluid.
nthgas = 4   ! Elements in the gasket
nfl2 = 3       ! Elements along flow - second morph.fluid.
next = 30   ! Elements along flow - exit region
rext = 6   ! Size ratio in flow direction of outlet
rafls = 12   ! Initial element spacing ratio - morph.fluid
lesize,1,,,ngas,rgas
lesize,3,,,ngas,rgas
nfl11= nfl1*2+9
lsel,s,,,2,4,2 ! (Modify lesize of line 8 if changing gasket mesh)
lesize,all,,,nthgas
alls
lesize,5,,,nflu,raflu
lesize,7,,,nflu,raflu
lesize,9,,,nflu,raflu
lesize,15,,,nflu,raflu
lesize,18,,,nenty,1./raent
lesize,17,,,nenty,1./raent
lesize,21,,,nfl1,rafls
lesize,8,,,nfl11,-1./(rafls+3)
lesize,22,,,nfl1,rafls
lesize,19,,,next,rext
lesize,20,,,next,rext

!!! AATT,MAT,REAL,TYPE   - Set the attributes for the areas
asel,s,,,1,2
aatt,2,2,2   ! Gasket   (material 2)
asel,s,,,3
cm,area2,area
alist   ! List area selected for further morphing

asel,a,,,5,6
aatt,1,1,1   ! Fluid area (material 1)
alls

eshape,2
asel,u,,,2,3
amesh,all
eshape,0
asel,s,,,2,3
amesh,all
!-----------------
!!!!! Create element plot and write to the file gasket.grph
asel,s,,,1,3
esla,s
/Title, Initial mesh for gasket and neighborhood
eplot
/ZOOM,1,RECT,0.3,-0.6,0.4,-0.5
alls
!-----------------
!!
!!!!! 2. Create Physics Environment for the Fluid
et,1,141         
et,2,0   ! Gasket becomes the Null Element
vin=3.5e-1   ! Inlet water velocity (meters/second)
!!       CFD Solution Control
flda,solu,flow,1
flda,solu,turb,1
flda,iter,exec,400
flda,outp,sumf,10
!!       CFD Property Information
flda,prot,dens,constant
flda,prot,visc,constant
flda,nomi,dens,1000.   ! 1000 kg/m3 for density - water
flda,nomi,visc,4.6E-4 ! 4.6E-4 kg-s/m (viscosity of water)
flda,conv,pres,1.E-8   ! Tighten pressure equation convergence
!!   CFD Boundary Conditions (Applied to Solid Model)
lsel,s,,,8,17,9
lsel,a,,,20
dl,all,,vx,0.,1   ! Centerline symmetry
lsel,s,,,9
dl,all,,vx,0.,1
dl,all,,vy,vin,1   ! Inlet Condition
lsel,s,,,2
lsel,a,,,18,19
lsel,a,,,21,22
dl,all,,vx,0.,1   ! Outer Wall
dl,all,,vy,0.,1
lsel,s,,,1,3,2
lsel,a,,,6
dl,all,,vx,0.,1   ! Gasket
dl,all,,vy,0.,1
lsel,s,,,15
dl,15,,pres,0.,1   ! Outlet pressure condition
!!! create named component of nodes at the bottom of gasket
lsel,s,,,1
nsll,,1
cm,gasket,node
nlist ! List initial nodal positions of the bottom of the gasket
/com, +++++++++ STARTING gasket coordinates --------

alls
/title,Fluid Analysis
physics,write,fluid,fluid
!!
!!!!! 3. Create Physics Environment for the Structure
!!
physics,clear
et,1,0   ! The Null element for the fluid region
et,2,56   ! Gasket element - material 2
mp,ex,2,2.82E+6   ! Young's modulus for rubber
mp,nuxy,2,0.49967 ! Poisson's ratio for the rubber
tb,mooney,2
tbdata,1,0.293E+6 ! Mooney-Rivlin Constants
tbdata,2,0.177E+6 !   "   "   "

lsel,s,,,2
nsll,,1
d,all,ux,0.
d,all,uy,0.   ! Fix the end of the gasket
alls

/title,structural analysis
finish
/solu
antype,static
nlgeom,on
cnvtol,f,,,,-1
physics,write,struc,struc
physics,clear
save
!!
!!!!! 4. Fluid-Structure Interaction Loop
!!
loop=25         ! Maximum allowed number of loops
toler=0.005       ! Convergence tolerance for maximum displacement
*dim,dismax,array,loop   ! Define array of maximum displacement values
*dim,strcri,array,loop   ! Define array of convergence values
*dim,index,array,loop

*do,i,1,loop         ! Execute fluid -> structure solutions
/solu
physics,read,fluid   ! Read in fluid environment
*if,i,ne,1,then   
flda,iter,exec,100   ! Execute 100 global iterations for
*endif             !   each new geometry
solve             ! FLOTRAN solution
fini
! end of fluid portion
physics,read,struc   ! Read in structures environment
/assign,esave,struc,esav ! Files for restarting nonlinear structure
/assign,emat,struc,emat
*if,i,gt,1,then   ! Structural restart loop
parsave,all         ! Save parameters for convergence check
resume         ! Resume DB - to return original node positions
parresume         ! Resume parameters needed for convergence check
/prep7
antype,stat,rest   
fini
*endif

/solu
solc,off
lsel,s,,,1,3,2   ! Select proper lines to apply fluid pressures
lsel,a,,,6         ! to the entire gasket surface
nsll,,1
esel,s,type,,2
ldread,pres,last,,,,,rfl ! Apply pressure surface load from Flotran
alls
rescontrol,,none   ! Do not use multiframe restart for nonlinear
solve
*if,i,eq,1,then
save             ! save original node locations at the first run
*endif
fini

/post1
cmsel,s,gasket   
nsort,u,sum,1,1
*get,dismax(i),sort,0,max ! Get the maximum displacement value
strcri(i)=toler*dismax(i)
alls
fini

/prep7
mkey=2             ! Select level of mesh morphing for fluid
damorph,area2, ,mkey   ! Perform morphing of "morphing fluid"
!----------------
!!!!! Create element plot and write it in file gasket.grph
fini
/prep7
et,1,42
asel,s,,,1,3
esla,s
/Title, EPLOT after DAMORPH,area2, ,%mkey% step number %i%
eplot
alls
!-----------------
cmsel,s,gasket
nlist ! List updated coordinates of bottom of gasket for comparison
/com, +++++++++ UPDATED gasket coordinates --------
alls
fini
/assign,esav
/assign,emat

!!!! Checking convergence criteria
imax= i
index(i)=i
*if,i,gt,1,then
strcri(i)=abs(dismax(i)-dismax(i-1))-toler*dismax(i-1)
*if,strcri(i),le,0,then
strcri(i)=0
*exit         ! Stop looping if convergence is reached
*endif
*endif
*enddo
!!!!! End of the Computational loop
save         ! Nodal coordinates of deformed geometry are saved

!!!!! Convergence printout
*vwrite
(/'Loop No. Max.Displacement Struct.Convergence')
/nopr
*vlen,imax
*vwrite,index(1),dismax(1),strcri(1)
(f7.0,2e17.4)

finish

!!!!! Postprocessing of the results
!!!   1. Flotran results.
physics,read,fluid
/post1
set,last
/Title, Flotran: Streamlines Near Gasket
plnsol,strm
/Title, Flotran: Pressure Contours
plnsol,pres
fini
!!!   2. Structural results.
physics,read,struc
/post1
set,last
upcoord,-1   ! Return original node positions changed by morphing
/Title, Structural results: von Mises Stress
plnsol,s,eqv,1,1
fini
!/exit,nosave

sysh320 发表于 2006-8-22 15:19

讲解:
橡胶垫在流体作用下发生变形,变形又反过来影响流体形状,例子中设定的流固区,在流体分析和固体分析中都作为分析对象,在结构分析中求解流固区可得到网格的变形,用于流场分析,此区域在流体物理环境中赋予流体属性,在结构物理环境中附于结构属性,这一点是说允许由于橡胶垫变形引起网格变形。纯流体区域仅在流体物理环境中使用,橡胶垫也只在结构物理环境中使用。
三个区分别是 固体区--橡胶垫;流体区;流固区   
流体区域编号一定要设为1
在创建流体环境时,流体和流固两区分配流体属性,此时固体区,也就是橡胶垫为null,设定好之后将流体物理环境写入物理环境文件。
然后清除流体物理环境,定义结构物理环境,此时流体区域为null,定义载荷步和求解选项,写入流体物理环境。
最后 流/固求解循环!

caodongf 发表于 2006-8-23 13:53

楼主做过ansys和cfx耦合的算例没有啊?
用ansys的mfx多物理场做分析

caodongf 发表于 2006-8-23 13:57

楼主要解决的问题和我的基本一样
   很关心这方面的例子我今天就试试楼主的做法!
先谢谢

caodongf 发表于 2006-8-23 14:02

我这里有个算例,但是没有调试出来

我这里有个用ansys和cfx耦合的练习,在其他论坛上也发过没有人回答,希望楼主帮我看看

AaronSpark 发表于 2006-8-24 02:28

不错,建议加为精华

AaronSpark 发表于 2006-8-24 02:32

原帖由 sysh320 于 2006-8-3 10:12 发表
流固耦合的边界应用带有SFIN标记的SF,SFA,SFE,SFL等命令来标记耦合界面,具体方法见ansys help很详细的
至今还没有找到,谁知道说一下吧

帮助中搜索一下这几个命令不就出来了吗?

AaronSpark 发表于 2006-8-24 02:41

原帖由 sysh320 于 2006-8-2 22:16 发表
一般说来,ANSYS的流固耦合主要有4种方式:
1,sequential
这需要用户进行APDL编程进行流固耦合
2,FSI solver
流固耦合的设置过程非常简单,推荐你使用这种方式
3,multi-field solver
这是FSI solve ...


sequentia指的是顺序耦合
以采用MpCCI为例,你可以利用ANSYS和一个第三方CFD产品执行流固耦合分析。在这个方法中,基于网格的平行代码耦合界面(MpCCI) 将ANSYS和CFD程序耦合起来。即使网格上存在差别,MpCCI也能够实现流固界面的数据转换。ANSYS CD中包含有MpCCI库和一个相关实例。关于该方法的详细信息,参见ANSYS Coupled-Field Analysis Guide中的Sequential Couplin

当然你也可以自己用APDL编程

2和3两种情况不太用说了大家应该都挺清楚

直接耦合的话那就要看ansys是否提供你所需要的特殊单元了

[ 本帖最后由 AaronSpark 于 2006-8-24 02:49 编辑 ]

sysh320 发表于 2006-8-24 21:01

原帖由 caodongf 于 2006-8-23 13:53 发表
楼主做过ansys和cfx耦合的算例没有啊?
用ansys的mfx多物理场做分析

这个我还没有做过,你要是有什么心得或者是什么资料,还望拿过来与大家共同分享。

sysh320 发表于 2006-8-24 21:03

原帖由 caodongf 于 2006-8-23 13:57 发表
楼主要解决的问题和我的基本一样
   很关心这方面的例子我今天就试试楼主的做法!
先谢谢


这个大家共同讨论,我也是正在做这方面的课题
最近刚借了基本资料,有什么新的进展我会和大家共享的
页: 1 [2] 3 4 5 6 7 8
查看完整版本: 关于流固耦合在ANSYS建模中的实现!