Difference between revisions of "Metnum03-Addarda Irsyad Usman"
Line 214: | Line 214: | ||
[[File:Soal3.jpeg|300px|center]] | [[File:Soal3.jpeg|300px|center]] | ||
+ | |||
+ | '''Mempelajari Coding 3D Fahmi''' | ||
+ | |||
+ | Pada algoritma Ahmad Muhammad Fahmi], metode yang digunakan untuk penyelesaian sama dengan ''flowchart'' yang sudah saya buat untuk Quiz. Penyelesaian kedua soal ini memiliki ''parameter input'': | ||
+ | |||
+ | 1. A (Luas Permukaan) | ||
+ | |||
+ | 2. E (Modulus Elastisitas) | ||
+ | |||
+ | 3. node | ||
+ | |||
+ | 4. load | ||
+ | |||
+ | Pada algoritma ini dibuat terlebih dahulu beberapa ''function'' untuk mempermudah pemanggilan pada ''class''. Disini terdapat ''function'' yaitu Stiffness Matrix Global, Sum Stiffness Matrix Global, Boundary Stiffness Matrix Global, Gauss Jordan, Reaction Force, dan Check Force. | ||
+ | |||
+ | '''Pengaplikasian Coding Terhadap Soal''' | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''Stiffness Matrix Element Function''' | ||
+ | |||
+ | function StiffnessMatrixElement | ||
+ | input Real [:,6] inisiasi_mat; | ||
+ | output Real [size(inisiasi_mat,1),6,6] Ke_mat; | ||
+ | protected | ||
+ | Real cos_x; | ||
+ | Real cos_y; | ||
+ | Real cos_z; | ||
+ | Real [6] StiffTrig; | ||
+ | Real [6,6] StiffTrans; | ||
+ | Real [size(inisiasi_mat,1)] L; | ||
+ | Real [size(inisiasi_mat,1)] k_vec; | ||
+ | algorithm | ||
+ | L := {(sqrt(inisiasi_mat[i,2]^2 + inisiasi_mat[i,3]^2 + inisiasi_mat[i,4]^2)) for i in 1:size(inisiasi_mat,1)}; | ||
+ | k_vec := {(inisiasi_mat[i,5] * inisiasi_mat[i,6] / L[i]) for i in 1:size(inisiasi_mat,1)}; | ||
+ | // Finding stiffness matrix of each element member | ||
+ | for i in 1:size(inisiasi_mat,1) loop | ||
+ | // Clearing the matrices | ||
+ | StiffTrig := zeros(6); | ||
+ | StiffTrans := zeros(6,6); | ||
+ | // Converting degrees to radians | ||
+ | cos_x := inisiasi_mat[i,2]/L[i]; | ||
+ | cos_y := inisiasi_mat[i,3]/L[i]; | ||
+ | cos_z := inisiasi_mat[i,4]/L[i]; | ||
+ | // {cos^2, sin^2, sincos} | ||
+ | StiffTrig := {(cos_x)^2, | ||
+ | (cos_y)^2, | ||
+ | (cos_z)^2, | ||
+ | (cos_x*cos_y), | ||
+ | (cos_x*cos_z), | ||
+ | (cos_y*cos_z)}; | ||
+ | // Construct stiffness transformation matrix | ||
+ | StiffTrans := [ StiffTrig[1], StiffTrig[4], StiffTrig[5], -1*StiffTrig[1], -1*StiffTrig[4], -1*StiffTrig[5]; | ||
+ | StiffTrig[4], StiffTrig[2], StiffTrig[6], -1*StiffTrig[4], -1*StiffTrig[2], -1*StiffTrig[6]; | ||
+ | StiffTrig[5], StiffTrig[6], StiffTrig[3], -1*StiffTrig[5], -1*StiffTrig[6], -1*StiffTrig[3]; | ||
+ | -1*StiffTrig[1], -1*StiffTrig[4], -1*StiffTrig[5], StiffTrig[1], StiffTrig[4], StiffTrig[5]; | ||
+ | -1*StiffTrig[4], -1*StiffTrig[2], -1*StiffTrig[6], StiffTrig[4], StiffTrig[2], StiffTrig[6]; | ||
+ | -1*StiffTrig[5], -1*StiffTrig[6], -1*StiffTrig[3], StiffTrig[5], StiffTrig[6], StiffTrig[3]]; | ||
+ | // Multiply in stiffness constant of element, add final stiffness matrix to Ke_mat | ||
+ | for m in 1:6 loop | ||
+ | for n in 1:6 loop | ||
+ | Ke_mat[i,m,n] := k_vec[i] * StiffTrans[m,n]; | ||
+ | end for; | ||
+ | end for; | ||
+ | end for; | ||
+ | end StiffnessMatrixElement; | ||
+ | |||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''Stiffness Matrix Global Function''' | ||
+ | |||
+ | function StiffnessMatrixGlobal | ||
+ | input Integer x; | ||
+ | input Integer [:,2] n; | ||
+ | input Real [:,6,6] Ke_mat; | ||
+ | output Real [size(Ke_mat,1),3*x,3*x] Kg_mat; | ||
+ | algorithm | ||
+ | Kg_mat := zeros(size(Ke_mat,1),3*x,3*x); | ||
+ | for i in 1:size(Ke_mat,1) loop | ||
+ | Kg_mat[i,3*n[i,1],3*n[i,1]]:=Ke_mat[i,3,3]; | ||
+ | Kg_mat[i,3*n[i,1],3*n[i,1]-1]:=Ke_mat[i,3,2]; | ||
+ | Kg_mat[i,3*n[i,1],3*n[i,1]-2]:=Ke_mat[i,3,1]; | ||
+ | Kg_mat[i,3*n[i,1]-1,3*n[i,1]]:=Ke_mat[i,2,3]; | ||
+ | Kg_mat[i,3*n[i,1]-1,3*n[i,1]-1]:=Ke_mat[i,2,2]; | ||
+ | Kg_mat[i,3*n[i,1]-1,3*n[i,1]-2]:=Ke_mat[i,2,1]; | ||
+ | Kg_mat[i,3*n[i,1]-2,3*n[i,1]]:=Ke_mat[i,1,3]; | ||
+ | Kg_mat[i,3*n[i,1]-2,3*n[i,1]-1]:=Ke_mat[i,1,2]; | ||
+ | Kg_mat[i,3*n[i,1]-2,3*n[i,1]-2]:=Ke_mat[i,1,1]; | ||
+ | |||
+ | Kg_mat[i,3*n[i,2],3*n[i,2]]:=Ke_mat[i,6,6]; | ||
+ | Kg_mat[i,3*n[i,2],3*n[i,2]-1]:=Ke_mat[i,6,5]; | ||
+ | Kg_mat[i,3*n[i,2],3*n[i,2]-2]:=Ke_mat[i,6,4]; | ||
+ | Kg_mat[i,3*n[i,2]-1,3*n[i,2]]:=Ke_mat[i,5,6]; | ||
+ | Kg_mat[i,3*n[i,2]-1,3*n[i,2]-1]:=Ke_mat[i,5,5]; | ||
+ | Kg_mat[i,3*n[i,2]-1,3*n[i,2]-2]:=Ke_mat[i,5,4]; | ||
+ | Kg_mat[i,3*n[i,2]-2,3*n[i,2]]:=Ke_mat[i,4,6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i,3*n[i,1]-2,3*n[i,2]-2]:=Ke_mat[i,1,4]; | ||
+ | end for; | ||
+ | end StiffnessMatrixGlobal; | ||
+ | |||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | ''' Sum Stiffness Matrix Element Function''' | ||
+ | |||
+ | function SumStiffnessMatrixGlobal | ||
+ | input Real [:,:,:] Kg_mat; | ||
+ | output Real [size(Kg_mat,2),size(Kg_mat,2)] KgTot_mat; | ||
+ | algorithm | ||
+ | for a in 1:size(Kg_mat,2) loop | ||
+ | for b in 1:size(Kg_mat,2) loop | ||
+ | KgTot_mat[a,b] := sum(Kg_mat [:,a,b]); | ||
+ | end for; | ||
+ | end for; | ||
+ | end SumStiffnessMatrixGlobal; | ||
+ | |||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | ''' Boundary Stiffness Matrix Global Function''' | ||
+ | |||
+ | function BoundaryStiffnessMatrixGlobal | ||
+ | input Real [:,:] KgTot_met; | ||
+ | input Integer[:] Boundary_xyz; | ||
+ | input Integer[:] Boundary_xy; | ||
+ | input Integer[:] Boundary_xz; | ||
+ | input Integer[:] Boundary_yz; | ||
+ | input Integer[:] Boundary_x; | ||
+ | input Integer[:] Boundary_y; | ||
+ | input Integer[:] Boundary_z; | ||
+ | output Real [size(KgTot_met,1),size(KgTot_met,1)] KgB_met; | ||
+ | |||
+ | algorithm | ||
+ | for a in 1:size(KgTot_met,1) loop | ||
+ | for b in 1:size(KgTot_met,1) loop | ||
+ | KgB_met[a,b] := KgTot_met [a,b]; | ||
+ | end for; | ||
+ | end for; | ||
+ | |||
+ | if Boundary_xyz[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_xyz,1) loop | ||
+ | for b in 0:2 loop | ||
+ | KgB_met[3*(Boundary_xyz[a])-b,i]:=0; | ||
+ | KgB_met[3*Boundary_xyz[a]-b,3*Boundary_xyz[a]-b]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | |||
+ | if Boundary_xy[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_xy,1) loop | ||
+ | for b in 1:2 loop | ||
+ | KgB_met[3*(Boundary_xy[a])-b,i]:=0; | ||
+ | KgB_met[3*Boundary_xy[a]-b,3*Boundary_xy[a]-b]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | |||
+ | if Boundary_xz[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_xz,1) loop | ||
+ | for b in 0:2:2 loop | ||
+ | KgB_met[3*(Boundary_xz[a])-b,i]:=0; | ||
+ | KgB_met[3*Boundary_xz[a]-b,3*Boundary_xz[a]-b]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | |||
+ | if Boundary_yz[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_yz,1) loop | ||
+ | for b in 0:1 loop | ||
+ | KgB_met[3*(Boundary_yz[a])-b,i]:=0; | ||
+ | KgB_met[3*Boundary_yz[a]-b,3*Boundary_yz[a]-b]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | |||
+ | if Boundary_x[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_x,1) loop | ||
+ | KgB_met[3*(Boundary_x[a])-2,i]:=0; | ||
+ | KgB_met[3*Boundary_x[a]-2,3*Boundary_x[a]-2]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | |||
+ | if Boundary_y[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_y,1) loop | ||
+ | KgB_met[3*(Boundary_y[a])-1,i]:=0; | ||
+ | KgB_met[3*Boundary_y[a]-1,3*Boundary_y[a]-1]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | |||
+ | if Boundary_z[1] <> 0 then | ||
+ | for i in 1:size(KgTot_met,1) loop | ||
+ | for a in 1:size(Boundary_z,1) loop | ||
+ | KgB_met[3*Boundary_z[a],i]:=0; | ||
+ | KgB_met[3*Boundary_z[a],3*Boundary_z[a]]:=1; | ||
+ | end for; | ||
+ | end for; | ||
+ | end if; | ||
+ | end BoundaryStiffnessMatrixGlobal; | ||
+ | |||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''Gauss Jordan Function''' | ||
+ | |||
+ | function GaussJordan | ||
+ | input Real [:,:] KgB_met; | ||
+ | input Real [size(KgB_met,1)] load_met; | ||
+ | output Real [size(KgB_met,1)] U_met; | ||
+ | |||
+ | protected | ||
+ | Real float_error = 10e-10; | ||
+ | |||
+ | algorithm | ||
+ | U_met:=Modelica.Math.Matrices.solve(KgB_met,load_met); | ||
+ | |||
+ | for i in 1:size(KgB_met,1) loop | ||
+ | if abs(U_met[i]) <= float_error then | ||
+ | U_met[i] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | |||
+ | end GaussJordan; | ||
+ | |||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''Reaction Force Function''' | ||
+ | |||
+ | function ReactionForce | ||
+ | input Real [:,:] KgTot_met; | ||
+ | input Real [size(KgTot_met,1)] U_met; | ||
+ | input Real [size(KgTot_met,1)] load_met; | ||
+ | output Real [size(KgTot_met,1)] R_met; | ||
+ | protected Real float_error = 10e-10; | ||
+ | |||
+ | algorithm | ||
+ | R_met := KgTot_met*U_met-load_met; | ||
+ | |||
+ | for t in 1:size(KgTot_met,1) loop | ||
+ | if abs(R_met[t]) <= float_error then | ||
+ | R_met[t] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | |||
+ | end ReactionForce; | ||
+ | |||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''Check Force Function''' | ||
+ | |||
+ | function CheckForce | ||
+ | input Real [:] load; | ||
+ | input Real [size(load,1)] R; | ||
+ | output Real [3] F; | ||
+ | protected Real float_error = 10e-10; | ||
+ | |||
+ | protected | ||
+ | Real load_x; | ||
+ | Real load_y; | ||
+ | Real load_z; | ||
+ | Real R_x; | ||
+ | Real R_y; | ||
+ | Real R_z; | ||
+ | |||
+ | algorithm | ||
+ | load_x := sum({load[i] for i in 1:3:(size(load,1)-2)}); | ||
+ | load_y := sum({load[i] for i in 2:3:(size(load,1)-1)}); | ||
+ | load_z := sum({load[i] for i in 3:3:size(load,1)}); | ||
+ | R_x := sum({R[i] for i in 1:3:(size(load,1)-2)}); | ||
+ | R_y := sum({R[i] for i in 2:3:(size(load,1)-1)}); | ||
+ | R_z := sum({R[i] for i in 3:3:size(load,1)}); | ||
+ | |||
+ | F[1] := load_x + R_x; | ||
+ | F[2] := load_y + R_y; | ||
+ | F[3] := load_z + R_z; | ||
+ | |||
+ | for i in 1:3 loop | ||
+ | if abs(F[i]) <= float_error then | ||
+ | F[i] := 0; | ||
+ | end if; | ||
+ | end for; | ||
+ | |||
+ | end CheckForce; | ||
+ | |||
+ | |} | ||
+ | |||
+ | Berikut merupakan ''class'' yang digunakan untuk memanggil ''function'' diatas dan menyelesaikan ''Example'' 3.3 | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | style='border-style: none none solid solid;' | | ||
+ | '''Class''' | ||
+ | |||
+ | class QuizSoal1 | ||
+ | //inisiasi = [ elemen#, dX, dY, dZ, A, E] | ||
+ | parameter Real [:,6] inisiasi = [1, 6, 0, -3, 1.56, 10.6e6; //isi sesuai data | ||
+ | 2, 0, 0, -6, 1.56, 10.6e6; | ||
+ | 3, 0, 6, -3, 1.56, 10.6e6; | ||
+ | 4, -6, 0, -3, 1.56, 10.6e6; | ||
+ | 5, -6, 6, 0, 1.56, 10.6e6; | ||
+ | 6, 0, 6, 3, 1.56, 10.6e6]; | ||
+ | |||
+ | //node = [ i, j] | ||
+ | parameter Integer [size(inisiasi,1),2] node = [1, 2; //isi sesuai data | ||
+ | 1, 3; | ||
+ | 1, 4; | ||
+ | 2, 3; | ||
+ | 2, 4; | ||
+ | 3, 4]; | ||
+ | |||
+ | //jumlah node | ||
+ | parameter Integer n = 4; //isi sesuai data | ||
+ | |||
+ | //titik node boundary xyz | ||
+ | parameter Integer [:] Boundary_xyz = {1}; //isi sesuai data | ||
+ | |||
+ | //titik node boundary xy | ||
+ | parameter Integer [:] Boundary_xy = {4}; //isi sesuai data | ||
+ | |||
+ | //titik node boundary xz | ||
+ | parameter Integer [:] Boundary_xz = {0}; //isi sesuai data | ||
+ | |||
+ | //titik node boundary yz | ||
+ | parameter Integer [:] Boundary_yz = {0}; //isi sesuai data | ||
+ | |||
+ | //titik node boundary x | ||
+ | parameter Integer [:] Boundary_x = {3}; //isi sesuai data | ||
+ | |||
+ | //titik node boundary y | ||
+ | parameter Integer [:] Boundary_y = {0}; //isi sesuai data | ||
+ | |||
+ | //titik node boundary z | ||
+ | parameter Integer [:] Boundary_z = {0}; //isi sesuai data | ||
+ | |||
+ | //load = [ F1x, F1y, F1z,..., Fnx, Fny, Fnz] | ||
+ | parameter Real [3*n] load = {0, 0, 0, //isi sesuai data | ||
+ | 0, -200, 0, | ||
+ | 0, 0, 0, | ||
+ | 0, 0, 0}; | ||
+ | |||
+ | Real [size(inisiasi,1)] L; | ||
+ | Real [size(inisiasi,1)] k; | ||
+ | Real [size(inisiasi,1),6,6] Ke; | ||
+ | Real [size(inisiasi,1),3*n,3*n] Kg; | ||
+ | Real [3*n,3*n] KgTot; | ||
+ | Real [3*n,3*n] KgB; | ||
+ | Real [3*n] U; | ||
+ | Real [3*n] R; | ||
+ | |||
+ | //check force | ||
+ | Real [3] F; | ||
+ | |||
+ | equation | ||
+ | L = {(sqrt(inisiasi[i,2]^2 + inisiasi[i,3]^2 + inisiasi[i,4]^2)) for i in 1:size(inisiasi,1)}; | ||
+ | |||
+ | k = {(inisiasi[i,5] * inisiasi[i,6] / L[i]) for i in 1:size(inisiasi,1)}; | ||
+ | |||
+ | Ke = StiffnessMatrixElement(inisiasi); | ||
+ | |||
+ | Kg = StiffnessMatrixGlobal(n, node, Ke); | ||
+ | |||
+ | KgTot = SumStiffnessMatrixGlobal(Kg); | ||
+ | |||
+ | KgB = BoundaryStiffnessMatrixGlobal(KgTot, Boundary_xyz, Boundary_xy, Boundary_xz, Boundary_yz, Boundary_x, Boundary_y, Boundary_z); | ||
+ | |||
+ | U = GaussJordan(KgB, load); | ||
+ | |||
+ | R = ReactionForce(KgTot, U, load); | ||
+ | |||
+ | F = CheckForce(load,R); | ||
+ | |||
+ | end QuizSoal1; | ||
+ | |||
+ | |} | ||
+ | |||
+ | Berikut merupakan hasil dan grafik yang didapat | ||
+ | |||
+ | [[File:1607924165277.jpg|200px]] | ||
+ | [[File:1607924118583.jpg|200px]] | ||
+ | [[File:1607924101463.jpg|200px]] | ||
+ | |||
+ | [[File:1607924228684.jpg|600px|center]] |
Revision as of 23:48, 3 January 2021
بِسْمِ اللهِ الرَّحْمَنِ الرَّحِيْمِ
السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُ
Contents
Bio Data
Kelas Metode Numerik - 03
Nama : Addarda Irsyad Usman
NPM : 1706021556
Program Studi : S1 Teknik Mesin Parallel
Kelas Metode Numerik
Pertemuan 1 (Senin, 9 November 2020)
Assalamualaikum Wr. Wb.
Pada pertemuan pertama kali ini dapat dianggap sebagai pengenalan dari Pak Dai tentang bagaimana metode pembelajaran kelas Metode Numerik - 03 bersama Pak Dai. Banyak diskusi yang terjadi pada pertemuan ini, sebagaimana Pak Dai mengarahkan kami untuk melakukan diskusi 2 arah ini. Pembahasan menarik mengenai fenomena numerik yang berada di kehidupan dasar manusia ketika menemukan bilangan-bilangan yang berupa konsep seperti "tak terhingga" atau "infiniti" dan bagaimana pandangan kita sebagai seorang engineer.
Kemudian Pak Dai menjelaskan bahwa pemberian materi akan berupa pengaplikasian dari metode numerik yang akan menggunakan software Open Modelica. Software ini merupakan program yang dapat menyimulasikan suatu sistem dengen data input kode sumber atau biner untuk melakukan suatu penelitian terhadap sistem tersebut. Setiap mahasiswa diharapkan memiliki software tersebut sebagai penunjang pembelajaran setengah semester kedepan.
Pertemuan 2 (Senin, 16 November 2020)
Pada pertemuan kedua ini, kami mempelajari cara membuat program sederhana pada modelica untuk menghitung jumlah dan rata-rata angka. Diakhir kelas kami ditugaskan untuk membuat suatu program untuk menyelesaikan persamaan aljabar simultan, berikut merupakan program yang saya buat:
Saya menggunakan matriks berukuran 3 x 3 dengan metode gauss elimination dan function solve yang disediakan oleh software modelica sehingga mendapatkan hasil [6, -1, -2]
Pertemuan 3 (Senin, 23 November 2020) Tugas Studi Kasus Gambar 12.11
Pada pertemuan ketiga ini, kami diminta untuk membuktikan suatu studi berdasarkan gambar 12.11, serta juga dengan matriks yang tertera pada buku panduan Numerical Methods for Engineers 7th Edition superti berikut merupakan gambar 12.11:
Berikut merupakan program yang saya buat pada program Open Modelica menggunakan metode Gauss Elimination sebagai pembuktian terhadap persamaan yang bereda di buku panduan. Dapat disimpukan bahwa persamaa berdasarkan buku panduan terbuktinya persamaan tersebut dengan mengacu pada nilai a pada Open Modelica berikut. Maka Open Modelica berikut terbukti dapat menyelesaikan persamaan yang sama seperti di buku panduan dengan hasil yang sama pula.
Hasil yang didapatkan dari simulasi di atas adalah sebagai berikut
a1 = 7.3575
a2 = 10.0552
a3 = 12.5077
Pertemuan 3 (Senin, 23 November 2020) PR
Pada pertemuan ini Pak Dai juga memberikan PR kepada kami untuk menyelesaikan soal berikut:
Pada tugas ini diberikan juga penjelasan mengenai bagaimana persamaan akhir menggunakan Hukum Hooke, dimana matriks adalah sebagai berikut:
Pada penyelesaiannya dapat menggunakan OpenModelica sebagai berikut
Dan juga saya berikan plotting menggunakan Open Modelica
Soal mempertanyakan mengenai nilai gaya reaksi terhadap gambar, maka diperlukan perhitungan untuk mendapatkan nilai gaya reaksi.
Menggunakan OpenModelica dapat menyelesaikan persamaan tersebut, menggunakan program sebagai berikut
Serta dengan hasil plottingnya
Relain itu tugas ini juga membutuhkan perhitungan normal stress dan gaya internal pada gambar. Pada perhitungan normal stress diperlukan transformasi dari hasil defleksi ditinjau dari koordinat global menjadi transformasi lokal, dimana menggunakan persamaan berikut
Pada análisis stress Elemen 5, maka node yang dianalisis adalah node 2 dan 5. Sehingga persamaan matriks defleksi pada koordinat lokal menjadi
Menggunakan OpenModelica dengan program sebagai berikut untuk dapat menyelesaikan permasalahan
Didapatkan juga hasil plotting
Maka didapatkan
U2x = -0.00976 inch
U6x= -0.01209 inch
Dan untuk internal force didapatkan melalui persamaan
didapatkan nilai internal force elemen 5 sebesar 696 lb
Pertemuan Ke4 (30 November 2020)
Berikut merupakan hasil jawaban Soal No 4 dan No 8 saya
Jawaban Soal Quiz
Berikut merupakan penyelesaian dari flowchart Nomor 4
1. Mendefinisikan Node & Elemen
Kita perlu mendefinisikan setiap elemen dan node nya untuk mendapatkan derajat yang digunakan pada elemen dan node tersebut
// Multiply in stiffness constant of element, add final stiffness matrix to Ke_mat for m in 1:6 loop for n in 1:6 loop Ke_mat[i,m,n] := k_vec[i] * StiffTrans[m,n]; end for; end for; end for; end StiffnessMatrixElement;
Stiffness Matrix Global Function function StiffnessMatrixGlobal input Integer x; input Integer [:,2] n; input Real [:,6,6] Ke_mat; output Real [size(Ke_mat,1),3*x,3*x] Kg_mat; algorithm Kg_mat := zeros(size(Ke_mat,1),3*x,3*x); for i in 1:size(Ke_mat,1) loop Kg_mat[i,3*n[i,1],3*n[i,1]]:=Ke_mat[i,3,3]; Kg_mat[i,3*n[i,1],3*n[i,1]-1]:=Ke_mat[i,3,2]; Kg_m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=Ke_mat[i,4,3]; Kg_mat[i,3*n[i,2]-2,3*n[i,1]-1]:=Ke_mat[i,4,2]; Kg_mat[i,3*n[i,2]-2,3*n[i,1]-2]:=Ke_mat[i,4,1]; Kg_mat[i,3*n[i,1],3*n[i,2]]:=Ke_mat[i,3,6]; Kg_mat[i,3*n[i,1],3*n[i,2]-1]:=Ke_mat[i,3,5]; Kg_mat[i,3*n[i,1],3*n[i,2]-2]:=Ke_mat[i,3,4]; Kg_mat[i,3*n[i,1]-1,3*n[i,2]]:=Ke_mat[i,2,6]; Kg_mat[i,3*n[i,1]-1,3*n[i,2]-1]:=Ke_mat[i,2,5]; Kg_mat[i,3*n[i,1]-1,3*n[i,2]-2]:=Ke_mat[i,2,4]; Kg_mat[i,3*n[i,1]-2,3*n[i,2]]:=Ke_mat[i,1,6]; Kg_mat[i,3*n[i,1]-2,3*n[i,2]-1]:=Ke_mat[i,1,5]; Kg_mat[i,3*n[i,1]-2,3*n[i,2]-2]:=Ke_mat[i,1,4]; end for; end StiffnessMatrixGlobal; |
Sum Stiffness Matrix Element Function function SumStiffnessMatrixGlobal input Real [:,:,:] Kg_mat; output Real [size(Kg_mat,2),size(Kg_mat,2)] KgTot_mat; algorithm for a in 1:size(Kg_mat,2) loop for b in 1:size(Kg_mat,2) loop KgTot_mat[a,b] := sum(Kg_mat [:,a,b]); end for; end for; end SumStiffnessMatrixGlobal; |
Boundary Stiffness Matrix Global Function function BoundaryStiffnessMatrixGlobal input Real [:,:] KgTot_met; input Integer[:] Boundary_xyz; input Integer[:] Boundary_xy; input Integer[:] Boundary_xz; input Integer[:] Boundary_yz; input Integer[:] Boundary_x; input Integer[:] Boundary_y; input Integer[:] Boundary_z; output Real [size(KgTot_met,1),size(KgTot_met,1)] KgB_met; algorithm for a in 1:size(KgTot_met,1) loop for b in 1:size(KgTot_met,1) loop KgB_met[a,b] := KgTot_met [a,b]; end for; end for; if Boundary_xyz[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_xyz,1) loop for b in 0:2 loop KgB_met[3*(Boundary_xyz[a])-b,i]:=0; KgB_met[3*Boundary_xyz[a]-b,3*Boundary_xyz[a]-b]:=1; end for; end for; end for; end if; if Boundary_xy[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_xy,1) loop for b in 1:2 loop KgB_met[3*(Boundary_xy[a])-b,i]:=0; KgB_met[3*Boundary_xy[a]-b,3*Boundary_xy[a]-b]:=1; end for; end for; end for; end if; if Boundary_xz[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_xz,1) loop for b in 0:2:2 loop KgB_met[3*(Boundary_xz[a])-b,i]:=0; KgB_met[3*Boundary_xz[a]-b,3*Boundary_xz[a]-b]:=1; end for; end for; end for; end if; if Boundary_yz[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_yz,1) loop for b in 0:1 loop KgB_met[3*(Boundary_yz[a])-b,i]:=0; KgB_met[3*Boundary_yz[a]-b,3*Boundary_yz[a]-b]:=1; end for; end for; end for; end if; if Boundary_x[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_x,1) loop KgB_met[3*(Boundary_x[a])-2,i]:=0; KgB_met[3*Boundary_x[a]-2,3*Boundary_x[a]-2]:=1; end for; end for; end if; if Boundary_y[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_y,1) loop KgB_met[3*(Boundary_y[a])-1,i]:=0; KgB_met[3*Boundary_y[a]-1,3*Boundary_y[a]-1]:=1; end for; end for; end if; if Boundary_z[1] <> 0 then for i in 1:size(KgTot_met,1) loop for a in 1:size(Boundary_z,1) loop KgB_met[3*Boundary_z[a],i]:=0; KgB_met[3*Boundary_z[a],3*Boundary_z[a]]:=1; end for; end for; end if; end BoundaryStiffnessMatrixGlobal; |
Gauss Jordan Function function GaussJordan input Real [:,:] KgB_met; input Real [size(KgB_met,1)] load_met; output Real [size(KgB_met,1)] U_met; protected Real float_error = 10e-10; algorithm U_met:=Modelica.Math.Matrices.solve(KgB_met,load_met); for i in 1:size(KgB_met,1) loop if abs(U_met[i]) <= float_error then U_met[i] := 0; end if; end for; end GaussJordan; |
Reaction Force Function function ReactionForce input Real [:,:] KgTot_met; input Real [size(KgTot_met,1)] U_met; input Real [size(KgTot_met,1)] load_met; output Real [size(KgTot_met,1)] R_met; protected Real float_error = 10e-10; algorithm R_met := KgTot_met*U_met-load_met; for t in 1:size(KgTot_met,1) loop if abs(R_met[t]) <= float_error then R_met[t] := 0; end if; end for; end ReactionForce; |
Check Force Function function CheckForce input Real [:] load; input Real [size(load,1)] R; output Real [3] F; protected Real float_error = 10e-10; protected Real load_x; Real load_y; Real load_z; Real R_x; Real R_y; Real R_z; algorithm load_x := sum({load[i] for i in 1:3:(size(load,1)-2)}); load_y := sum({load[i] for i in 2:3:(size(load,1)-1)}); load_z := sum({load[i] for i in 3:3:size(load,1)}); R_x := sum({R[i] for i in 1:3:(size(load,1)-2)}); R_y := sum({R[i] for i in 2:3:(size(load,1)-1)}); R_z := sum({R[i] for i in 3:3:size(load,1)}); F[1] := load_x + R_x; F[2] := load_y + R_y; F[3] := load_z + R_z; for i in 1:3 loop if abs(F[i]) <= float_error then F[i] := 0; end if; end for; end CheckForce; |
Berikut merupakan class yang digunakan untuk memanggil function diatas dan menyelesaikan Example 3.3
Class class QuizSoal1 //inisiasi = [ elemen#, dX, dY, dZ, A, E] parameter Real [:,6] inisiasi = [1, 6, 0, -3, 1.56, 10.6e6; //isi sesuai data 2, 0, 0, -6, 1.56, 10.6e6; 3, 0, 6, -3, 1.56, 10.6e6; 4, -6, 0, -3, 1.56, 10.6e6; 5, -6, 6, 0, 1.56, 10.6e6; 6, 0, 6, 3, 1.56, 10.6e6]; //node = [ i, j] parameter Integer [size(inisiasi,1),2] node = [1, 2; //isi sesuai data 1, 3; 1, 4; 2, 3; 2, 4; 3, 4]; //jumlah node parameter Integer n = 4; //isi sesuai data //titik node boundary xyz parameter Integer [:] Boundary_xyz = {1}; //isi sesuai data //titik node boundary xy parameter Integer [:] Boundary_xy = {4}; //isi sesuai data //titik node boundary xz parameter Integer [:] Boundary_xz = {0}; //isi sesuai data //titik node boundary yz parameter Integer [:] Boundary_yz = {0}; //isi sesuai data //titik node boundary x parameter Integer [:] Boundary_x = {3}; //isi sesuai data //titik node boundary y parameter Integer [:] Boundary_y = {0}; //isi sesuai data //titik node boundary z parameter Integer [:] Boundary_z = {0}; //isi sesuai data //load = [ F1x, F1y, F1z,..., Fnx, Fny, Fnz] parameter Real [3*n] load = {0, 0, 0, //isi sesuai data 0, -200, 0, 0, 0, 0, 0, 0, 0}; Real [size(inisiasi,1)] L; Real [size(inisiasi,1)] k; Real [size(inisiasi,1),6,6] Ke; Real [size(inisiasi,1),3*n,3*n] Kg; Real [3*n,3*n] KgTot; Real [3*n,3*n] KgB; Real [3*n] U; Real [3*n] R; //check force Real [3] F; equation L = {(sqrt(inisiasi[i,2]^2 + inisiasi[i,3]^2 + inisiasi[i,4]^2)) for i in 1:size(inisiasi,1)}; k = {(inisiasi[i,5] * inisiasi[i,6] / L[i]) for i in 1:size(inisiasi,1)}; Ke = StiffnessMatrixElement(inisiasi); Kg = StiffnessMatrixGlobal(n, node, Ke); KgTot = SumStiffnessMatrixGlobal(Kg); KgB = BoundaryStiffnessMatrixGlobal(KgTot, Boundary_xyz, Boundary_xy, Boundary_xz, Boundary_yz, Boundary_x, Boundary_y, Boundary_z); U = GaussJordan(KgB, load); R = ReactionForce(KgTot, U, load); F = CheckForce(load,R); end QuizSoal1; |
Berikut merupakan hasil dan grafik yang didapat