Difference between revisions of "Diagy Alwan Irsyad"
Line 46: | Line 46: | ||
==== Finite Element Method for Trusses ==== | ==== Finite Element Method for Trusses ==== | ||
− | [[File:SoalTrusses4 d29.png|700px| | + | [[File:SoalTrusses4 d29.png|700px|center]] |
+ | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
| style='border-style: none none solid solid;' | | | style='border-style: none none solid solid;' | | ||
− | '' | + | '''''Class''''' |
class Trusses_Tugas3_d29 | class Trusses_Tugas3_d29 | ||
Line 156: | Line 157: | ||
end Trusses_Tugas3_d29; | end Trusses_Tugas3_d29; | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''''Function Stiffness_Matrices''''' | ||
+ | |||
+ | function Stiffness_Matrices | ||
+ | |||
+ | input Real A; | ||
+ | Real Y; | ||
+ | output Real X[4,4]; | ||
+ | Real float_error = 10e-10; | ||
+ | |||
+ | final constant Real pi=2*Modelica.Math.asin(1.0); | ||
+ | |||
+ | algorithm | ||
+ | |||
+ | Y:=A/180*pi; | ||
+ | |||
+ | X:=[(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y); | ||
+ | |||
+ | Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2; | ||
+ | |||
+ | -(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y); | ||
+ | |||
+ | -Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2]; | ||
+ | |||
+ | for i in 1:4 loop | ||
+ | for j in 1:4 loop | ||
+ | if abs(X[i,j]) <= float_error then | ||
+ | X[i,j] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | end for; | ||
+ | |||
+ | end Stiffness_Matrices; | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''''Function Gauss-Jordan''''' | ||
+ | function Gauss_Jordan | ||
+ | |||
+ | input Integer N; | ||
+ | input Real A[N,N]; | ||
+ | input Real B[N]; | ||
+ | output Real X[N]; | ||
+ | Real float_error = 10e-10; | ||
+ | |||
+ | algorithm | ||
+ | X:=Modelica.Math.Matrices.solve(A,B); | ||
+ | |||
+ | for i in 1:N loop | ||
+ | if abs(X[i]) <= float_error then | ||
+ | X[i] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | |||
+ | end Gauss_Jordan; | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''''Function Reaction_Trusses''''' | ||
+ | function Reaction_Trusses | ||
+ | |||
+ | input Integer N; | ||
+ | input Real A[N,N]; | ||
+ | input Real B[N,1]; | ||
+ | input Real C[N,1]; | ||
+ | Real X[N,1]; | ||
+ | output Real Sol[N]; | ||
+ | Real float_error = 10e-10; | ||
+ | |||
+ | algorithm | ||
+ | X:=A*B-C; | ||
+ | |||
+ | for i in 1:N loop | ||
+ | if abs(X[i,1]) <= float_error then | ||
+ | X[i,1] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | |||
+ | for i in 1:N loop | ||
+ | Sol[i]:=X[i,1]; | ||
+ | end for; | ||
+ | |||
+ | end Reaction_Trusses; | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''''Function Local_Global''''' | ||
+ | function Local_Global | ||
+ | |||
+ | input Real Y[4,4]; | ||
+ | input Integer B; | ||
+ | input Integer p1; | ||
+ | input Integer p2; | ||
+ | output Real G[B,B]; | ||
+ | |||
+ | algorithm | ||
+ | |||
+ | for i in 1:B loop | ||
+ | for j in 1:B loop | ||
+ | G[i,j]:=0; | ||
+ | end for; | ||
+ | end for; | ||
+ | |||
+ | G[2*p1,2*p1]:=Y[2,2]; | ||
+ | G[2*p1-1,2*p1-1]:=Y[1,1]; | ||
+ | G[2*p1,2*p1-1]:=Y[2,1]; | ||
+ | G[2*p1-1,2*p1]:=Y[1,2]; | ||
+ | |||
+ | G[2*p2,2*p2]:=Y[4,4]; | ||
+ | G[2*p2-1,2*p2-1]:=Y[3,3]; | ||
+ | G[2*p2,2*p2-1]:=Y[4,3]; | ||
+ | G[2*p2-1,2*p2]:=Y[3,4]; | ||
+ | |||
+ | G[2*p2,2*p1]:=Y[4,2]; | ||
+ | G[2*p2-1,2*p1-1]:=Y[3,1]; | ||
+ | G[2*p2,2*p1-1]:=Y[4,1]; | ||
+ | G[2*p2-1,2*p1]:=Y[3,2]; | ||
+ | |||
+ | G[2*p1,2*p2]:=Y[2,4]; | ||
+ | G[2*p1-1,2*p2-1]:=Y[1,3]; | ||
+ | G[2*p1,2*p2-1]:=Y[2,3]; | ||
+ | G[2*p1-1,2*p2]:=Y[1,4]; | ||
+ | |||
+ | end Local_Global; | ||
|} | |} |
Revision as of 15:16, 2 December 2020
Biodata
Nama : Diagy Alwan Irsyad
NPM : 1906301154
Angkatan : 2019
Program Studi : Teknik Mesin, S1 Reguler
Tempat, tanggal lahir : Cepu, 29 April 2001
Jenis kelamin : Laki-laki
Alamat surel : diagya.irsyad29@gmail.com / diagy.alwan@ui.ac.id
Metode Numerik-02
Pada semester gasal 2020/2021, saya mengambil mata kuliah Metode Numerik, tepatnya di kelas Metode Numerik-02.
Contents
Pertemuan I (11 November 2020)
Pertemuan pertama bersama Pak Dai, saya dan mahasiswa lain diajak berpikir untuk bisa mengetahui hal-hal yang sudah kami ketahui dan yang belum. Dengan mengetahui hal yang belum diketahui, kami bisa mempelajari hal-hal tersebut.
Selain itu, kami juga membahas tentang pengenalan aplikasi OpenModelica. Di akhir kelas, kami diberi tugas untuk membuat video mengenai cara penggunaan OpenModelica.
Berikut adalah video yang saya buat:
Pertemuan II (18 November 2020)
Pertemuan kedua bersama Pak Dai, saya dan mahasiswa lain diminta untuk bisa menjadi orang yang beruntung. Yang dimaksud orang yang beruntung adalah orang yang mampu menjadi pribadi yang lebih baik dibandingkan kemarin. Pak Dai mengingatkan agar kami jangan menjadi orang yang merugi, yaitu orang yang tidak memiliki perkembangan antara hari ini dengan kemarin.
Setelah mendapatkan pelajaran hidup yang berharga, kami diminta untuk mempresentasikan tugas kami yang telah dibuat sebelumnya. Tujuan dari presentasi ini adalah untuk menilai kemampuan mahasiswa dalam pemahaman penggunaan aplikasi OpenModelica.
Materi yang diberikan pada pertemuan ini adalah penggunaan class untuk memanggil sebuah function. Function yang bisa dipanggil beragam jumlahnya, mulai dari penjumlahan sederhana sampai operasi eliminasi matriks.
Di akhir kelas, kami diberi tugas untuk membuat video mengenai cara menyelesaikan persamaan aljabar simultan dengan OpenModelica. Metode yang digunakan menggunakan class untuk memanggil sebuah function, seperti yang sudah diajarkan sebelumnya.
Berikut adalah video yang saya buat:
Pertemuan III (25 November 2020)
Finite Element Method for Trusses
Class class Trusses_Tugas3_d29 parameter Integer N=8; //Global matrice = 2*points connected parameter Real A=0.001; //m^2 parameter Real E=200e9; //Pa Real G[N,N]; //global Real Ginitial[N,N]; //global Real Sol[N]; //global displacement Real X[N]={0,0,-1035.2762,-3863.7033,0,0,-1035.2762,-3863.7033}; Real R[N]; //global reaction force Real SolMat[N,1]; Real XMat[N,1]; //boundary condition Integer b1=1; Integer b2=3; //truss 1 parameter Real X1=0; //degree between trusses Real k1=A*E/1; Real K1[4,4]; //stiffness matrices Integer p1a=1; Integer p1b=2; Real G1[N,N]; //truss 2 parameter Real X2=0; //degree between trusses Real k2=A*E/1; Real K2[4,4]; //stiffness matrices Integer p2a=2; Integer p2b=3; Real G2[N,N]; //truss 3 parameter Real X3=90; //degree between trusses Real k3=A*E/1.25; Real K3[4,4]; //stiffness matrices Integer p3a=2; Integer p3b=4; Real G3[N,N]; //truss 4 parameter Real X4=90+38.6598; //degree between trusses Real k4=A*E/1.6; Real K4[4,4]; //stiffness matrices Integer p4a=1; Integer p4b=4; Real G4[N,N]; //truss 5 parameter Real X5=90-38.6598; //degree between trusses Real k5=A*E/1.6; Real K5[4,4]; //stiffness matrices Integer p5a=3; Integer p5b=4; Real G5[N,N]; /* for each truss, ensure pXa is lower then pXb (X represents truss element number) */ algorithm //creating global matrice K1:=Stiffness_Matrices(X1); G1:=k1*Local_Global(K1,N,p1a,p1b); K2:=Stiffness_Matrices(X2); G2:=k2*Local_Global(K2,N,p2a,p2b); K3:=Stiffness_Matrices(X3); G3:=k3*Local_Global(K3,N,p3a,p3b); K4:=Stiffness_Matrices(X4); G4:=k4*Local_Global(K4,N,p4a,p4b); K5:=Stiffness_Matrices(X5); G5:=k5*Local_Global(K5,N,p5a,p5b); G:=G1+G2+G3+G4+G5; Ginitial:=G; //implementing boundary condition for i in 1:N loop G[2*b1-1,i]:=0; G[2*b1,i]:=0; G[2*b2-1,i]:=0; G[2*b2,i]:=0; end for; G[2*b1-1,2*b1-1]:=1; G[2*b1,2*b1]:=1; G[2*b2-1,2*b2-1]:=1; G[2*b2,2*b2]:=1; //solving displacement Sol:=Gauss_Jordan(N,G,X); //solving reaction force SolMat:=matrix(Sol); XMat:=matrix(X); R:=Reaction_Trusses(N,Ginitial,SolMat,XMat); end Trusses_Tugas3_d29; |
Function Stiffness_Matrices function Stiffness_Matrices input Real A; Real Y; output Real X[4,4]; Real float_error = 10e-10; final constant Real pi=2*Modelica.Math.asin(1.0); algorithm Y:=A/180*pi; X:=[(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y); Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2; -(Modelica.Math.cos(Y))^2,-Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.cos(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y); -Modelica.Math.cos(Y)*Modelica.Math.sin(Y),-(Modelica.Math.sin(Y))^2,Modelica.Math.cos(Y)*Modelica.Math.sin(Y),(Modelica.Math.sin(Y))^2]; for i in 1:4 loop for j in 1:4 loop if abs(X[i,j]) <= float_error then X[i,j] := 0; end if; end for; end for; end Stiffness_Matrices; |
Function Gauss-Jordan function Gauss_Jordan input Integer N; input Real A[N,N]; input Real B[N]; output Real X[N]; Real float_error = 10e-10; algorithm X:=Modelica.Math.Matrices.solve(A,B); for i in 1:N loop if abs(X[i]) <= float_error then X[i] := 0; end if; end for; end Gauss_Jordan; |
Function Reaction_Trusses function Reaction_Trusses input Integer N; input Real A[N,N]; input Real B[N,1]; input Real C[N,1]; Real X[N,1]; output Real Sol[N]; Real float_error = 10e-10; algorithm X:=A*B-C; for i in 1:N loop if abs(X[i,1]) <= float_error then X[i,1] := 0; end if; end for; for i in 1:N loop Sol[i]:=X[i,1]; end for; end Reaction_Trusses; |
Function Local_Global function Local_Global input Real Y[4,4]; input Integer B; input Integer p1; input Integer p2; output Real G[B,B]; algorithm for i in 1:B loop for j in 1:B loop G[i,j]:=0; end for; end for; G[2*p1,2*p1]:=Y[2,2]; G[2*p1-1,2*p1-1]:=Y[1,1]; G[2*p1,2*p1-1]:=Y[2,1]; G[2*p1-1,2*p1]:=Y[1,2]; G[2*p2,2*p2]:=Y[4,4]; G[2*p2-1,2*p2-1]:=Y[3,3]; G[2*p2,2*p2-1]:=Y[4,3]; G[2*p2-1,2*p2]:=Y[3,4]; G[2*p2,2*p1]:=Y[4,2]; G[2*p2-1,2*p1-1]:=Y[3,1]; G[2*p2,2*p1-1]:=Y[4,1]; G[2*p2-1,2*p1]:=Y[3,2]; G[2*p1,2*p2]:=Y[2,4]; G[2*p1-1,2*p2-1]:=Y[1,3]; G[2*p1,2*p2-1]:=Y[2,3]; G[2*p1-1,2*p2]:=Y[1,4]; end Local_Global; |