1 / 4
文档名称:

用julia编写的有限元程序.pdf

格式:pdf   大小:503KB   页数:4页
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

用julia编写的有限元程序.pdf

上传人:1781111**** 2024/5/11 文件大小:503 KB

下载得到文件列表

用julia编写的有限元程序.pdf

相关文档

文档介绍

文档介绍:该【用julia编写的有限元程序 】是由【1781111****】上传分享,文档一共【4】页,该文档可以免费在线阅读,需要了解更多关于【用julia编写的有限元程序 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。:..?julia编写的有限元程序FINITEELEMENTPROGRAMMINGINJULIAPostedonApril21,2013|byAmuthanArunkumarRamabathiranFINITEELEMENTPROGRAMMINGINJULIAApril21,2013Postedon|++,:C/C++isfastandpowerfulbutverydifficulttoworkwith(forthetypicalscientificresearcherwhodoesnothaveanextensivebackgroundinprogramming),Fortranisquiteoutdatedinspiteofitsamazingspeed,-putationalhotspotsusinghighperformancelanguageslikeFortranorC/C++.,developingefficientfiniteelementcodeiscruciallydependentonfastandrobustlinearalgebralibrariesanditisanon-,whatisrequiredisalanguagethatisaseasytouseasPythonandasfastasC/C++,',xx+u,yy=-6overtheunitsquarewiththeDirichletboundaryconditionu=1+x^2+2y^-:FEniCSandFreeFem++.FEniCSisacollectionofsoftwareforhighlevelfiniteelementcodedevelopmentwritteninPythonandC++.FreeFem++isapartialdifferentialequationssolverwritteninC++andusesitsownDSL(DomainSpecificLanguage)withaC++:..ThankstoJulia'selegantsyntaxthecodeislargelyself-:,,,,,,dbcandf_extPoissonequationisobtainedfromthevariationalformulationasgrad(u).grad(v).Thisisspecifiedinthefunctionpoisson_stiffness,asshownbelow,intermsoftheshapefunctionvectorNandthematrixcontainingthepartialderivativesoftheshapefunctionsdNwheredN[i,j]=dN_i/dx_j.#Stiffnessmatrixfunctionpoisson_stiffness(N,dN,i,j)dN[i,1]*dN[j,1]+dN[i,2]*dN[j,2]endAtriangularmeshovertheunitsquareisgeneratedusingmesh=UnitSquare(100)=fe_space_C0(mesh,dbc)Finally,thesolutionofthefiniteelementproblemisobtainedas:solve_fe(mesh,u,poisson_stiffness,f_ext)-,referredhenceforthasmethods1,2and3,areexploredinthefunctionsolve_fe:#Method1#K=zeros(n_size,n_size)#fe_matrices(mesh,u,stiffness,fext,K,F)#Method2#K=spzeros(n_size,n_size)#fe_matrices(mesh,u,stiffness,fext,K,F)#Method3iu,ju,vu=fe_matrices(mesh,u,stiffness,fext,F)K=sparse(iu,ju,vu,n_size,n_size)-zeroelementsofthesparsematrixisunknown,,-zeroentriesinasparsematrixKtoinitializedthreevectorsI,JandVsuchthatK[I[n],J[n]]=V[n],(inseconds),asafunctionofthetotalnumberofnodes(N),forthethreeparedwithPoissonsolversimplementedinFEniCSandFreeFem++++:..++----(method1).Initializingthesparsestiffnessmatrixasinmethod2worksfineforsmallN,(guessed)numberofnon-++codesformuchlargervaluesofNisshownbelow:ItcanbeseenthattheperformanceoftheJuliacodeisasgoodasFEniCS'andclosetothatofFreeFem++forNrangingfrom10^2to10^,,-orientation,butitstypesystem,++:thesurfaceplotatthebeginningofthearticleisthesolutionofthePoissonequationovertheunitsquarewithzeroDirichletboundaryconditiononallitsedgesandanexternalloadf(x,y)=2sin(2pi*x)sin(2pi*y).,alongwithanyassociatedsourcecodeandfiles,islicensedunderTheCodeProjectOpenLicense(CPOL)AbouttheAuthor:..AmuthanArunkumarRamabathiranFranceAmuthanArunkumarRamabathiranisapost-doctoralresearcheratGeM,,IndianInstituteofScience(IISc),,IndianInstituteofTechnology(IIT)-academicfront,heactivelylearnsandplayssouthIndianclassicalmusiconthefretlesselectricguitar.