File: bilapP3-hct-like.edp

package info (click to toggle)
freefem%2B%2B 3.61.1%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 17,108 kB
  • sloc: cpp: 141,214; ansic: 28,664; sh: 4,925; makefile: 3,142; fortran: 1,171; perl: 844; awk: 290; php: 199; pascal: 41; f90: 32
file content (44 lines) | stat: -rw-r--r-- 1,195 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// a trick to build C1 finite element with P3 lagrangre finite element
// like HSIEH-CLOUCH-TOCHER finite element 
// the idee is insure the the jump (dn(u)) on all edges 
// by penalisatison ... 
// not to bad ... 
// F. Hecht juin 2014 ..

load "Element_P3" // for P3
load "splitmesh3" // to splite each triangle in 3 traingle

int n=100,nn=n+10;
real[int] xx(nn),yy(nn);

mesh Th=square(20,20);  // mesh definition of $\Omega$
//Th=splitmesh3(Th);
fespace Vh(Th,P3);      // finite element space

macro bilaplacien(u,v) ( dxx(u)*dxx(v)+dyy(u)*dyy(v)+2.*dxy(u)*dxy(v)) // fin macro 
real f=1;
Vh [u],[v];
real pena = 1e6;
macro dn(u) (dx(u)*N.x+dy(u)*N.y)//
solve bilap([u],[v]) =
    int2d(Th)(  bilaplacien(u,v) ) 
  + intalledges(Th) ( jump(dn(u))*jump(dn(v))*pena) 
   - int2d(Th)(f*v)
   
   + on(1,2,3,4,u=0) 
; 
   
plot(u,cmm="u", wait=1,fill=1);
real umax = u[].max; 
int err =  (abs(umax-0.0012782) > 1e-4); 
cout << " uu max " << umax << " ~  0.0012782  , err = " << err 
     << " " << abs(umax-0.0012782) <<endl; 


for (int i=0;i<=n;i++)
 {
   xx[i]=real(i)/n;
   yy[i]=u(0.5,real(i)/n); // value of uh at point (0.5, i/10.) 
 }
 plot([xx(0:n),yy(0:n)],wait=1);
 assert(err==0);