JosiahEnrico
Revision as of 14:43, 18 November 2020 by JosiahEnrico (talk | contribs)
Holaaa
Perkenalkan nama saya Josiah Enrico S dari jurusan teknik mesin FTUI. Sebagai salah seorang mahasiswa, saya senang belajar dan berbagi banyak hal baru kepada dunia. Melalui wiki ini, saya akan berbagi kepada kalian tentang apa yang saya pelajari. :)
Contents
Aplikasi Modelica - Metode Numerik/18 November 2020
Berikut ini adalah contoh penerapan aplikasi OpenModelica untuk membuat 4 algoritma metode numerik dalam mencari roots of equation (akar persamaan) dari:
f(x) = exp^(-x)-(x)
f'(x) = -exp^(-x)-1
error maksimum = 0.0000001
1) Newton Raphson (Terbuka)
model Newton_Raphson_Algorithm parameter Real g=1; //guess parameter Integer N=20; //max iteration parameter Real er=0.0000001; //error maximum Real a[N]; Real y[N];//function Real ER[N]; //error Real sol; //solution algorithm a[1]:=g; y[1]:=a[1]-(exp(-a[1])-a[1])/(-exp(-a[1])-1); ER[1]:=abs(1-a[1]/y[1]); for i in 2:N loop a[i]:=y[i-1]; y[i]:=a[i]-(exp(-a[i])-a[i])/(-exp(-a[i])-1); ER[i]:=abs(1-y[i-1]/y[i]); if ER[i]<er then sol:=y[i]; break; end if; end for; end Newton_Raphson_Algorithm;
2) Secant (Terbuka)
model Secant_Algorithm parameter Real a=0; //guess parameter Real b=1; //guess parameter Integer N=10; //max iteration parameter Real er=0.0000001; //error maximum Real A[N]; Real B[N]; Real y[N]; Real ER[N]; Real sol; //solution algorithm A[1]:=a; B[1]:=b; y[1]:=B[1]-(exp(-B[1])-B[1])*(A[1]-B[1])/((exp(-A[1])-A[1])-(exp(-B[1])-B[1])); ER[1]:=abs(1-B[1]/y[1]); for i in 2:N loop A[i]:=B[i-1]; B[i]:=y[i-1]; y[i]:=B[i]-(exp(-B[i])-B[i])*(A[i]-B[i])/((exp(-A[i])-A[i])-(exp(-B[i])-B[i])); ER[i]:=abs(1-y[i-1]/y[i]); if ER[i]<er then sol:=y[i]; break; end if; end for; end Secant_Algorithm;
3) Bisection (Tertutup)
model Bisection_Algorithm parameter Real a=0; //guess bawah parameter Real b=1; //guess atas parameter Integer N=50; //max iteration parameter Real er=0.0000001; //error maximum Real fa=(exp(-a)-a); Real fb=(exp(-b)-b); Real A[N]; Real B[N]; Real fy[N]; Real y[N]; Real ER[N]; Real sol; //solution algorithm if fa*fb<0 then A[1]:=a; B[1]:=b; y[1]:=(A[1]+B[1])/2; fy[1]:=exp(-y[1])-y[1]; ER[1]:=1; for i in 2:N loop if fy[i-1]>0 then A[i]:=y[i-1]; B[i]:=B[i-1]; else A[i]:=A[i-1]; B[i]:=y[i-1]; end if; y[i]:=(A[i]+ B[i])/2; fy[i]:=exp(-y[i])-y[i]; ER[i]:=abs(1-y[i-1]/y[i]); if ER[i]<er then sol:=y[i]; break; end if; end for; end if;
end Bisection_Algorithm;
3) Regula Falsi (Tertutup)
model Regula_Falsi_Algorithm parameter Real a=0; //guess bawah parameter Real b=1; //guess atas parameter Integer N=20; //max iteration parameter Real er=0.0000001; //error maximum Real A[N]; Real B[N]; Real fa[N]; Real fb[N]; Real fy[N]; Real y[N]; Real ER[N]; Real sol; //solution algorithm A[1]:=a; B[1]:=b; fa[1]:=exp(-A[1])-A[1]; fb[1]:=exp(-B[1])-B[1]; if fa[1]*fb[1]<0 then y[1]:=(A[1]*fb[1]-B[1]*fa[1])/(fb[1]-fa[1]); fy[1]:=exp(-y[1])-y[1]; ER[1]:=1; for i in 2:N loop if fy[i-1]>0 then A[i]:=y[i-1]; B[i]:=B[i-1]; else A[i]:=A[i-1]; B[i]:=y[i-1]; end if; fa[i]:=exp(-A[i])-A[i]; fb[i]:=exp(-B[i])-B[i]; y[i]:=(A[i]*fb[i]-B[i]*fa[i])/(fb[i]-fa[i]); fy[i]:=exp(-y[i])-y[i]; ER[i]:=abs(1-y[i-1]/y[i]); if ER[i]<er then sol:=y[i]; break; end if; end for; end if; end Regula_Falsi_Algorithm;
Gate Valve - Aplikasi CFD/12 November 2020
Gate Valve
membuka atau menutup aliran
Mengatur kecepataan fluida (Regulasi)
Mangatasi Backflow atau aliran balik