You are on page 1of 4

Aji Suryo W.

/13211059

Fenomena Transpor dalam Teknik Biomedika

Metode Finite Element dengan Menggunakan Aplikasi FreeFEM


Source code:
border a(t=1,3){x=t; y=0; label=1;};
border b(t=3,4){x=t; y=t-3;
label=1;};
border c(t=4,5){x=t; y=5-t;
label=1;};
border d(t=5,7){x=t; y=0; label=1;};
border e(t=7,8){x=t; y=5*t-35;
label=1;};
border f(t=8,7){x=t; y=5; label=3;};
border g(t=7,6){x=t; y=4*t-23;
label=1;};
border h(t=6,5){x=t; y=7-t; label=1;};
border j(t=5,3){x=t; y=2; label=1;};
border k(t=3,2){x=t; y=t-1;
label=1;};
border l(t=2,1){x=t; y=9-4*t;
label=1;};
border m(t=1,0){x=t; y=5; label=2;};
border n(t=0,1){x=t; y=5-5*t;
label=1;};
int z=10;
mesh Th= buildmesh(a(2*z)+b(1.41*z)+c(1.41*z)+d(2*z)+e(5.09*z)+f(z)
+g(4.12*z)+h(1.41*z)+j(2*z)+k(1.41*z)+l(4.12*z)+m(z)+n(5.09*z));
plot(Th,wait=1);
fespace Xh(Th,P2);
fespace Mh(Th,P1);
Xh u2,v2;
Xh u1,v1;
Mh p,q;
//solve stokes problem for initial value of u
solve Stokes ([u1,u2,p],[v1,v2,q],solver=Crout) =
int2d(Th)( ( dx(u1)*dx(v1) + dy(u1)*dy(v1)
+ dx(u2)*dx(v2) + dy(u2)*dy(v2) )
+ p*q*(0.000001)
+ p*dx(v1)+ p*dy(v2)
+ dx(u1)*q+ dy(u2)*q
)
+ on(1,u1=0,u2=0)
+ on(2,u1=0,u2=1);

Xh psi,phi;
solve streamlines(psi,phi) =
int2d(Th)( dx(psi)*dx(phi) + dy(psi)*dy(phi))

Aji Suryo W./13211059


+ int2d(Th)( -phi*(dy(u1)-dx(u2)))
+ on(1,psi=0);
plot(psi,wait=1);
int i=0;
real nu=1./100.; //reynold = 100
real dt=0.1;
real alpha=1/dt;

Xh up1,up2;
problem NS ([u1,u2,p],[v1,v2,q],solver=Crout,init=i) =
int2d(Th)(
alpha*( u1*v1 + u2*v2)
+ nu * ( dx(u1)*dx(v1) + dy(u1)*dy(v1)
+ dx(u2)*dx(v2) + dy(u2)*dy(v2) )
+ p*q*(0.000001)
+ p*dx(v1)+ p*dy(v2)
+ dx(u1)*q+ dy(u2)*q
)
+ int2d(Th) ( -alpha*convect([up1,up2],-dt,up1)*v1
-alpha*convect([up1,up2],-dt,up2)*v2 )
+ on(1,u1=0,u2=0)
+ on(2,u1=0,u2=1)
;
for (i=0;i<=25;i++)
{
up1=u1;
up2=u2;
NS;
streamlines;
plot(cmm=i,psi);
} ;
plot(cmm="u1",u1,wait=1);
plot(cmm="u2",u2,wait=1);
plot(p,wait=1,fill=1);
plot(psi,wait=1);
plot(coef=0.2,cmm=" [u1,u2] ",[u1,u2],wait=1);

Aji Suryo W./13211059


Hasil implementasi:
Mesh

Streamlines

Aji Suryo W./13211059


Pressure

Pathlines

You might also like