28 CHARACTER(len=200),
INTENT(IN) :: dir, fil
29 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom, list_inter
30 INTEGER,
INTENT(IN) :: type_fe
32 LOGICAL,
INTENT(IN) :: mesh_formatted
34 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els
35 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
36 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect, stat
37 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_ms
38 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
45 INTEGER :: mnouv, nnouv, i, dom
46 INTEGER :: n, m, mop, ms, msnouv, neighs1, neighs2
47 INTEGER :: d_end, f_end
48 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
49 CHARACTER(len=40) ::
text
50 CHARACTER(len=2) :: truc
54 DO n = 1,
SIZE(list_dom)
56 WRITE(truc,
'(i2)') list_dom(n)
58 text =
text(1:d_end)//
'_'//truc(f_end:)
69 IF (mesh_formatted)
THEN
70 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
72 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
74 OPEN(unit=20,file=
text,
form=
'formatted', status=
'unknown')
77 IF (type_fe == 2)
THEN
78 IF (mesh_formatted)
THEN
79 READ(30,*) np, nw, me, nws, mes
90 READ(30) np, nw, me, nws, mes
97 IF (mesh_formatted)
THEN
98 READ(30, *) np, nw, me, nws, mes
100 READ(30) np, nw, me, nws, mes
103 IF (nw==3 .AND. nws==2)
THEN
105 ELSE IF (nw==6 .AND. nws==3)
THEN
107 ELSE IF (nw==4 .AND. nws==3)
THEN
109 ELSE IF (nw==10 .AND. nws==6)
THEN
112 WRITE(*,*)
' Finite element not yet programmed '
117 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
118 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
119 ALLOCATE(rr_lect(kd,np))
121 IF (mesh_formatted)
THEN
123 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
126 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
129 READ(30,*) rr_lect(:,n)
132 READ(30) jj_lect, neigh_lect, i_d_lect
133 READ(30) jjs_lect, neighs_lect, sides_lect
143 neighs1 = neighs_lect(ms)
145 WRITE(*,*)
' BUG in prep_mesh, neighs1=0 '
148 IF (minval(abs(i_d_lect(neighs1) - list_dom))==0)
THEN
154 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
156 neighs2 = neigh_lect(n,neighs1)
166 IF (minval(abs(i_d_lect(neighs2) - list_dom))==0)
THEN
174 IF (
SIZE(list_inter)==0)
THEN
176 ELSE IF (minval(abs(sides_lect(ms)-list_inter))==0)
THEN
194 ALLOCATE (nouv_nd(np), nouv_els(mes), virgin_nd(np), virgin_ms(mes), nouv_el(me))
201 DO dom = 1,
SIZE(list_dom)
203 IF (list_dom(dom) /= i_d_lect(m)) cycle
206 DO n = 1, nw; i = jj_lect(n,m)
207 IF (virgin_nd(i))
THEN
208 virgin_nd(i) = .false.
215 IF (stat(ms) /= 1 .AND. stat(ms) /=2 .AND. stat(ms) /=3)
THEN
216 WRITE(*,*)
' BUG in prep_mesh, stat out of bounds '
221 IF (stat(ms) == 1) cycle
222 neighs1 = neighs_lect(ms)
224 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
227 neighs2 = neigh_lect(n,neighs1)
228 IF (i_d_lect(neighs1) /= list_dom(dom))
THEN
229 IF (neighs2 == 0) cycle
230 IF (i_d_lect(neighs2) /= list_dom(dom)) cycle
234 IF (virgin_ms(ms))
THEN
235 virgin_ms(ms) = .false.
238 IF (stat(ms) ==3)
THEN
240 virgin_nd(jjs_lect(:,ms)) = .true.
241 virgin_ms(ms) = .true.
250 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
251 ALLOCATE(mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), mesh%sides(mesh%mes))
252 ALLOCATE(mesh%rr(kd,mesh%np))
258 DO dom = 1,
SIZE(list_dom)
261 IF (list_dom(dom) /=i_d_lect(m)) cycle
262 DO n = 1, nw; i = jj_lect(n,m)
263 IF (virgin_nd(i))
THEN
264 virgin_nd(i) = .false.
273 IF (list_dom(dom) /=i_d_lect(m)) cycle
274 DO n = 1, nw; i = jj_lect(n,m)
275 IF (n .LE. nwneigh)
THEN
276 mop = neigh_lect(n,m)
278 mesh%neigh(n,nouv_el(m)) = 0
279 ELSE IF (minval(abs(list_dom - i_d_lect(mop))) == 0)
THEN
280 mesh%neigh(n,nouv_el(m)) = nouv_el(mop)
282 mesh%neigh(n,nouv_el(m)) = 0
285 mesh%rr(:,nouv_nd(i)) = rr_lect(:,i)
287 mesh%i_d(nouv_el(m)) = i_d_lect(m)
288 mesh%jj(:,nouv_el(m)) = nouv_nd(jj_lect(:,m))
294 IF (stat(ms) == 1) cycle
295 neighs1 = neighs_lect(ms)
297 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
300 neighs2 = neigh_lect(n,neighs1)
301 IF (i_d_lect(neighs1) /= list_dom(dom))
THEN
302 IF (neighs2 == 0) cycle
303 IF (i_d_lect(neighs2) /= list_dom(dom)) cycle
307 IF (virgin_ms(ms))
THEN
308 virgin_ms(ms) = .false.
310 nouv_els(ms) = msnouv
312 IF (stat(ms) ==3)
THEN
314 virgin_nd(jjs_lect(:,ms)) = .true.
315 virgin_ms(ms) = .true.
319 neighs1 = neighs_lect(ms)
320 IF ((abs(i_d_lect(neighs1) - list_dom(dom)))==0)
THEN
326 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
328 neighs2 = neigh_lect(n,neighs1)
333 IF ((abs(i_d_lect(neighs2) - list_dom(dom)))==0)
THEN
338 IF (.NOT.t1 .AND. t2)
THEN
339 neighs_lect(ms) = neighs2
347 IF (stat(ms) == 1) cycle
348 neighs1 = neighs_lect(ms)
350 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
353 neighs2 = neigh_lect(n,neighs1)
354 IF (i_d_lect(neighs1) /= list_dom(dom))
THEN
355 IF (neighs2 == 0) cycle
356 IF (i_d_lect(neighs2) /= list_dom(dom)) cycle
360 mesh%jjs(:,nouv_els(ms)) = nouv_nd(jjs_lect(:,ms))
361 mesh%neighs(nouv_els(ms)) = nouv_el(neighs_lect(ms))
362 mesh%sides(nouv_els(ms)) = sides_lect(ms)
363 IF (stat(ms)==3)
THEN
364 neighs1 = neighs_lect(ms)
366 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
368 mesh%neigh(n,nouv_el(neighs1)) = 0
369 neighs2 = neigh_lect(n,neighs1)
371 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs2))) /= 0)
EXIT
373 mesh%neigh(n,nouv_el(neighs2)) = 0
426 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
427 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
428 DEALLOCATE(rr_lect, virgin_nd, virgin_ms, stat)
429 DEALLOCATE(nouv_nd,nouv_el,nouv_els)
432 ALLOCATE(mesh%iis(nws,mesh%mes))
433 CALL
dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
435 mesh%nps =
SIZE(mesh%j_s)
437 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
439 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
440 'mes ',mesh%mes,
'nps ', mesh%nps
444 mesh%edge_stab = .false.
451 mesh, mesh_formatted, edge_stab)
458 CHARACTER(len=200),
INTENT(IN) :: dir, fil
459 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
460 INTEGER,
INTENT(IN) :: type_fe
462 LOGICAL,
INTENT(IN) :: mesh_formatted
463 LOGICAL,
OPTIONAL,
INTENT(IN) :: edge_stab
465 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
466 ancien_nd, ancien_el, ancien_els
467 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
468 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
469 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
470 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
473 INTEGER :: mnouv, nnouv, i, dom
474 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
475 INTEGER :: d_end, f_end
476 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
477 CHARACTER(len=60) ::
text
478 CHARACTER(len=2) :: truc
481 DO n = 1,
SIZE(list_dom)
483 WRITE(truc,
'(i2)') list_dom(n)
485 text =
text(1:d_end)//
'_'//truc(f_end:)
497 IF (mesh_formatted)
THEN
498 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
500 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
502 OPEN(unit=20,file=
text,
form=
'formatted', status=
'unknown')
506 IF (type_fe == 2)
THEN
507 IF (mesh_formatted)
THEN
508 READ(30,*) np, nw, me, nws, mes
510 READ(30) np, nw, me, nws, mes
513 IF (mesh_formatted)
THEN
521 IF (mesh_formatted)
THEN
529 IF (mesh_formatted)
THEN
538 IF (mesh_formatted)
THEN
539 READ (30, *) np, nw, me, nws, mes
541 READ(30) np, nw, me, nws, mes
544 IF (nw==3 .AND. nws==2)
THEN
546 ELSE IF (nw==6 .AND. nws==3)
THEN
548 ELSE IF (nw==4 .AND. nws==3)
THEN
550 ELSE IF (nw==10 .AND. nws==6)
THEN
553 WRITE(*,*)
' Finite element not yet programmed '
554 WRITE(*,*) kd, nw, nws
558 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
559 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
560 nouv_el(0:me), ancien_el(me), virgin_el(me))
564 IF (mesh_formatted)
THEN
566 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
569 READ(30) jj_lect, neigh_lect, i_d_lect
579 DO dom = 1,
SIZE(list_dom)
581 IF (abs(list_dom(dom)-i_d_lect(m)) /= 0) cycle
582 virgin_el(m) = .false.
586 DO n = 1, nw; i = jj_lect(n,m)
587 IF (virgin_nd(i))
THEN
588 virgin_nd(i) = .false.
599 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
602 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
603 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
604 mesh%i_d(m) = i_d_lect(ancien_el(m))
608 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
610 IF (mesh_formatted)
THEN
612 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
615 READ(30) jjs_lect, neighs_lect, sides_lect
619 ALLOCATE(nouv_els(mes), ancien_els(mes))
620 DEALLOCATE(virgin_el)
621 ALLOCATE(virgin_el(mes))
624 DO dom = 1,
SIZE(list_dom)
626 neighs1 = neighs_lect(ms)
628 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
630 neighs2 = neigh_lect(n,neighs1)
632 IF (abs(list_dom(dom)-i_d_lect(neighs1)) == 0)
THEN
634 ELSE IF (neighs2 /= 0)
THEN
635 IF (abs(list_dom(dom)-i_d_lect(neighs2)) == 0)
THEN
637 neighs_lect(ms) = neighs2
643 IF (.NOT.virgin_el(ms)) cycle
645 virgin_el(ms) = .false.
647 nouv_els(ms) = msnouv
648 ancien_els(msnouv) = ms
653 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
654 mesh%sides(mesh%mes))
657 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
658 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
659 mesh%sides(ms) = sides_lect(ancien_els(ms))
664 ALLOCATE(rr_lect(kd,np))
666 IF (mesh_formatted)
THEN
668 READ(30,*) rr_lect(:,n)
674 ALLOCATE(mesh%rr(kd,mesh%np))
676 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
678 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
679 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
680 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
681 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
684 ALLOCATE(mesh%iis(nws,mesh%mes))
685 CALL
dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
687 mesh%nps =
SIZE(mesh%j_s)
689 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
691 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
692 'mes ',mesh%mes,
'nps ', mesh%nps
696 IF (present(edge_stab))
THEN
697 mesh%edge_stab = edge_stab
700 mesh%edge_stab = .false.
717 CHARACTER(len=200),
INTENT(IN) :: dir, fil
718 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
719 INTEGER,
INTENT(IN) :: type_fe
721 LOGICAL,
INTENT(IN) :: mesh_formatted
722 LOGICAL,
OPTIONAL,
INTENT(IN) :: edge_stab
724 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
725 ancien_nd, ancien_el, ancien_els
726 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
727 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
728 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
729 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
732 INTEGER :: mnouv, nnouv, i
733 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
734 INTEGER :: d_end, f_end
735 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
736 CHARACTER(len=60) ::
text
737 CHARACTER(len=2) :: truc
741 DO n = 1,
SIZE(list_dom)
743 WRITE(truc,
'(i2)') list_dom(n)
745 text =
text(1:d_end)//
'_'//truc(f_end:)
758 IF (mesh_formatted)
THEN
759 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
761 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
763 OPEN(unit=20,file=
text,
form=
'formatted', status=
'unknown')
767 IF (type_fe == 2)
THEN
768 IF (mesh_formatted)
THEN
769 READ(30,*) np, nw, me, nws, mes
771 READ(30) np, nw, me, nws, mes
774 IF (mesh_formatted)
THEN
782 IF (mesh_formatted)
THEN
790 IF (mesh_formatted)
THEN
799 IF (mesh_formatted)
THEN
800 READ (30, *) np, nw, me, nws, mes
802 READ(30) np, nw, me, nws, mes
805 IF (nw==3 .AND. nws==2)
THEN
807 ELSE IF (nw==6 .AND. nws==3)
THEN
809 ELSE IF (nw==4 .AND. nws==3)
THEN
811 ELSE IF (nw==10 .AND. nws==6)
THEN
814 WRITE(*,*)
' Finite element not yet programmed '
818 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
819 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
820 nouv_el(0:me), ancien_el(me), virgin_el(me))
824 IF (mesh_formatted)
THEN
826 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
829 READ(30) jj_lect, neigh_lect, i_d_lect
839 IF (minval(abs(list_dom-i_d_lect(m))) /= 0) cycle
840 virgin_el(m) = .false.
844 DO n = 1, nw; i = jj_lect(n,m)
845 IF (virgin_nd(i))
THEN
846 virgin_nd(i) = .false.
857 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
860 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
861 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
862 mesh%i_d(m) = i_d_lect(ancien_el(m))
866 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
868 IF (mesh_formatted)
THEN
870 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
873 READ(30) jjs_lect, neighs_lect, sides_lect
877 ALLOCATE(nouv_els(mes), ancien_els(mes))
878 DEALLOCATE(virgin_el)
879 ALLOCATE(virgin_el(mes))
884 neighs1 = neighs_lect(ms)
886 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
888 neighs2 = neigh_lect(n,neighs1)
890 IF (minval(abs(list_dom-i_d_lect(neighs1))) == 0)
THEN
892 ELSE IF (neighs2 /= 0)
THEN
893 IF (minval(abs(list_dom-i_d_lect(neighs2))) == 0)
THEN
895 neighs_lect(ms) = neighs2
900 virgin_el(ms) = .false.
902 nouv_els(ms) = msnouv
903 ancien_els(msnouv) = ms
908 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
909 mesh%sides(mesh%mes))
912 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
913 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
914 mesh%sides(ms) = sides_lect(ancien_els(ms))
919 ALLOCATE(rr_lect(kd,np))
921 IF (mesh_formatted)
THEN
923 READ(30,*) rr_lect(:,n)
929 ALLOCATE(mesh%rr(kd,mesh%np))
931 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
933 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
934 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
935 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
936 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
939 ALLOCATE(mesh%iis(nws,mesh%mes))
940 CALL
dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
942 mesh%nps =
SIZE(mesh%j_s)
944 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
946 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
947 'mes ',mesh%mes,
'nps ', mesh%nps
951 IF (present(edge_stab))
THEN
952 mesh%edge_stab = edge_stab
955 mesh%edge_stab = .false.
972 CHARACTER(len=200),
INTENT(IN) :: dir, fil
973 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
974 INTEGER,
INTENT(IN) :: type_fe
977 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
978 ancien_nd, ancien_el, ancien_els
979 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
980 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
981 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
982 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
985 INTEGER :: mnouv, nnouv, i
986 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
987 INTEGER :: d_end, f_end
988 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
995 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'formatted')
997 OPEN(unit=20,file=
'error_mesh',
form=
'formatted',status=
'unknown')
1001 IF (type_fe == 2)
THEN
1002 READ(30,*) np, nw, me, nws, mes
1018 READ (30, *) np, nw, me, nws, mes
1021 IF (nw==3 .AND. nws==2)
THEN
1023 ELSE IF (nw==6 .AND. nws==3)
THEN
1025 ELSE IF (nw==4 .AND. nws==3)
THEN
1027 ELSE IF (nw==10 .AND. nws==6)
THEN
1030 WRITE(*,*)
' Finite element not yet programmed '
1034 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
1035 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
1036 nouv_el(0:me), ancien_el(me), virgin_el(me))
1041 READ(30,*) jj_lect(:,m), neigh_lect(:,m), i_d_lect(m)
1053 IF (minval(abs(list_dom-i_d_lect(m))) /= 0) cycle
1054 virgin_el(m) = .false.
1057 ancien_el(mnouv) = m
1058 DO n = 1, nw; i = jj_lect(n,m)
1059 IF (virgin_nd(i))
THEN
1060 virgin_nd(i) = .false.
1063 ancien_nd(nnouv) = i
1071 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
1074 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
1075 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
1076 mesh%i_d(m) = i_d_lect(ancien_el(m))
1080 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
1083 READ(30,*) jjs_lect(:,ms), neighs_lect(ms), sides_lect(ms)
1089 ALLOCATE(nouv_els(mes), ancien_els(mes))
1090 DEALLOCATE(virgin_el)
1091 ALLOCATE(virgin_el(mes))
1095 neighs1 = neighs_lect(ms)
1097 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
1099 neighs2 = neigh_lect(n,neighs1)
1101 IF (minval(abs(list_dom-i_d_lect(neighs1))) == 0)
THEN
1103 ELSE IF (neighs2 /= 0)
THEN
1104 IF (minval(abs(list_dom-i_d_lect(neighs2))) == 0)
THEN
1106 neighs_lect(ms) = neighs2
1109 IF (.NOT.test) cycle
1110 virgin_el(ms) = .false.
1112 nouv_els(ms) = msnouv
1113 ancien_els(msnouv) = ms
1118 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
1119 mesh%sides(mesh%mes))
1122 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
1123 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
1124 mesh%sides(ms) = sides_lect(ancien_els(ms))
1129 ALLOCATE(rr_lect(kd,np))
1132 READ(30,*) rr_lect(:,n)
1136 ALLOCATE(mesh%rr(kd,mesh%np))
1138 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
1140 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
1141 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
1142 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
1143 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
1146 ALLOCATE(mesh%iis(nws,mesh%mes))
1147 CALL
dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
1149 mesh%nps =
SIZE(mesh%j_s)
1151 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
1153 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
1154 'mes ',mesh%mes,
'nps ', mesh%nps
1172 CHARACTER(len=200),
INTENT(IN) :: dir, fil
1173 INTEGER,
DIMENSION(:),
INTENT(IN) :: list_dom
1174 INTEGER,
INTENT(IN) :: type_fe
1177 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nouv_nd, nouv_el, nouv_els, &
1178 ancien_nd, ancien_el, ancien_els
1179 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: jj_lect, neigh_lect, jjs_lect
1180 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: i_d_lect, sides_lect, neighs_lect
1181 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: virgin_nd, virgin_el
1182 REAL(KIND=8),
ALLOCATABLE,
DIMENSION(:,:) :: rr_lect
1185 INTEGER :: mnouv, nnouv, i
1186 INTEGER :: n, m, ms, msnouv, neighs1, neighs2
1187 INTEGER :: d_end, f_end
1188 INTEGER :: np, nw, me, nws, mes, kd, nwneigh
1189 CHARACTER(len=20) ::
text
1190 CHARACTER(len=2) :: truc
1194 DO n = 1,
SIZE(list_dom)
1196 WRITE(truc,
'(i2)') list_dom(n)
1198 text =
text(1:d_end)//
'_'//truc(f_end:)
1202 IF (type_fe==1)
THEN
1212 OPEN(30,file=trim(adjustl(dir))//
'/'//trim(adjustl(fil)),
form=
'unformatted')
1213 OPEN(unit=20,file=
text,
form=
'formatted', status=
'unknown')
1217 IF (type_fe == 2)
THEN
1219 READ(30) np, nw, me, nws, mes
1242 READ(30) np, nw, me, nws, mes
1244 IF (nw==3 .AND. nws==2)
THEN
1246 ELSE IF (nw==6 .AND. nws==3)
THEN
1248 ELSE IF (nw==4 .AND. nws==3)
THEN
1250 ELSE IF (nw==10 .AND. nws==6)
THEN
1253 WRITE(*,*)
' Finite element not yet programmed '
1257 ALLOCATE (jj_lect(nw,me),neigh_lect(nwneigh,me),i_d_lect(me))
1258 ALLOCATE (nouv_nd(np), ancien_nd(np), virgin_nd(np), &
1259 nouv_el(0:me), ancien_el(me), virgin_el(me))
1267 READ(30) jj_lect, neigh_lect, i_d_lect
1276 IF (minval(abs(list_dom-i_d_lect(m))) /= 0) cycle
1277 virgin_el(m) = .false.
1280 ancien_el(mnouv) = m
1281 DO n = 1, nw; i = jj_lect(n,m)
1282 IF (virgin_nd(i))
THEN
1283 virgin_nd(i) = .false.
1286 ancien_nd(nnouv) = i
1294 ALLOCATE(mesh%jj(nw,mesh%me), mesh%neigh(nwneigh,mesh%me), mesh%i_d(mesh%me))
1297 mesh%jj(:,m) = nouv_nd(jj_lect(:,ancien_el(m)))
1298 mesh%neigh(:,m) = nouv_el(neigh_lect(:,ancien_el(m)))
1299 mesh%i_d(m) = i_d_lect(ancien_el(m))
1303 ALLOCATE (jjs_lect(nws,mes), neighs_lect(mes), sides_lect(mes))
1315 READ(30) jjs_lect, neighs_lect, sides_lect
1318 ALLOCATE(nouv_els(mes), ancien_els(mes))
1319 DEALLOCATE(virgin_el)
1320 ALLOCATE(virgin_el(mes))
1325 neighs1 = neighs_lect(ms)
1327 IF (minval(abs(jjs_lect(:,ms)-jj_lect(n,neighs1))) /= 0)
EXIT
1329 neighs2 = neigh_lect(n,neighs1)
1331 IF (minval(abs(list_dom-i_d_lect(neighs1))) == 0)
THEN
1333 ELSE IF (neighs2 /= 0)
THEN
1334 IF (minval(abs(list_dom-i_d_lect(neighs2))) == 0)
THEN
1336 neighs_lect(ms) = neighs2
1340 IF (.NOT.test) cycle
1341 virgin_el(ms) = .false.
1343 nouv_els(ms) = msnouv
1344 ancien_els(msnouv) = ms
1349 ALLOCATE (mesh%jjs(nws,mesh%mes), mesh%neighs(mesh%mes), &
1350 mesh%sides(mesh%mes))
1353 mesh%jjs(:,ms) = nouv_nd(jjs_lect(:,ancien_els(ms)))
1354 mesh%neighs(ms) = nouv_el(neighs_lect(ancien_els(ms)))
1355 mesh%sides(ms) = sides_lect(ancien_els(ms))
1360 ALLOCATE(rr_lect(kd,np))
1368 ALLOCATE(mesh%rr(kd,mesh%np))
1370 mesh%rr = rr_lect(:,ancien_nd(1:mesh%np))
1372 DEALLOCATE(jj_lect, neigh_lect, i_d_lect)
1373 DEALLOCATE(jjs_lect, neighs_lect, sides_lect)
1374 DEALLOCATE(rr_lect, virgin_el, virgin_nd)
1375 DEALLOCATE(nouv_nd,nouv_el,nouv_els,ancien_nd,ancien_el,ancien_els)
1378 ALLOCATE(mesh%iis(nws,mesh%mes))
1379 CALL
dirichlet_nodes(mesh%jjs, spread(1,1,mesh%mes), spread(.true.,1,1), mesh%j_s)
1381 mesh%nps =
SIZE(mesh%j_s)
1383 WRITE (20,*)
'np_lect',np,
'nw_lect',nw,
'nws_lect',nws,
'me_lect',me,&
1385 WRITE (20,*)
'np ', mesh%np,
'me ', mesh%me, &
1386 'mes ',mesh%mes,
'nps ', mesh%nps
1404 INTEGER,
DIMENSION(:,:),
INTENT(IN) :: jjs
1405 INTEGER,
DIMENSION(:),
INTENT(IN) :: j_s
1406 INTEGER,
DIMENSION(:,:),
INTENT(OUT) :: iis
1408 INTEGER :: ms, ls, j, i
1410 DO ms = 1,
SIZE(jjs,2)
1411 DO ls = 1,
SIZE(jjs,1)
1414 IF ( j == j_s(i) ) iis(ls,ms) = i
1425 LOGICAL,
DIMENSION(mesh%me) :: virgin
1426 INTEGER :: m, mop, nw, me, l, lop, n, n1, n2, edge, nt,nws
1427 nw =
SIZE(mesh%jj,1)
1428 nws =
SIZE(mesh%jjs,1)
1430 IF (
SIZE(mesh%rr,1)==2)
THEN
1433 WRITE(*,*)
' BUG: prep_interfaces, 3D not programmed yet '
1443 mop = mesh%neigh(n,m)
1445 IF (.NOT.virgin(mop)) cycle
1449 IF (
SIZE(mesh%rr,1)==2)
THEN
1450 IF (edge/=(3*mesh%me - mesh%mes)/2)
THEN
1451 WRITE(*,*)
' BUG in prep_interfaces, edge/=(3*mesh%me + mesh%mes)/2'
1452 WRITE(*,*)
' edge ', edge, (3*mesh%me - mesh%mes)/2
1453 WRITE(*,*)
' mesh%mes ', mesh%mes,
' mesh%me ',mesh%me
1459 ALLOCATE(mesh%jji(nw,2,edge), mesh%jjsi(nws,edge),mesh%neighi(2,edge) )
1466 mop = mesh%neigh(n,m)
1468 IF (.NOT.virgin(mop)) cycle
1470 n1 = modulo(n,nt) + 1
1471 n2 = modulo(n+1,nt) + 1
1472 mesh%jjsi(1,edge) = mesh%jj(n1,m)
1473 mesh%jjsi(2,edge) = mesh%jj(n2,m)
1476 mesh%jjsi(3,edge) = mesh%jj(6,m)
1477 ELSE IF (n1+n2==5)
THEN
1478 mesh%jjsi(3,edge) = mesh%jj(4,m)
1479 ELSE IF (n1+n2==4)
THEN
1480 mesh%jjsi(3,edge) = mesh%jj(5,m)
1482 WRITE(*,*)
' BUG prep_interfaces n1+n2 not correct '
1489 mesh%neighi(1,edge) = m
1490 mesh%neighi(2,edge) = mop
1494 mesh%neighi(1,edge) = mop
1495 mesh%neighi(2,edge) = m
1498 mesh%jji(n1,l,edge) = mesh%jj(n1,m)
1499 mesh%jji(n1,lop,edge) = mesh%jj(n1,mop)
subroutine, public load_mesh_formatted(dir, fil, list_dom, type_fe, mesh)
subroutine, public load_mesh(dir, fil, list_dom, type_fe, mesh)
integer function, public start_of_string(string)
subroutine, public load_dg_mesh_free_format(dir, fil, list_dom, list_inter, type_fe, mesh, mesh_formatted)
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 f with f $t f the time and f $M f the number of Fourier modes considered The unknown f f f f f f f f Omega_v f and f Omega f We also consider f a penalty method of the divergence of the velocity field is also implemented The method proceeds as the pressure and the pressure increments< li > For f $n geq0 f let f that matches the Dirichlet boundary conditions of the be the solutions of the following formulation for all f f text
subroutine, public load_mesh_free_format(dir, fil, list_dom, type_fe, mesh, mesh_formatted, edge_stab)
subroutine surf_nodes_i(jjs, j_s, iis)
subroutine dirichlet_nodes(jjs_in, sides_in, dir_in, js_d)
subroutine, public load_mesh_free_format_ordered(dir, fil, list_dom, type_fe, mesh, mesh_formatted, edge_stab)
integer function, public last_c_leng(len_str, string)
subroutine, public prep_interfaces(mesh)
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