23 INTEGER,
INTENT(IN) :: type_fe
27 LOGICAL,
DIMENSION(p2_mesh%np) :: p2_virgin
28 INTEGER :: v_dof, f_dof, c_dof, n_dof, edge, i, h, k, l, m, ms, n, n1, n2, j1, j2, &
29 nb_edges, nb_vertices, lmax, sgn, sgn_op, j1_op, j2_op, n1_op, n2_op, n_op, m_op, hh, hh_op, &
31 REAL(KIND=8) :: s1, s2, s3, sh, sk
32 REAL(KIND=8),
DIMENSION(2) :: r1, r2, r3
36 c_dof = (type_fe-2)*(type_fe-1)/2
37 p3_mesh%gauss%n_w = (type_fe+1)*(type_fe+2)/2
38 p3_mesh%gauss%n_ws = type_fe+1
41 p3_mesh%me = p1_mesh%me
42 p3_mesh%mes = p1_mesh%mes
47 IF (p1_mesh%neigh(n,m)==0) cycle
52 nb_edges = edge + p1_mesh%mes
53 IF (edge /= (3*p1_mesh%me - p1_mesh%mes)/2)
THEN 54 CALL error_petsc(
'BUG in create_p3_mesh, nb of edges is wrong')
57 nb_vertices = p2_mesh%np - nb_edges
58 p3_mesh%np = nb_vertices + 2*nb_edges + p1_mesh%me
60 IF (nb_vertices.NE.p1_mesh%np)
THEN 61 CALL error_petsc(.NE.
' BUG in create_p3_mesh, nb_verticesp1_mesh%np')
65 ALLOCATE(p3_mesh%jj(p3_mesh%gauss%n_w,p3_mesh%me), p3_mesh%neigh(3,p3_mesh%me), p3_mesh%i_d(p3_mesh%me))
66 ALLOCATE(p3_mesh%jjs(p3_mesh%gauss%n_ws,p3_mesh%mes), p3_mesh%neighs(p3_mesh%mes), p3_mesh%sides(p3_mesh%mes))
67 ALLOCATE(p3_mesh%rr(p3_mesh%gauss%k_d,p3_mesh%np))
70 p3_mesh%neigh = p1_mesh%neigh
71 p3_mesh%neighs = p1_mesh%neighs
72 p3_mesh%i_d = p1_mesh%i_d
73 p3_mesh%sides = p1_mesh%sides
76 p3_mesh%jj(1:3,:) = p1_mesh%jj(1:3,:)
77 IF (maxval(p3_mesh%jj(1:3,:)).NE.nb_vertices)
THEN 78 write(*,*) maxval(p1_mesh%jj(1:3,p1_mesh%me)), nb_vertices
79 write(*,*) maxval(p3_mesh%jj(1:3,p1_mesh%me)), nb_vertices
80 CALL error_petsc(
'BUG in create_p3_mesh, Vertex enumeration not done properly')
82 p3_mesh%rr(:,1:nb_vertices) = p1_mesh%rr(:,1:nb_vertices)
90 j_mid = p2_mesh%jj(n_mid,m)
91 IF (.NOT.p2_virgin(j_mid))
THEN 92 m_op = p1_mesh%neigh(n,m)
94 IF (m == p1_mesh%neigh(n_op,m_op))
THEN 100 n1_op = modulo(n_op,3)+1
101 n2_op = modulo(n_op+1,3)+1
102 j1 = p1_mesh%jj(n1,m)
103 j1_op = p1_mesh%jj(n1_op,m_op)
104 j2 = p1_mesh%jj(n2,m)
105 j2_op = p1_mesh%jj(n2_op,m_op)
106 IF (j1.NE.j1_op)
THEN 116 IF (n2_op-n1_op>0)
THEN 122 hh = h*sgn + ((1-sgn)/2)*(f_dof+1)
123 hh_op = h*sgn_op + ((1-sgn_op)/2)*(f_dof+1)
124 p3_mesh%jj(v_dof+(n-1)*f_dof+hh, m) = p3_mesh%jj(v_dof+(n_op-1)*f_dof+hh_op, m_op)
127 p2_virgin(j_mid) = .false.
130 j1 = p2_mesh%jj(n1,m)
131 j2 = p2_mesh%jj(n2,m)
132 r1 = p2_mesh%rr(:,j1)
133 r2 = p2_mesh%rr(:,j2)
134 r3 = p2_mesh%rr(:,j_mid)
139 p3_mesh%jj(v_dof+(n-1)*f_dof+h, m) = n_dof
146 sh = 1-h/dble(type_fe)
148 p3_mesh%rr(:, n_dof) = r1(:)*(sh - s2)*(sh - s3)/((s1 - s2)*(s1 - s3)) &
149 + r2(:)*(sh - s3)*(sh - s1)/((s2 - s3)*(s2 - s1)) &
150 + r3(:)*(sh - s1)*(sh - s2)/((s3 - s1)*(s3 - s2))
156 r1 = p1_mesh%rr(:,p1_mesh%jj(1,m))
157 r2 = p1_mesh%rr(:,p1_mesh%jj(2,m))
158 r3 = p1_mesh%rr(:,p1_mesh%jj(3,m))
166 p3_mesh%jj(p3_mesh%gauss%n_w,m) = n_dof
167 p3_mesh%rr(:,n_dof) = (1-sh-sk)*r1+sk*r2+sh*r3
173 DO ms = 1, p1_mesh%mes
174 m_op = p1_mesh%neighs(ms)
175 j1 = p1_mesh%jjs(1,ms)
176 j2 = p1_mesh%jjs(2,ms)
178 IF(j1==p1_mesh%jj(n_op,m_op) .OR. j2==p1_mesh%jj(n_op,m_op)) cycle
180 p3_mesh%jjs(1:2,ms) = p1_mesh%jjs(1:2,ms)
181 n1_op = modulo(n_op+1,3)+1
182 n2_op = modulo(n_op+2,3)+1
183 j1_op = p1_mesh%jj(n1_op,m_op)
184 IF (j1.NE.j1_op)
THEN 189 IF (n2_op>n1_op)
THEN 195 hh_op = h*sgn_op + ((1-sgn_op)/2)*(f_dof+1)
196 p3_mesh%jjs(2+h,ms) = p3_mesh%jj(v_dof+(n_op-1)*f_dof+hh_op, m_op)
202 ALLOCATE(p3_mesh%iis(p3_mesh%gauss%n_ws,p3_mesh%mes))
203 CALL dirichlet_nodes(p3_mesh%jjs, spread(1,1,p3_mesh%mes), spread(.true.,1,1), p3_mesh%j_s)
204 CALL surf_nodes_i(p3_mesh%jjs, p3_mesh%j_s, p3_mesh%iis)
205 p3_mesh%nps =
SIZE(p3_mesh%j_s)
214 INTEGER,
INTENT(IN) :: type_fe
215 INTEGER :: nmin(1), nmax(1), jjive(3)
218 IF (type_fe<0)
RETURN 221 nmin = minloc(mesh%jj(1:3,m))
222 nmax = maxloc(mesh%jj(1:3,m))
223 n = 6/(nmin(1)*nmax(1))
224 jjive(1) = mesh%jj(nmin(1),m)
225 jjive(2) = mesh%jj(n,m)
226 jjive(3) = mesh%jj(nmax(1),m)
227 mesh%jj(1:3,m) = jjive
230 jjive(1) = mesh%jj(nmin(1)+3,m)
231 jjive(2) = mesh%jj(n+3,m)
232 jjive(3) = mesh%jj(nmax(1)+3,m)
233 mesh%jj(4:6,m) = jjive
236 jjive(1) = mesh%neigh(nmin(1),m)
237 jjive(2) = mesh%neigh(n,m)
238 jjive(3) = mesh%neigh(nmax(1),m)
239 mesh%neigh(:,m) = jjive
242 nmin = minloc(mesh%jjs(1:2,ms))
243 nmax = maxloc(mesh%jjs(1:2,ms))
244 jjive(1) = mesh%jjs(nmin(1),ms)
245 jjive(2) = mesh%jjs(nmax(1),ms)
246 mesh%jjs(1:2,ms) = jjive(1:2)
254 INTEGER,
INTENT(IN) :: nws1, nws2
256 INTEGER :: js1ive(nws1), js2ive(nws2)
258 DO ms = 1, interface_xx%mes
259 IF (interface_xx%jjs1(2,ms)<interface_xx%jjs1(1,ms))
THEN 260 js1ive = interface_xx%jjs1(:,ms)
261 interface_xx%jjs1(2,ms) = js1ive(1)
262 interface_xx%jjs1(1,ms) = js1ive(2)
263 IF(nws1.GE.3) interface_xx%jjs1(nws1:3:-1,ms)=js1ive(3:nws1)
265 IF (interface_xx%jjs2(2,ms)<interface_xx%jjs2(1,ms))
THEN 266 js2ive = interface_xx%jjs2(:,ms)
267 interface_xx%jjs2(2,ms) = js2ive(1)
268 interface_xx%jjs2(1,ms) = js2ive(2)
269 IF(nws2.GE.3) interface_xx%jjs2(nws2:3:-1,ms)=js2ive(3:nws2)
275 mesh, mesh_formatted)
281 CHARACTER(len=200),
INTENT(IN) :: dir, fil
282 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom, list_inter
283 INTEGER,
INTENT(IN) :: type_fe
285 LOGICAL,
INTENT(IN) :: mesh_formatted
287 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els
288 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
289 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect, stat
290 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_ms
291 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
293 INTEGER :: mnouv, nnouv, i, dom
294 INTEGER :: n, m, mop, ms, msnouv, neighs1, neighs2
295 INTEGER :: d_end, f_end
296 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
297 CHARACTER(len=40) :: text
298 CHARACTER(len=2) :: truc
304 DO n = 1,
SIZE(list_dom)
306 WRITE(truc,
'(i2)') list_dom(n)
308 text = text(1:d_end)//
'_'//truc(f_end:)
313 text = text(1:d_end)//
'_FE_1' 315 text = text(1:d_end)//
'_FE_2' 319 IF (mesh_formatted)
THEN 320 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
322 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
324 OPEN(unit=20,file=text,
form=
'formatted', status=
'unknown')
327 IF (type_fe == 2)
THEN 328 IF (mesh_formatted)
THEN 329 READ(30,*) np, nw, me, nws, mes
340 READ(30) np, nw, me, nws, mes
347 IF (mesh_formatted)
THEN 348 READ(30, *) np, nw, me, nws, mes
350 READ(30) np, nw, me, nws, mes
353 IF (nw==3 .AND. nws==2)
THEN 355 ELSE IF (nw==6 .AND. nws==3)
THEN 357 ELSE IF (nw==4 .AND. nws==3)
THEN 359 ELSE IF (nw==10 .AND. nws==6)
THEN 362 WRITE(*,*)
' Finite element not yet programmed ' 367 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
368 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
369 ALLOCATE(rr_lect(kd,np))
371 IF (mesh_formatted)
THEN 373 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
376 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
379 READ(30,*) rr_lect(:,n)
382 READ(30) jj_lect, neigh_lect, i_d_lect
383 READ(30) jjs_lect, neighs_lect, sides_lect
392 neighs1 = neighs_lect(ms)
394 WRITE(*,*)
' BUG in prep_mesh, neighs1=0 ' 397 IF (minval(abs(i_d_lect(neighs1) - list_dom))==0)
THEN 403 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 405 neighs2 = neigh_lect(n,neighs1)
415 IF (minval(abs(i_d_lect(neighs2) - list_dom))==0)
THEN 423 IF (
SIZE(list_inter)==0)
THEN 425 ELSE IF (minval(abs(sides_lect(ms)-list_inter))==0)
THEN 443 ALLOCATE (nouv_nd(np), nouv_els(mes), virgin_nd(np), virgin_ms(mes), nouv_el(me))
450 DO dom = 1,
SIZE(list_dom)
452 IF (list_dom(dom) /= i_d_lect(m)) cycle
455 DO n = 1, nw; i = jj_lect(n,m)
456 IF (virgin_nd(i))
THEN 457 virgin_nd(i) = .false.
464 IF (stat(ms) /= 1 .AND. stat(ms) /=2 .AND. stat(ms) /=3)
THEN 465 WRITE(*,*)
' BUG in prep_mesh, stat out of bounds ' 470 IF (stat(ms) == 1) cycle
471 neighs1 = neighs_lect(ms)
473 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 476 neighs2 = neigh_lect(n,neighs1)
477 IF (i_d_lect(neighs1) /= list_dom(dom))
THEN 478 IF (neighs2 == 0) cycle
479 IF (i_d_lect(neighs2) /= list_dom(dom)) cycle
483 IF (virgin_ms(ms))
THEN 484 virgin_ms(ms) = .false.
487 IF (stat(ms) ==3)
THEN 489 virgin_nd(jjs_lect(:,ms)) = .true.
490 virgin_ms(ms) = .true.
498 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
499 ALLOCATE(mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), mesh%sides(mesh%mes))
500 ALLOCATE(mesh%rr(kd,mesh%np))
506 DO dom = 1,
SIZE(list_dom)
509 IF (list_dom(dom) /=i_d_lect(m)) cycle
510 DO n = 1, nw; i = jj_lect(n,m)
511 IF (virgin_nd(i))
THEN 512 virgin_nd(i) = .false.
521 IF (list_dom(dom) /=i_d_lect(m)) cycle
522 DO n = 1, nw; i = jj_lect(n,m)
523 IF (n .LE. nwneigh)
THEN 524 mop = neigh_lect(n,m)
526 mesh%neigh(n,nouv_el(m)) = 0
527 ELSE IF (minval(abs(list_dom - i_d_lect(mop))) == 0)
THEN 528 mesh%neigh(n,nouv_el(m)) = nouv_el(mop)
530 mesh%neigh(n,nouv_el(m)) = 0
533 mesh%rr(:,nouv_nd(i)) = rr_lect(:,i)
535 mesh%i_d(nouv_el(m)) = i_d_lect(m)
536 mesh%jj(:,nouv_el(m)) = nouv_nd(jj_lect(:,m))
542 IF (stat(ms) == 1) cycle
543 neighs1 = neighs_lect(ms)
545 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 548 neighs2 = neigh_lect(n,neighs1)
549 IF (i_d_lect(neighs1) /= list_dom(dom))
THEN 550 IF (neighs2 == 0) cycle
551 IF (i_d_lect(neighs2) /= list_dom(dom)) cycle
555 IF (virgin_ms(ms))
THEN 556 virgin_ms(ms) = .false.
558 nouv_els(ms) = msnouv
560 IF (stat(ms) ==3)
THEN 562 virgin_nd(jjs_lect(:,ms)) = .true.
563 virgin_ms(ms) = .true.
567 neighs1 = neighs_lect(ms)
568 IF ((abs(i_d_lect(neighs1) - list_dom(dom)))==0)
THEN 574 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 576 neighs2 = neigh_lect(n,neighs1)
581 IF ((abs(i_d_lect(neighs2) - list_dom(dom)))==0)
THEN 586 IF (.NOT.t1 .AND. t2)
THEN 587 neighs_lect(ms) = neighs2
595 IF (stat(ms) == 1) cycle
596 neighs1 = neighs_lect(ms)
598 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 601 neighs2 = neigh_lect(n,neighs1)
602 IF (i_d_lect(neighs1) /= list_dom(dom))
THEN 603 IF (neighs2 == 0) cycle
604 IF (i_d_lect(neighs2) /= list_dom(dom)) cycle
608 mesh%jjs(:,nouv_els(ms)) = nouv_nd(jjs_lect(:,ms))
609 mesh%neighs(nouv_els(ms)) = nouv_el(neighs_lect(ms))
610 mesh%sides(nouv_els(ms)) = sides_lect(ms)
611 IF (stat(ms)==3)
THEN 612 neighs1 = neighs_lect(ms)
614 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 616 mesh%neigh(n,nouv_el(neighs1)) = 0
617 neighs2 = neigh_lect(n,neighs1)
619 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs2))) /= 0)
EXIT 621 mesh%neigh(n,nouv_el(neighs2)) = 0
628 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
629 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
630 DEALLOCATE(rr_lect, virgin_nd, virgin_ms, stat)
631 DEALLOCATE(nouv_nd,nouv_el,nouv_els)
634 ALLOCATE(mesh%iis(nws,mesh%mes))
635 CALL dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
637 mesh%nps =
SIZE(mesh%j_s)
639 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
641 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
642 'mes ',mesh%mes,
'nps ', mesh%nps
643 WRITE (20,*)
'MAXVAL(sides)', maxval(mesh%sides),
'MAXVAL(i_d)', maxval(mesh%i_d)
647 mesh%edge_stab = .false.
654 mesh, mesh_formatted, edge_stab)
661 CHARACTER(len=200),
INTENT(IN) :: dir, fil
662 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
663 INTEGER,
INTENT(IN) :: type_fe
665 LOGICAL,
INTENT(IN) :: mesh_formatted
666 LOGICAL,
OPTIONAL,
INTENT(IN) :: edge_stab
668 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
669 ancien_nd, ancien_el, ancien_els
670 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
671 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
672 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
673 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
676 INTEGER :: mnouv, nnouv, i, dom
677 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
678 INTEGER :: d_end, f_end
679 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
680 CHARACTER(len=60) :: text
681 CHARACTER(len=2) :: truc
684 DO n = 1,
SIZE(list_dom)
686 WRITE(truc,
'(i2)') list_dom(n)
688 text = text(1:d_end)//
'_'//truc(f_end:)
693 text = text(1:d_end)//
'_FE_1' 695 text = text(1:d_end)//
'_FE_2' 700 IF (mesh_formatted)
THEN 701 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
703 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
705 OPEN(unit=20,file=text,
form=
'formatted', status=
'unknown')
709 IF (type_fe == 2)
THEN 710 IF (mesh_formatted)
THEN 711 READ(30,*) np, nw, me, nws, mes
713 READ(30) np, nw, me, nws, mes
716 IF (mesh_formatted)
THEN 724 IF (mesh_formatted)
THEN 732 IF (mesh_formatted)
THEN 741 IF (mesh_formatted)
THEN 742 READ (30, *) np, nw, me, nws, mes
744 READ(30) np, nw, me, nws, mes
747 IF (nw==3 .AND. nws==2)
THEN 749 ELSE IF (nw==6 .AND. nws==3)
THEN 751 ELSE IF (nw==4 .AND. nws==3)
THEN 753 ELSE IF (nw==10 .AND. nws==6)
THEN 756 WRITE(*,*)
' Finite element not yet programmed ' 757 WRITE(*,*) kd, nw, nws
761 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
762 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
763 nouv_el(0:me), ancien_el(me), virgin_el(me))
767 IF (mesh_formatted)
THEN 769 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
772 READ(30) jj_lect, neigh_lect, i_d_lect
782 DO dom = 1,
SIZE(list_dom)
784 IF (abs(list_dom(dom)-i_d_lect(m)) /= 0) cycle
785 virgin_el(m) = .false.
789 DO n = 1, nw; i = jj_lect(n,m)
790 IF (virgin_nd(i))
THEN 791 virgin_nd(i) = .false.
802 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
805 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
806 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
807 mesh%i_d(m) = i_d_lect(ancien_el(m))
811 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
813 IF (mesh_formatted)
THEN 815 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
818 READ(30) jjs_lect, neighs_lect, sides_lect
822 ALLOCATE(nouv_els(mes), ancien_els(mes))
823 DEALLOCATE(virgin_el)
824 ALLOCATE(virgin_el(mes))
827 DO dom = 1,
SIZE(list_dom)
829 neighs1 = neighs_lect(ms)
831 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 833 neighs2 = neigh_lect(n,neighs1)
835 IF (abs(list_dom(dom)-i_d_lect(neighs1)) == 0)
THEN 837 ELSE IF (neighs2 /= 0)
THEN 838 IF (abs(list_dom(dom)-i_d_lect(neighs2)) == 0)
THEN 840 neighs_lect(ms) = neighs2
846 IF (.NOT.virgin_el(ms)) cycle
848 virgin_el(ms) = .false.
850 nouv_els(ms) = msnouv
851 ancien_els(msnouv) = ms
856 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
857 mesh%sides(mesh%mes))
860 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
861 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
862 mesh%sides(ms) = sides_lect(ancien_els(ms))
867 ALLOCATE(rr_lect(kd,np))
869 IF (mesh_formatted)
THEN 871 READ(30,*) rr_lect(:,n)
877 ALLOCATE(mesh%rr(kd,mesh%np))
879 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
881 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
882 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
883 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
884 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
887 ALLOCATE(mesh%iis(nws,mesh%mes))
888 CALL dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
890 mesh%nps =
SIZE(mesh%j_s)
892 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
894 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
895 'mes ',mesh%mes,
'nps ', mesh%nps
896 WRITE (20,*)
'MAXVAL(sides)', maxval(mesh%sides),
'MAXVAL(i_d)', maxval(mesh%i_d)
899 IF (
PRESENT(edge_stab))
THEN 900 mesh%edge_stab = edge_stab
903 mesh%edge_stab = .false.
920 CHARACTER(len=200),
INTENT(IN) :: dir, fil
921 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
922 INTEGER,
INTENT(IN) :: type_fe
924 LOGICAL,
INTENT(IN) :: mesh_formatted
925 LOGICAL,
OPTIONAL,
INTENT(IN) :: edge_stab
927 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
928 ancien_nd, ancien_el, ancien_els
929 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
930 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
931 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
932 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
935 INTEGER :: mnouv, nnouv, i
936 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
937 INTEGER :: d_end, f_end
938 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
939 CHARACTER(len=60) :: text
940 CHARACTER(len=2) :: truc
944 DO n = 1,
SIZE(list_dom)
946 WRITE(truc,
'(i2)') list_dom(n)
948 text = text(1:d_end)//
'_'//truc(f_end:)
953 text = text(1:d_end)//
'_FE_1' 955 text = text(1:d_end)//
'_FE_2' 961 IF (mesh_formatted)
THEN 962 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
964 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
966 OPEN(unit=20,file=text,
form=
'formatted', status=
'unknown')
970 IF (type_fe == 2)
THEN 971 IF (mesh_formatted)
THEN 972 READ(30,*) np, nw, me, nws, mes
974 READ(30) np, nw, me, nws, mes
977 IF (mesh_formatted)
THEN 985 IF (mesh_formatted)
THEN 993 IF (mesh_formatted)
THEN 1002 IF (mesh_formatted)
THEN 1003 READ (30, *) np, nw, me, nws, mes
1005 READ(30) np, nw, me, nws, mes
1008 IF (nw==3 .AND. nws==2)
THEN 1010 ELSE IF (nw==6 .AND. nws==3)
THEN 1012 ELSE IF (nw==4 .AND. nws==3)
THEN 1014 ELSE IF (nw==10 .AND. nws==6)
THEN 1017 WRITE(*,*)
' Finite element not yet programmed ' 1021 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
1022 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
1023 nouv_el(0:me), ancien_el(me), virgin_el(me))
1027 IF (mesh_formatted)
THEN 1029 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
1032 READ(30) jj_lect, neigh_lect, i_d_lect
1042 IF (minval(abs(list_dom-i_d_lect(m))) /= 0) cycle
1043 virgin_el(m) = .false.
1046 ancien_el(mnouv) = m
1047 DO n = 1, nw; i = jj_lect(n,m)
1048 IF (virgin_nd(i))
THEN 1049 virgin_nd(i) = .false.
1052 ancien_nd(nnouv) = i
1060 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
1063 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
1064 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
1065 mesh%i_d(m) = i_d_lect(ancien_el(m))
1069 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
1071 IF (mesh_formatted)
THEN 1073 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
1076 READ(30) jjs_lect, neighs_lect, sides_lect
1080 ALLOCATE(nouv_els(mes), ancien_els(mes))
1081 DEALLOCATE(virgin_el)
1082 ALLOCATE(virgin_el(mes))
1087 neighs1 = neighs_lect(ms)
1089 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 1091 neighs2 = neigh_lect(n,neighs1)
1093 IF (minval(abs(list_dom-i_d_lect(neighs1))) == 0)
THEN 1095 ELSE IF (neighs2 /= 0)
THEN 1096 IF (minval(abs(list_dom-i_d_lect(neighs2))) == 0)
THEN 1098 neighs_lect(ms) = neighs2
1102 IF (.NOT.test) cycle
1103 virgin_el(ms) = .false.
1105 nouv_els(ms) = msnouv
1106 ancien_els(msnouv) = ms
1111 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
1112 mesh%sides(mesh%mes))
1115 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
1116 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
1117 mesh%sides(ms) = sides_lect(ancien_els(ms))
1122 ALLOCATE(rr_lect(kd,np))
1124 IF (mesh_formatted)
THEN 1126 READ(30,*) rr_lect(:,n)
1132 ALLOCATE(mesh%rr(kd,mesh%np))
1134 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
1136 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
1137 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
1138 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
1139 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
1142 ALLOCATE(mesh%iis(nws,mesh%mes))
1143 CALL dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
1145 mesh%nps =
SIZE(mesh%j_s)
1147 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
1149 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
1150 'mes ',mesh%mes,
'nps ', mesh%nps
1151 WRITE (20,*)
'MAXVAL(sides)', maxval(mesh%sides),
'MAXVAL(i_d)', maxval(mesh%i_d)
1154 IF (
PRESENT(edge_stab))
THEN 1155 mesh%edge_stab = edge_stab
1158 mesh%edge_stab = .false.
1175 CHARACTER(len=200),
INTENT(IN) :: dir, fil
1176 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
1177 INTEGER,
INTENT(IN) :: type_fe
1180 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
1181 ancien_nd, ancien_el, ancien_els
1182 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
1183 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
1184 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
1185 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
1188 INTEGER :: mnouv, nnouv, i
1189 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
1190 INTEGER :: d_end, f_end
1191 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
1198 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
1200 OPEN(unit=20,file=
'error_mesh',
form=
'formatted',status=
'unknown')
1204 IF (type_fe == 2)
THEN 1205 READ(30,*) np, nw, me, nws, mes
1221 READ (30, *) np, nw, me, nws, mes
1224 IF (nw==3 .AND. nws==2)
THEN 1226 ELSE IF (nw==6 .AND. nws==3)
THEN 1228 ELSE IF (nw==4 .AND. nws==3)
THEN 1230 ELSE IF (nw==10 .AND. nws==6)
THEN 1233 WRITE(*,*)
' Finite element not yet programmed ' 1237 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
1238 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
1239 nouv_el(0:me), ancien_el(me), virgin_el(me))
1244 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
1256 IF (minval(abs(list_dom-i_d_lect(m))) /= 0) cycle
1257 virgin_el(m) = .false.
1260 ancien_el(mnouv) = m
1261 DO n = 1, nw; i = jj_lect(n,m)
1262 IF (virgin_nd(i))
THEN 1263 virgin_nd(i) = .false.
1266 ancien_nd(nnouv) = i
1274 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
1277 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
1278 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
1279 mesh%i_d(m) = i_d_lect(ancien_el(m))
1283 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
1286 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
1292 ALLOCATE(nouv_els(mes), ancien_els(mes))
1293 DEALLOCATE(virgin_el)
1294 ALLOCATE(virgin_el(mes))
1298 neighs1 = neighs_lect(ms)
1300 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 1302 neighs2 = neigh_lect(n,neighs1)
1304 IF (minval(abs(list_dom-i_d_lect(neighs1))) == 0)
THEN 1306 ELSE IF (neighs2 /= 0)
THEN 1307 IF (minval(abs(list_dom-i_d_lect(neighs2))) == 0)
THEN 1309 neighs_lect(ms) = neighs2
1312 IF (.NOT.test) cycle
1313 virgin_el(ms) = .false.
1315 nouv_els(ms) = msnouv
1316 ancien_els(msnouv) = ms
1321 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
1322 mesh%sides(mesh%mes))
1325 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
1326 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
1327 mesh%sides(ms) = sides_lect(ancien_els(ms))
1332 ALLOCATE(rr_lect(kd,np))
1335 READ(30,*) rr_lect(:,n)
1339 ALLOCATE(mesh%rr(kd,mesh%np))
1341 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
1343 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
1344 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
1345 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
1346 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
1349 ALLOCATE(mesh%iis(nws,mesh%mes))
1350 CALL dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
1352 mesh%nps =
SIZE(mesh%j_s)
1354 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
1356 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
1357 'mes ',mesh%mes,
'nps ', mesh%nps
1358 WRITE (20,*)
'MAXVAL(sides)', maxval(mesh%sides),
'MAXVAL(i_d)', maxval(mesh%i_d)
1367 SUBROUTINE load_mesh(dir, fil, list_dom, type_fe, mesh)
1375 CHARACTER(len=200),
INTENT(IN) :: dir, fil
1376 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
1377 INTEGER,
INTENT(IN) :: type_fe
1380 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
1381 ancien_nd, ancien_el, ancien_els
1382 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
1383 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
1384 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
1385 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
1388 INTEGER :: mnouv, nnouv, i
1389 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
1390 INTEGER :: d_end, f_end
1391 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
1392 CHARACTER(len=20) :: text
1393 CHARACTER(len=2) :: truc
1397 DO n = 1,
SIZE(list_dom)
1399 WRITE(truc,
'(i2)') list_dom(n)
1401 text = text(1:d_end)//
'_'//truc(f_end:)
1405 IF (type_fe==1)
THEN 1406 text = text(1:d_end)//
'_FE_1' 1408 text = text(1:d_end)//
'_FE_2' 1415 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
1416 OPEN(unit=20,file=text,
form=
'formatted', status=
'unknown')
1420 IF (type_fe == 2)
THEN 1422 READ(30) np, nw, me, nws, mes
1445 READ(30) np, nw, me, nws, mes
1447 IF (nw==3 .AND. nws==2)
THEN 1449 ELSE IF (nw==6 .AND. nws==3)
THEN 1451 ELSE IF (nw==4 .AND. nws==3)
THEN 1453 ELSE IF (nw==10 .AND. nws==6)
THEN 1456 WRITE(*,*)
' Finite element not yet programmed ' 1460 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
1461 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
1462 nouv_el(0:me), ancien_el(me), virgin_el(me))
1470 READ(30) jj_lect, neigh_lect, i_d_lect
1479 IF (minval(abs(list_dom-i_d_lect(m))) /= 0) cycle
1480 virgin_el(m) = .false.
1483 ancien_el(mnouv) = m
1484 DO n = 1, nw; i = jj_lect(n,m)
1485 IF (virgin_nd(i))
THEN 1486 virgin_nd(i) = .false.
1489 ancien_nd(nnouv) = i
1497 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
1500 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
1501 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
1502 mesh%i_d(m) = i_d_lect(ancien_el(m))
1506 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
1518 READ(30) jjs_lect, neighs_lect, sides_lect
1521 ALLOCATE(nouv_els(mes), ancien_els(mes))
1522 DEALLOCATE(virgin_el)
1523 ALLOCATE(virgin_el(mes))
1528 neighs1 = neighs_lect(ms)
1530 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT 1532 neighs2 = neigh_lect(n,neighs1)
1534 IF (minval(abs(list_dom-i_d_lect(neighs1))) == 0)
THEN 1536 ELSE IF (neighs2 /= 0)
THEN 1537 IF (minval(abs(list_dom-i_d_lect(neighs2))) == 0)
THEN 1539 neighs_lect(ms) = neighs2
1543 IF (.NOT.test) cycle
1544 virgin_el(ms) = .false.
1546 nouv_els(ms) = msnouv
1547 ancien_els(msnouv) = ms
1552 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
1553 mesh%sides(mesh%mes))
1556 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
1557 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
1558 mesh%sides(ms) = sides_lect(ancien_els(ms))
1563 ALLOCATE(rr_lect(kd,np))
1571 ALLOCATE(mesh%rr(kd,mesh%np))
1573 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
1575 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
1576 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
1577 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
1578 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
1581 ALLOCATE(mesh%iis(nws,mesh%mes))
1582 CALL dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
1584 mesh%nps =
SIZE(mesh%j_s)
1586 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
1588 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
1589 'mes ',mesh%mes,
'nps ', mesh%nps
1590 WRITE (20,*)
'MAXVAL(sides)', maxval(mesh%sides),
'MAXVAL(i_d)', maxval(mesh%i_d)
1607 INTEGER,
DIMENSION(:,:),
INTENT(IN) :: jjs
1608 INTEGER,
DIMENSION(:),
INTENT(IN) :: j_s
1609 INTEGER,
DIMENSION(:,:),
INTENT(OUT) :: iis
1611 INTEGER :: ms, ls, j, i
1613 DO ms = 1,
SIZE(jjs,2)
1614 DO ls = 1,
SIZE(jjs,1)
1617 IF ( j == j_s(i) ) iis(ls,ms) = i
1628 LOGICAL,
DIMENSION(mesh%me) :: virgin
1629 INTEGER :: m, mop, nw, me, l, lop, n, n1, n2, edge, nt,nws
1630 nw =
SIZE(mesh%jj,1)
1631 nws =
SIZE(mesh%jjs,1)
1633 IF (
SIZE(mesh%rr,1)==2)
THEN 1636 WRITE(*,*)
' BUG: prep_interfaces, 3D not programmed yet ' 1646 mop = mesh%neigh(n,m)
1648 IF (.NOT.virgin(mop)) cycle
1652 IF (
SIZE(mesh%rr,1)==2)
THEN 1653 IF (edge/=(3*mesh%me - mesh%mes)/2)
THEN 1654 WRITE(*,*)
' BUG in prep_interfaces, edge/=(3*mesh%me + mesh%mes)/2' 1655 WRITE(*,*)
' edge ', edge, (3*mesh%me - mesh%mes)/2
1656 WRITE(*,*)
' mesh%mes ', mesh%mes,
' mesh%me ',mesh%me
1662 ALLOCATE(mesh%jji(nw,2,edge), mesh%jjsi(nws,edge),mesh%neighi(2,edge) )
1669 mop = mesh%neigh(n,m)
1671 IF (.NOT.virgin(mop)) cycle
1673 n1 = modulo(n,nt) + 1
1674 n2 = modulo(n+1,nt) + 1
1675 mesh%jjsi(1,edge) = mesh%jj(n1,m)
1676 mesh%jjsi(2,edge) = mesh%jj(n2,m)
1679 mesh%jjsi(3,edge) = mesh%jj(6,m)
1680 ELSE IF (n1+n2==5)
THEN 1681 mesh%jjsi(3,edge) = mesh%jj(4,m)
1682 ELSE IF (n1+n2==4)
THEN 1683 mesh%jjsi(3,edge) = mesh%jj(5,m)
1685 WRITE(*,*)
' BUG prep_interfaces n1+n2 not correct ' 1692 mesh%neighi(1,edge) = m
1693 mesh%neighi(2,edge) = mop
1697 mesh%neighi(1,edge) = mop
1698 mesh%neighi(2,edge) = m
1701 mesh%jji(n1,l,edge) = mesh%jj(n1,m)
1702 mesh%jji(n1,lop,edge) = mesh%jj(n1,mop)
subroutine, public load_dg_mesh_free_format(dir, fil, list_dom, list_inter, type_fe, mesh, mesh_formatted)
subroutine, public load_mesh_free_format_ordered(dir, fil, list_dom, type_fe, mesh, mesh_formatted, edge_stab)
subroutine dirichlet_nodes(jjs_in, sides_in, dir_in, js_d)
subroutine, public prep_interfaces(mesh)
subroutine, public create_p3_mesh(p1_mesh, p2_mesh, p3_mesh, type_fe)
subroutine error_petsc(string)
subroutine, public load_mesh(dir, fil, list_dom, type_fe, mesh)
integer function, public start_of_string(string)
subroutine, public incr_vrtx_indx_enumeration(mesh, type_fe)
subroutine, public load_mesh_formatted(dir, fil, list_dom, type_fe, mesh)
subroutine, public load_mesh_free_format(dir, fil, list_dom, type_fe, mesh, mesh_formatted, edge_stab)
subroutine, public incr_vrtx_indx_enumeration_for_interfaces(interface_XX, nws1, nws2)
subroutine surf_nodes_i(jjs, j_s, iis)
integer function, public last_c_leng(len_str, string)
section doc_intro_frame_work_num_app Numerical approximation subsection doc_intro_fram_work_num_app_Fourier_FEM Fourier Finite element representation The SFEMaNS code uses a hybrid Fourier Finite element formulation The Fourier decomposition allows to approximate the problem’s solutions for each Fourier mode modulo nonlinear terms that are made explicit The variables are then approximated on a meridian section of the domain with a finite element method The numerical approximation of a function f $f f is written in the following generic form