AA-cours-M2-2009-Freefem
39 pages
English

AA-cours-M2-2009-Freefem

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
39 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Introduction a` FreeFem++J.MoriceLaboratoire Jacques-Louis LionsUniversite Pierre et Marie CurieParis, Franceavec O. Pironneau, F. Hechthttp://www.freefem.org mailto:hecht@ann.jussieu.frFinance par l’Agence National de La Recherche(ANR) ANR-07-CIS7-002-01http://www.freefem.org/ff2a3/ http://www-anr-ci.cea.fr/FreeFem++ Cours M2, dec. 2009 1PLAN{ Introduction Freefem++{ Element Syntaxe{ Formulation Variationnelle et EF{ Generation de maillage 2D{ Examples :{ Equation de Poisson avec condition de Neumann et condition de Dirichlet{ de P avec systeme matricielle{ Adaptation de Maillage avec indication d’erreur{ Probleme de Stokes 3D{ Generation de maillage 3DFreeFem++ Cours M2, dec. 2009 2IntroductionFreeFem++ est un solveur permettant de resoudre les equations aux deriveespartielles (PDE) en 2d et 3d.Methode employe : Methode d’elements nis. EF : P0, P1, P2,Raviart-Thomas, P1 diconstinue,FreeFem++ est un logiciel sous licence LGPL. Il fonctionne sous Mac, Unixet Window. Algorithme // avec MPI.FreeFem++ Cours M2, dec. 2009 3The main characteristics of FreeFem++ I/II (2D){ Wide range of nite elements : linear (2d,3d) (P1) and quadratic Lagran-gian (2d,3d) elements (P2), discontinuous P1 and Raviart-Thomas elements(2d,3d), 3d Edge element , vectorial element, mini-element( 2d, 3d), ...{ Automatic interpolation of data from a mesh to an other one, so a niteelement function is view as a function of (x;y;z) or as an array.{ De ...

Informations

Publié par
Nombre de lectures 208
Langue English

Extrait

aveco:hecht@mailt.ueiiFrf.nnassujArlncgencnapa´eRacedlLeoianNetaNR-0NR)Ahe(Aherctth10-200-7SIC-7m.feeefrw.ww//p:www/rna-.ic-.aecg/or2affht3/:/tp1fr/
J.Morice Laboratoire Jacques-Louis Lions Universit´ePierreetMarieCurie Paris, France
http://www.freefem.org
O. Pironneau, F. Hecht
FreeFem++ Cours M2, dec. 2009
Introduction`aFreeFem++
PLAN
– IntroductionFreefem++ – Element Syntaxe – Formulation Variationnelle et EF G´en´erationdemaillage2D – Examples : – Equation de Poisson avec condition de Neumann et condition de Dirichlet – Equation de Poisson avec systeme matricielle ` – Adaptation de Maillage avec indication d’erreur Probl`emedeStokes3D Ge´n´erationdemaillage3D
FreeFem++ Cours M2, dec. 2009
2
Introduction
FreeFem++auit´sqexu´dnoaser´eantdrelesouduevlosnuttemreprsteiveres´e partielles (PDE) en 2d et 3d.
M´ethodeemploy´e:Me´thoded´ele´mentsnis.EF:P0,P1,P2, Raviart-Thomas, P1 diconstinue,
FreeFem++ est un logiciel sous licence LGPL. Il fonctionne sous Mac, Unix et Window. Algorithme // avec MPI.
FreeFem++ Cours M2, dec. 2009
3
na2(-nige)el,dd3s(P2mentscon),diPsuounitivaRdna1omTht-arenemelasWdirenaegfoniteelements:liraen,d2(()d3a)1PqundraadcLtiraagorfatadfonoitalorpteinicatomutAelemtieeaonens,heroanotshtomametcevairomele,tne3d),geEd(2ts3dd,3,)d.,..mene(td2,mini-ellelementluvaalreththwie)c(melborroxelpmoaccewiththevsstoaiitveraofmrnolaafasctunnoiox,f(uftnitcnsinoweivDenitionofthep,y)zrosanaraar.y
The main characteristics ofFreeFem++ I/II(2D)
FreeFem++ Cours M2, dec. 2009
4
.2dtoday)inrkleGausuoinntylno(noitalumrofmatrdthersanectosiocdeDendexifi
The main characteristics ofFreeFem++ II/II(2D) – Analytic description of boundaries, with specification by the user of the intersection of boundaries in 2d. Automatic mesh generator, based on the Delaunay-Voronoi algorithm. (2d,3d) – load and save Mesh, solution Mesh adaptation based on metric, possibly anisotropic, with optional auto-matic computation of the metric from the Hessian of a solution. LU, Cholesky, Crout, CG, GMRES, UMFPack,SuperLU, MUMPS,...sparse linear solver ;eigenvalueand eigenvector computation with ARPACK. – Online graphics, C++ like syntax. – Link with other soft : modulef, emc2, medit, gnuplot, tetgen, superlu, mumps ... – Dynamic linking to add functonality. – Wide range of of examples : Navier-Stokes3d, elasticity3d, fluid structure, eigenvalue problem, Schwarz’ domain decomposition algorithm, residual er-ror indicator, ... FreeFem++ Cours M2, dec. 2009 5
Element of syntax : Like in C++ 1/ The basic numerical type are :int,real,complex,bool, string inti = 0 ; integer// an reala=2.5 ; reel// a complexcc=2.5+1.i*2 ;// a complex boolb=(a<3.) ; boolean// a BOOLEAN Initialisation: 0 <=>false,6= 0<=>true The operator like in C : Arithmetic :: + - * / = Arithmetic in C:: += -= /= *= ++ --Comparison :: == != < > <= >= && || redefintion : ^// (power) :: a^b=ab |// a|b=aorb &// a&b=aandb FreeFem++ Cours M2, dec. 2009 6
Element of syntax : Like in C++ 2 // Automatic cast for numerical value : bool, int, reel, complex funcf=x+y ; formal line function// a func ;}real g(int i, real a) { ..... return i+a ; // Loops for(int i=0 ;i<n ;i++) { ... ;} if( <bool exp> ) { ... ;}else ;} ;{ ... while( <bool exp> ) { ... ;} break continuekey words // The scoop of a variable the current block : { inta=1 ; } block// a cout << a << endl ; the variable a not existe here.// error lots of math function :exp, log, tan, ... FreeFem++ Cours M2, dec. 2009 7
Element of syntax : 4/4
LesEntre´es/sortiescommeenc++
Ecran : : cout, cin, ...
Pour ouvrir un fichier en lecture : ifstreamname(nom_fichier) ;
Pourouvrirunchierene´criture: ofstreamname(nom_fichier) ;
Lire/´ecrituredansunchier>>/<< { ofstreamgnu("plot.gp") ; gnu.precision(14) ;// gnu.fixed() gnu.scientific() ; (Section 4.10 ; doc FreeFem++) for(int i=0 ;i<n ;i++) gnu << x[i] << " " << y[i] << endl ; }
FreeFem++ Cours M2, dec. 2009
8
xofsize30×30withrtxi1MT=/;M/tairenarstotagormae)lla(znonvoreeulaTfoeulavTraluba0099
Element of syntax 3 : Array, Tabular and Matrix
Pb :TabularT'Full Matrix
// Block matrix matrixM2= [ [A, 0, B ], [ 0, A, B ], [B’, B’, M] ] ;//
2Md,ce2.m++CoursB.FreeFeamfoxirtsnaresopisBetthwrehe
real[int] Realarray(10) ; int[int ;] IntArray(20)
real[int,int] T(30,30) T(2,3) = 5.0 ;
era//oyarralaueal0vf1al0vue/aTa///araaroy2fintngerexirtaMesrapS//0×30ize3rofsbula
er//yarraronoitc2[>u==]<1[:urkmairlaceot//vaz,;]tfunementeelfini1P,2V;)][,hTP,2P]=,p,y[x[uVhu21,paceVVh(fes
Notation :u(x, y, z) =Piu[][i]Ni(x, y, z) whereNiFE basis.
iu[][i]Ni(x, y, z) whereNiFE basis.
Element of syntax 4
.om
FreeFem++ Cours M2, dec. 2009
01]<==>p[]samearraoydfgeeroefferdetincfuntraaroronnifa//;xemeleetii*y;x+1.mple//coc<moVy3hu>=clpxeranoayrr.5u(6,,.lavxFdeunufEoitcunctionuatpoint(7.;)//avuloeFffEetaicossayarraeh/t;/[])u.76,,..5uloehtav/;6/[]]5nuu[ctioEfundtoFl0taiekibgninigenuy(ermbheftraarnC)MFindhaesinetlEmenemtseThh;mesh3Th3;//a2dhsemadnaemd3,xhsz,y,x,N.y,N.z,N.,//cabelon,lregianetroidtnocruerVhcepaeslfmaor,nnifd2a//;)2P,hT(ntspace;iteeleme3hT(3hP,efpscaVenifielte;/1)3d/aV;ec=u3hnemeapst
probl`emevariationnel
De´nitionduproble`me Vh u,v ; problempbname(u,v,solver=CG,eps=1.e-6)= a(u,v) - l(v) limites) ; / pbname ;/r/e´osulitnoudlennoeml`obprtiiaarev
solver= CG, GMRES, UMFPACK, Crout, LU, Cholesky
FreeFem++ Cours M2, dec. 2009
+
(conditions
aux
11
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents