fortran编程语言,与有限元算法有关,现缺少open中的dat文件,该文件应如何编写open(1,file='m2d_s.dat',status='old')\x05read(1,*) nn,ne\x05write(*,*) 'number of nodes and elements of mesh'\x05write(*,*) 'nn,ne=',nn,ne\x05read(1,*)

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 07:04:27

fortran编程语言,与有限元算法有关,现缺少open中的dat文件,该文件应如何编写
open(1,file='m2d_s.dat',status='old')
\x05read(1,*) nn,ne
\x05write(*,*) 'number of nodes and elements of mesh'
\x05write(*,*) 'nn,ne=',nn,ne
\x05read(1,*) (xj(i),yj(i),i=1,nn)
\x05read(1,*) ((node(i,j),j=1,4),i=1,ne)
\x05close(1)
defines the region of needle electrode
\x05xx0=0.003
\x05yy0=0.013
\x05xx1=0.0032
\x05yy1=0.015
assigns the area of the insulator
\x05xs0=0.
\x05ys0=0.
\x05xs1=0.003
\x05ys1=0.01
\x05xxm=0.
\x05yym=0.
\x05xxl=1.
\x05yyl=1.
\x05do 1 i=1,nn
determines the solved region
\x05if(xj(i).gt.xxm) xxm=xj(i)
\x05if(yj(i).gt.yym) yym=yj(i)
\x05if(xj(i).lt.xxl) xxl=xj(i)
\x05if(yj(i).lt.yyl) yyl=yj(i) \x05
1\x05continue
\x05write(*,*) 'limitation of mesh'
\x05write(*,*) 'xxl,yyl,xxm,yym=',xxl,yyl,xxm,yym
defines the region that initial particles are assigned
xt0=0.0026
yt0=0.0126
xt1=0.0036
yt1=0.0127
\x05k=0
\x05do 2 j=1,ne
ie=node(j,1)
\x05je=node(j,2)
ke=node(j,3)
me=node(j,4)
\x05if(xj(ie).ge.xt0.and.xj(je).le.xt1.and.yj(ie).ge.yt0.and.yj(me).le.yt1) then\x05
\x05 k=k+1
\x05 nein(k)=j
\x05 goto 2
\x05endif
2\x05continue
\x05nei=k
\x05do 10 is=1,nsp
\x05nlg=ns(is)/nei
\x05ns(is)=nlg*nei
\x05write(*,*) 'is,ne,ns=',is,nei,ns(is)
load particles
\x05do 11 i=1,nlg
\x05do 12 k=1,nei
\x05j=nein(k)
\x05ie=node(j,1)
\x05je=node(j,2)
\x05ke=node(j,3)
\x05me=node(j,4)
x0=0.5*(xj(je)-xj(ie))+xj(ie)
y0=0.5*(yj(me)-yj(ie))+yj(ie)
\x05i1=k+nei*(i-1)
\x05x(i1,is)=x0
\x05y(i1,is)=y0
\x05if(is.gt.1) goto 12
\x05vx(i1)=v0
\x05vy(i1)=v0
12\x05continue
11\x05continue
10\x05continue
apply boundary conditions,collect charge density,etc.
\x05do 100 is=1,nsp
\x05call setrho(is,ns(is),qs(is))
100\x05continue
\x05return
\x05end

nn是有限元网格的节点个数,ne为有限元网格的单元个数,(xj(i),yj(i),i=1,nn)表示每个节点的x,y坐标;((node(i,j),j=1,4),i=1,ne)表示每个单元由哪四个节点组成,由此看来对求解域的离散应该采用的是4节点四边形线性单元.根据这个情况,假设你的求解域为矩形区域,你将它离散为4个单元,每个单元有4个节点组成,共有9个节点,

输入文件内容(两虚线间的内容)应该这样写:

——————————————————————

9,4

1,x坐标值,y坐标值

2,x坐标值,y坐标值

.

.

9,x坐标值,y坐标值

1,1,4,5,2(即1号单元由1,4,5,2这4个节点组成)

2,2,5,6,3

3,4,7,8,5

4,5,8,9,6

——————————————————

当然,我只是简单举例说明,具体多少个单元和节点要看你对求解区域怎么进行有限元网格划分而定,但是格式可以按照上面写