source: CIVL/examples/fortran/nek5000/core/dssum.f

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100755
File size: 23.3 KB
Line 
1 subroutine setupds(gs_handle,nx,ny,nz,nel,melg,vertex,glo_num)
2 include 'SIZE'
3 include 'INPUT'
4 include 'PARALLEL'
5 include 'NONCON'
6
7 integer gs_handle
8 integer vertex(1)
9 integer*8 glo_num(1),ngv
10
11 common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
12
13 t0 = dnekclock()
14
15c Global-to-local mapping for gs
16 call set_vert(glo_num,ngv,nx,nel,vertex,.false.)
17
18c Initialize gather-scatter code
19 ntot = nx*ny*nz*nel
20 call fgslib_gs_setup(gs_handle,glo_num,ntot,nekcomm,mp)
21
22c call gs_chkr(glo_num)
23
24 t1 = dnekclock() - t0
25 if (nio.eq.0) then
26 write(6,1) t1,gs_handle,nx,ngv,melg
27 1 format(' setupds time',1pe11.4,' seconds ',2i3,2i12)
28 endif
29c
30 return
31 end
32c-----------------------------------------------------------------------
33 subroutine dssum(u,nx,ny,nz)
34 include 'SIZE'
35 include 'CTIMER'
36 include 'INPUT'
37 include 'NONCON'
38 include 'PARALLEL'
39 include 'TSTEP'
40 real u(1)
41
42 parameter (lface=lx1*ly1)
43 common /nonctmp/ uin(lface,2*ldim),uout(lface)
44
45 ifldt = ifield
46c if (ifldt.eq.0) ifldt = 1
47 if (ifldt.eq.ifldmhd) ifldt = 1
48c write(6,*) ifldt,ifield,gsh_fld(ifldt),imesh,' ifldt'
49
50 if (ifsync) call nekgsync()
51
52#ifdef TIMER
53 if (icalld.eq.0) then
54 tdsmx=0.
55 tdsmn=0.
56 endif
57 icalld=icalld+1
58 etime1=dnekclock()
59#endif
60
61c
62c T ~ ~T T
63c Implement QQ := J Q Q J
64c
65c
66c T
67c This is the J part, translating child data
68c
69c call apply_Jt(u,nx,ny,nz,nel)
70c
71c
72c
73c ~ ~T
74c This is the Q Q part
75c
76 if (gsh_fld(ifldt).ge.0) then
77 if (nio.eq.0.and.loglevel.gt.5)
78 $ write(6,*) 'dssum', ifldt
79 call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0) ! 1 ==> +
80 endif
81c
82c
83c
84c This is the J part, interpolating parent solution onto child
85c
86c call apply_J(u,nx,ny,nz,nel)
87c
88c
89#ifdef TIMER
90 timee=(dnekclock()-etime1)
91 tdsum=tdsum+timee
92 ndsum=icalld
93 tdsmx=max(timee,tdsmx)
94 tdsmn=min(timee,tdsmn)
95#endif
96c
97 return
98 end
99c-----------------------------------------------------------------------
100 subroutine dsop(u,op,nx,ny,nz)
101 include 'SIZE'
102 include 'PARALLEL'
103 include 'INPUT'
104 include 'TSTEP'
105 include 'CTIMER'
106
107 real u(1)
108 character*3 op
109 character*10 s1,s2
110c
111c o gs recognized operations:
112c
113c o "+" ==> addition.
114c o "*" ==> multiplication.
115c o "M" ==> maximum.
116c o "m" ==> minimum.
117c o "A" ==> (fabs(x)>fabs(y)) ? (x) : (y), ident=0.0.
118c o "a" ==> (fabs(x)<fabs(y)) ? (x) : (y), ident=MAX_DBL
119c o "e" ==> ((x)==0.0) ? (y) : (x), ident=0.0.
120c
121c o note: a binary function pointer flavor exists.
122c
123c
124c o gs level:
125c
126c o level=0 ==> pure tree
127c o level>=num_nodes-1 ==> pure pairwise
128c o level = 1,...num_nodes-2 ==> mix tree/pairwise.
129c
130c
131 ifldt = ifield
132c if (ifldt.eq.0) ifldt = 1
133 if (ifldt.eq.ifldmhd) ifldt = 1
134
135c if (nio.eq.0)
136c $ write(6,*) istep,' dsop: ',op,ifield,ifldt,gsh_fld(ifldt)
137
138 if(ifsync) call nekgsync()
139
140 if (op.eq.'+ ') call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0)
141 if (op.eq.'sum') call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0)
142 if (op.eq.'SUM') call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0)
143
144 if (op.eq.'* ') call fgslib_gs_op(gsh_fld(ifldt),u,1,2,0)
145 if (op.eq.'mul') call fgslib_gs_op(gsh_fld(ifldt),u,1,2,0)
146 if (op.eq.'MUL') call fgslib_gs_op(gsh_fld(ifldt),u,1,2,0)
147
148 if (op.eq.'m ') call fgslib_gs_op(gsh_fld(ifldt),u,1,3,0)
149 if (op.eq.'min') call fgslib_gs_op(gsh_fld(ifldt),u,1,3,0)
150 if (op.eq.'mna') call fgslib_gs_op(gsh_fld(ifldt),u,1,3,0)
151 if (op.eq.'MIN') call fgslib_gs_op(gsh_fld(ifldt),u,1,3,0)
152 if (op.eq.'MNA') call fgslib_gs_op(gsh_fld(ifldt),u,1,3,0)
153
154 if (op.eq.'M ') call fgslib_gs_op(gsh_fld(ifldt),u,1,4,0)
155 if (op.eq.'max') call fgslib_gs_op(gsh_fld(ifldt),u,1,4,0)
156 if (op.eq.'mxa') call fgslib_gs_op(gsh_fld(ifldt),u,1,4,0)
157 if (op.eq.'MAX') call fgslib_gs_op(gsh_fld(ifldt),u,1,4,0)
158 if (op.eq.'MXA') call fgslib_gs_op(gsh_fld(ifldt),u,1,4,0)
159c
160 return
161 end
162c-----------------------------------------------------------------------
163 subroutine vec_dssum(u,v,w,nx,ny,nz)
164c
165c Direct stiffness summation of the face data, for field U.
166c
167c Boundary condition data corresponds to component IFIELD of
168c the CBC array.
169c
170 INCLUDE 'SIZE'
171 INCLUDE 'TOPOL'
172 INCLUDE 'INPUT'
173 INCLUDE 'PARALLEL'
174 INCLUDE 'TSTEP'
175 include 'CTIMER'
176
177 REAL U(1),V(1),W(1)
178
179 if(ifsync) call nekgsync()
180
181#ifdef TIMER
182 if (icalld.eq.0) tvdss=0.0d0
183 if (icalld.eq.0) tgsum=0.0d0
184 icalld=icalld+1
185 nvdss=icalld
186 etime1=dnekclock()
187#endif
188
189c
190c============================================================================
191c execution phase
192c============================================================================
193c
194 ifldt = ifield
195c if (ifldt.eq.0) ifldt = 1
196 if (ifldt.eq.ifldmhd) ifldt = 1
197
198 call fgslib_gs_op_many(gsh_fld(ifldt),u,v,w,u,u,u,ldim,1,1,0)
199
200#ifdef TIMER
201 timee=(dnekclock()-etime1)
202 tvdss=tvdss+timee
203 tdsmx=max(timee,tdsmx)
204 tdsmn=min(timee,tdsmn)
205#endif
206
207 return
208 end
209
210c-----------------------------------------------------------------------
211 subroutine vec_dsop(u,v,w,nx,ny,nz,op)
212c
213c Direct stiffness summation of the face data, for field U.
214c
215c Boundary condition data corresponds to component IFIELD of
216c the CBC array.
217c
218 INCLUDE 'SIZE'
219 INCLUDE 'TOPOL'
220 INCLUDE 'INPUT'
221 INCLUDE 'PARALLEL'
222 INCLUDE 'TSTEP'
223 include 'CTIMER'
224c
225 real u(1),v(1),w(1)
226 character*3 op
227
228c============================================================================
229c execution phase
230c============================================================================
231
232 ifldt = ifield
233c if (ifldt.eq.0) ifldt = 1
234 if (ifldt.eq.ifldmhd) ifldt = 1
235
236c write(6,*) 'opdsop: ',op,ifldt,ifield
237 if(ifsync) call nekgsync()
238
239 if (op.eq.'+ ' .or. op.eq.'sum' .or. op.eq.'SUM')
240 $ call fgslib_gs_op_many(gsh_fld(ifldt),u,v,w,u,u,u,ldim,1,1,0)
241
242
243 if (op.eq.'* ' .or. op.eq.'mul' .or. op.eq.'MUL')
244 $ call fgslib_gs_op_many(gsh_fld(ifldt),u,v,w,u,u,u,ldim,1,2,0)
245
246
247 if (op.eq.'m ' .or. op.eq.'min' .or. op.eq.'mna'
248 $ .or. op.eq.'MIN' .or. op.eq.'MNA')
249 $ call fgslib_gs_op_many(gsh_fld(ifldt),u,v,w,u,u,u,ldim,1,3,0)
250
251
252 if (op.eq.'M ' .or. op.eq.'max' .or. op.eq.'mxa'
253 $ .or. op.eq.'MAX' .or. op.eq.'MXA')
254 $ call fgslib_gs_op_many(gsh_fld(ifldt),u,v,w,u,u,u,ldim,1,4,0)
255
256
257 return
258 end
259c-----------------------------------------------------------------------
260 subroutine nvec_dssum(u,stride,n,gs_handle)
261
262c Direct stiffness summation of the array u for n fields
263c
264 include 'SIZE'
265 include 'CTIMER'
266
267 real u(1)
268 integer n,stride,gs_handle
269
270 if(ifsync) call nekgsync()
271
272#ifdef TIMER
273 icalld=icalld+1
274 nvdss=icalld
275 etime1=dnekclock()
276#endif
277 call fgslib_gs_op_fields(gs_handle,u,stride,n,1,1,0)
278
279#ifdef TIMER
280 timee=(dnekclock()-etime1)
281 tvdss=tvdss+timee
282 tdsmx=max(timee,tdsmx)
283 tdsmn=min(timee,tdsmn)
284#endif
285
286 return
287 end
288
289c----------------------------------------------------------------------
290 subroutine matvec3(uout,Jmat,uin,iftrsp,n1,n2)
291c
292 include 'SIZE'
293c
294 real Jmat (n1,n1,2)
295 real uin (1)
296 real uout (1)
297 logical iftrsp
298c
299 common /matvtmp/ utmp(lx1,ly1)
300c
301 if (ldim.eq.2) then
302 call mxm (Jmat(1,1,1),n1,uin,n1,uout,n2)
303 else
304 if (iftrsp) then
305 call transpose(uout,n2,uin,n1)
306 else
307 call copy (uout,uin,n1*n2)
308 endif
309 call mxm (Jmat(1,1,1),n1,uout,n1,utmp,n2)
310 call mxm (utmp,n2,Jmat(1,1,2),n1,uout,n1)
311 endif
312c
313 return
314 end
315c-----------------------------------------------------------------------
316 subroutine matvec3t(uout,Jmat,uin,iftrsp,n1,n2)
317c
318 include 'SIZE'
319c
320 real Jmat (n1,n1,2)
321 real uin (n1,n2)
322 real uout (n1,n2)
323 logical iftrsp
324c
325 common /matvtmp/ utmp(lx1*ly1)
326c
327 call transpose(utmp,n2,uin,n1)
328 call mxm (Jmat(1,1,2),n1,utmp,n1,uout,n2)
329 call mxm (uout,n2,Jmat(1,1,1),n1,utmp,n1)
330 if (iftrsp) then
331 call copy (uout,utmp,n1*n2)
332 else
333 call transpose(uout,n2,utmp,n1)
334 endif
335c
336 return
337 end
338c-----------------------------------------------------------------------
339 subroutine matvect (out,d,vec,n1,n2)
340 dimension d(n1,n2),out(1),vec(1)
341c
342c handle non-square matrix in mat-vec mult -- TRANSPOSE
343c N1 is still the number of rows
344c N2 is still the number of cols
345c
346c
347 call mxm(vec,1,d,n1,out,n2)
348c
349 return
350 end
351c-----------------------------------------------------------------------
352c subroutine opq_in_place(a,b,c)
353c include 'SIZE'
354c real a(1),b(1),c(1)
355c
356c call q_in_place(a)
357c call q_in_place(b)
358c if (ldim .eq.3) call q_in_place(c)
359c
360c return
361c end
362c-----------------------------------------------------------------------
363 subroutine vectof_add(b,a,ie,iface,nx,ny,nz)
364C
365C Copy vector A to the face (IFACE) of B
366C IFACE is the input in the pre-processor ordering scheme.
367C
368 DIMENSION A(NX,NY)
369 DIMENSION B(NX,NY,NZ,1)
370 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
371 k = 0
372 DO 100 IZ=KZ1,KZ2
373 DO 100 IY=KY1,KY2
374 DO 100 IX=KX1,KX2
375 k = k + 1
376 B(IX,IY,IZ,IE) = B(IX,IY,IZ,IE) + A(k,1)
377 100 CONTINUE
378 return
379 END
380c-----------------------------------------------------------------------
381 subroutine zero_f(b,ie,iface,nx,ny,nz)
382C
383C ZERO the face (IFACE) of B
384C IFACE is the input in the pre-processor ordering scheme.
385C
386 DIMENSION B(NX,NY,NZ,1)
387 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
388c
389 DO 100 IZ=KZ1,KZ2
390 DO 100 IY=KY1,KY2
391 DO 100 IX=KX1,KX2
392 B(IX,IY,IZ,IE) = 0.
393 100 CONTINUE
394 return
395 END
396c-----------------------------------------------------------------------
397 subroutine ftovec_0(a,b,ie,iface,nx,ny,nz)
398C
399C Copy the face (IFACE) of B to vector A.
400C IFACE is the input in the pre-processor ordering scheme.
401C
402 DIMENSION A(NX,NY)
403 DIMENSION B(NX,NY,NZ,1)
404 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
405 k = 0
406 DO 100 IZ=KZ1,KZ2
407 DO 100 IY=KY1,KY2
408 DO 100 IX=KX1,KX2
409 k = k + 1
410 A(k,1)=B(IX,IY,IZ,IE)
411 B(IX,IY,IZ,IE)=0.0
412 100 CONTINUE
413 return
414 END
415c-----------------------------------------------------------------------
416 subroutine ftovec(a,b,ie,iface,nx,ny,nz)
417C
418C Copy the face (IFACE) of B to vector A.
419C IFACE is the input in the pre-processor ordering scheme.
420C
421 real A(NX,NY)
422 real B(NX,NY,NZ,1)
423 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
424 k = 0
425 DO 100 IZ=KZ1,KZ2
426 DO 100 IY=KY1,KY2
427 DO 100 IX=KX1,KX2
428 k = k + 1
429 A(k,1)=B(IX,IY,IZ,IE)
430 100 CONTINUE
431 return
432 END
433c-----------------------------------------------------------------------
434 subroutine vectof(b,a,ie,iface,nx,ny,nz)
435C
436C Copy vector A to the face (IFACE) of B
437C IFACE is the input in the pre-processor ordering scheme.
438C
439 real A(NX,NY)
440 real B(NX,NY,NZ,1)
441 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
442 k = 0
443 DO 100 IZ=KZ1,KZ2
444 DO 100 IY=KY1,KY2
445 DO 100 IX=KX1,KX2
446 k = k + 1
447 B(IX,IY,IZ,IE) = A(k,1)
448 100 CONTINUE
449 return
450 END
451c-----------------------------------------------------------------------
452 subroutine ftoveci(a,b,ie,iface,nx,ny,nz)
453C
454C Copy the face (IFACE) of B to vector A.
455C IFACE is the input in the pre-processor ordering scheme.
456C
457 integer A(NX,NY)
458 integer B(NX,NY,NZ,1)
459 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
460 k = 0
461 DO 100 IZ=KZ1,KZ2
462 DO 100 IY=KY1,KY2
463 DO 100 IX=KX1,KX2
464 k = k + 1
465 A(k,1)=B(IX,IY,IZ,IE)
466 100 CONTINUE
467 return
468 END
469c-----------------------------------------------------------------------
470 subroutine vectofi(b,a,ie,iface,nx,ny,nz)
471C
472C Copy vector A to the face (IFACE) of B
473C IFACE is the input in the pre-processor ordering scheme.
474C
475 integer A(NX,NY)
476 integer B(NX,NY,NZ,1)
477 CALL FACIND (KX1,KX2,KY1,KY2,KZ1,KZ2,NX,NY,NZ,IFACE)
478 k = 0
479 DO 100 IZ=KZ1,KZ2
480 DO 100 IY=KY1,KY2
481 DO 100 IX=KX1,KX2
482 k = k + 1
483 B(IX,IY,IZ,IE) = A(k,1)
484 100 CONTINUE
485 return
486 END
487c-----------------------------------------------------------------------
488 subroutine apply_Jt(u,nx,ny,nz,nel)
489 include 'SIZE'
490 include 'CTIMER'
491 include 'INPUT'
492 include 'NONCON'
493 include 'PARALLEL'
494 include 'TSTEP'
495 real u(1)
496c
497 parameter (lface=lx1*ly1)
498 common /nonctmp/ uin(lface,2*ldim),uout(lface)
499c
500c
501c T
502c This is the J part, translating child data
503c
504 do ie = 1 , nel
505c Note, we zero out u() on this face after extracting, for
506c consistency reasons discovered during Jerry's thesis.
507c Thus, "ftovec_0" rather than ftovec(). (iface -- Ed notation)
508 do iface = 1 , 2*ldim
509 im = mortar(iface,ie)
510 if (im.ne.0) then
511 call ftovec_0(uin(1,iface),u,ie,iface,nx,ny,nz)
512 endif
513 enddo
514 do iface=1,2*ldim
515 im = mortar(iface,ie)
516 if (im.ne.0) then
517 if (if3d) then
518 call matvec3t
519 $ (uout,Jmat(1,1,1,im),uin(1,iface),ifJt(im),nx,nx)
520 else
521 call matvect (uout,Jmat(1,1,1,im),uin(1,iface),nx,nx)
522 endif
523 call vectof_add(u,uout,ie,iface,nx,ny,nz)
524 endif
525 enddo
526 enddo
527c
528 return
529 end
530c-----------------------------------------------------------------------
531 subroutine apply_J(u,nx,ny,nz,nel)
532 include 'SIZE'
533 include 'CTIMER'
534 include 'INPUT'
535 include 'NONCON'
536 include 'PARALLEL'
537 include 'TSTEP'
538 real u(1)
539c
540 parameter (lface=lx1*ly1)
541 common /nonctmp/ uin(lface,2*ldim),uout(lface)
542c
543c This is the J part, interpolating parent solution onto child
544c
545c
546 do ie = 1 , nel
547 do iface = 1 , 2*ldim
548 im = mortar(iface,ie)
549 if (im.ne.0) then
550 call ftovec(uin(1,iface),u,ie,iface,nx,ny,nz)
551 endif
552 enddo
553 do iface=1,2*ldim
554 im = mortar(iface,ie)
555 if (im.ne.0) then
556 call matvec3
557 $ (uout,Jmat(1,1,1,im),uin(1,iface),ifJt(im),nx,nz)
558 call vectof (u,uout,ie,iface,nx,ny,nz)
559 endif
560 enddo
561 enddo
562c
563 return
564 end
565c-----------------------------------------------------------------------
566 subroutine h1_proj(u,nx,ny,nz)
567 include 'SIZE'
568 include 'CTIMER'
569 include 'INPUT'
570 include 'NONCON'
571 include 'PARALLEL'
572 include 'TSTEP'
573 real u(1)
574c
575 parameter (lface=lx1*ly1)
576 common /nonctmp/ uin(lface,2*ldim),uout(lface)
577
578 if(ifsync) call nekgsync()
579
580#ifdef TIMER
581 if (icalld.eq.0) then
582 tdsmx=0.
583 tdsmn=0.
584 endif
585 icalld=icalld+1
586 etime1=dnekclock()
587#endif
588c
589 ifldt = ifield
590c if (ifldt.eq.0) ifldt = 1
591 nel = nelv
592 if (ifield.ge.2) nel=nelt
593 ntot = nx*ny*nz*nel
594
595
596c
597c
598c ~ ~T
599c Implement := J Q Q Mu
600c
601c
602c T
603c
604 call col2 (u,umult,ntot)
605c
606c ~ ~T
607c This is the Q Q part
608c
609 call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0)
610c
611c
612c This is the J part, interpolating parent solution onto child
613c
614 call apply_J(u,nx,ny,nz,nel)
615c
616c
617#ifdef TIMER
618 timee=(dnekclock()-etime1)
619 tdsum=tdsum+timee
620 ndsum=icalld
621 tdsmx=max(timee,tdsmx)
622 tdsmn=min(timee,tdsmn)
623#endif
624c
625 return
626 end
627c-----------------------------------------------------------------------
628 subroutine dssum_msk(u,mask,nx,ny,nz)
629 include 'SIZE'
630 include 'CTIMER'
631 include 'INPUT'
632 include 'NONCON'
633 include 'PARALLEL'
634 include 'TSTEP'
635 real u(1),mask(1)
636c
637 parameter (lface=lx1*ly1)
638 common /nonctmp/ uin(lface,2*ldim),uout(lface)
639
640 if(ifsync) call nekgsync()
641
642#ifdef TIMER
643 if (icalld.eq.0) then
644 tdsmx=0.
645 tdsmn=0.
646 endif
647 icalld=icalld+1
648 etime1=dnekclock()
649#endif
650c
651 ifldt = ifield
652c if (ifldt.eq.0) ifldt = 1
653 nel = nelv
654 if (ifield.ge.2) nel=nelt
655 ntot = nx*ny*nz*nel
656
657
658c
659c T ~ ~T T
660c Implement Q M Q := J M Q Q J
661c
662c
663c T
664c This is the J part, translating child data
665c
666 call apply_Jt(u,nx,ny,nz,nel)
667c
668c
669c
670c ~ ~T
671c This is the Q Q part
672c
673 call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0)
674 call col2 (u,mask,ntot)
675c
676c
677c This is the J part, interpolating parent solution onto child
678c
679 call apply_J(u,nx,ny,nz,nel)
680c
681c
682#ifdef TIMER
683 timee=(dnekclock()-etime1)
684 tdsum=tdsum+timee
685 ndsum=icalld
686 tdsmx=max(timee,tdsmx)
687 tdsmn=min(timee,tdsmn)
688#endif
689c
690 return
691 end
692c-----------------------------------------------------------------------
693 subroutine dssum_msk2(u,mask,binv,nx,ny,nz)
694 include 'SIZE'
695 include 'CTIMER'
696 include 'INPUT'
697 include 'NONCON'
698 include 'PARALLEL'
699 include 'TSTEP'
700 real u(1),mask(1),binv(1)
701c
702 parameter (lface=lx1*ly1)
703 common /nonctmp/ uin(lface,2*ldim),uout(lface)
704
705 if(ifsync) call nekgsync()
706
707#ifdef TIMER
708 if (icalld.eq.0) then
709 tdsmx=0.
710 tdsmn=0.
711 endif
712 icalld=icalld+1
713 etime1=dnekclock()
714#endif
715
716c
717 ifldt = ifield
718c if (ifldt.eq.0) ifldt = 1
719 nel = nelv
720 if (ifield.ge.2) nel=nelt
721 ntot = nx*ny*nz*nel
722
723
724c
725c
726c T ~ ~T T
727c Implement Q M Q := J M Q Q J
728c
729c
730c T
731c This is the J part, translating child data
732c
733 call apply_Jt(u,nx,ny,nz,nel)
734c
735c
736c
737c ~ ~T
738c This is the Q Q part
739c
740 call fgslib_gs_op(gsh_fld(ifldt),u,1,1,0)
741 call col3 (u,mask,binv,ntot)
742c
743c
744c This is the J part, interpolating parent solution onto child
745c
746 call apply_J(u,nx,ny,nz,nel)
747c
748c
749#ifdef TIMER
750 timee=(dnekclock()-etime1)
751 tdsum=tdsum+timee
752 ndsum=icalld
753 tdsmx=max(timee,tdsmx)
754 tdsmn=min(timee,tdsmn)
755#endif
756c
757 return
758 end
759c-----------------------------------------------------------------------
760 subroutine gtpp_gs_op(u,op,hndl)
761c
762c gather-scatter operation across global tensor product planes
763c
764 include 'SIZE'
765 include 'TOTAL'
766
767 real u(*)
768 character*3 op
769 integer hndl
770
771 if (op.eq.'+ ' .or. op.eq.'sum' .or. op.eq.'SUM') then
772 call fgslib_gs_op(hndl,u,1,1,0)
773 elseif (op.eq.'* ' .or. op.eq.'mul' .or. op.eq.'MUL') then
774 call fgslib_gs_op(hndl,u,1,2,0)
775 elseif (op.eq.'m ' .or. op.eq.'min' .or. op.eq.'mna'
776 & .or. op.eq.'MIN' .or. op.eq.'MNA') then
777 call fgslib_gs_op(hndl,u,1,3,0)
778 elseif (op.eq.'M ' .or. op.eq.'max' .or. op.eq.'mxa'
779 & .or. op.eq.'MAX' .or. op.eq.'MXA') then
780 call fgslib_gs_op(hndl,u,1,4,0)
781 else
782 call exitti('gtpp_gs_op: invalid operation!$',1)
783 endif
784
785 return
786 end
787c-----------------------------------------------------------------------
788 subroutine gtpp_gs_setup(hndl,nelgx,nelgy,nelgz,idir)
789
790 include 'SIZE'
791 include 'TOTAL'
792
793 integer hndl,nelgx,nelgy,nelgz,idir
794
795 common /nekmpi/ mid,mp,nekcomm,nekgroup,nekreal
796 common /c_is1/ glo_num(lx1,ly1,lz1,lelv)
797 integer e,ex,ey,ez,eg
798 integer*8 glo_num,ex_g
799
800 nelgxyz = nelgx*nelgy*nelgz
801 if (nelgxyz .ne. nelgv)
802 $ call exitti('gtpp_gs_setup: invalid gtp mesh dimensions!$',
803 $ nelgxyz)
804
805 nel = nelv
806 nelgxy = nelgx*nelgy
807 nelgyz = nelgy*nelgz
808 nelgzx = nelgz*nelgx
809
810 if (idir.eq.1) then
811 ! x-direction
812 do e=1,nel
813 eg = lglel(e)
814 call get_exyz(ex,ey,ez,eg,nelgx,nelgyz,1)
815 ex_g = ey
816 do k=1,nz1 ! Enumerate points in the y-z plane
817 do j=1,ny1
818 do i=1,nx1
819 glo_num(i,j,k,e) = j+ny1*(k-1) + ny1*nz1*(ex_g-1)
820 enddo
821 enddo
822 enddo
823 enddo
824 elseif (idir.eq.2) then
825 ! y-direction
826 do e=1,nel
827 eg = lglel(e)
828 call get_exyz(ex,ey,ez,eg,nelgx,nelgy,nelgz)
829 ex_g = (ez-1)*nelgx+ex
830 do k=1,nz1 ! Enumerate points in the x-z plane
831 do j=1,ny1
832 do i=1,nx1
833 glo_num(i,j,k,e) = k+nz1*(i-1) + nx1*nz1*(ex_g-1)
834 enddo
835 enddo
836 enddo
837 enddo
838 elseif (idir.eq.3) then
839 ! z-direction
840 do e=1,nel
841 eg = lglel(e)
842 call get_exyz(ex,ey,ez,eg,nelgxy,1,1)
843 ex_g = ex
844 do k=1,nz1 ! Enumerate points in the x-y plane
845 do j=1,ny1
846 do i=1,nx1
847 glo_num(i,j,k,e) = i+nx1*(j-1) + nx1*ny1*(ex_g-1)
848 enddo
849 enddo
850 enddo
851 enddo
852 endif
853
854 n = nel*nx1*ny1*nz1
855 call fgslib_gs_setup(hndl,glo_num,n,nekcomm,np)
856
857 return
858 end
859c-----------------------------------------------------------------------
860 subroutine gs_setup_ms(hndl,nel,nx,ny,nz)
861
862 include 'SIZE'
863 include 'TOTAL'
864 include 'mpif.h'
865
866 integer hndl
867 integer e,eg
868
869 common /c_is1/ glo_num(lx1*ly1*lz1*lelt)
870 integer*8 glo_num
871
872 do e=1,nel
873 eg = lglel(e)
874 do k=1,nz
875 do j=1,ny
876 do i=1,nx
877 ii = i + nx*(j-1) + nx*ny*(k-1) + nx*ny*nz*(e-1)
878 glo_num(ii) = i + nx*(j-1) + nx*ny*(k-1) +
879 $ nx*ny*nz*(eg-1)
880 enddo
881 enddo
882 enddo
883 enddo
884
885 n = nel*nx*ny*nz
886 call fgslib_gs_setup(hndl,glo_num,n,iglobalcomm,np_global)
887
888 return
889 end
890c-----------------------------------------------------------------------
891 subroutine gs_op_ms(u,op,hndl)
892c
893c gather-scatter operation across sessions
894c
895 include 'SIZE'
896 include 'PARALLEL'
897 include 'INPUT'
898 include 'TSTEP'
899 include 'CTIMER'
900
901 real u(*)
902 character*3 op
903
904 if(ifsync) call nekgsync()
905
906 if (op.eq.'+ ' .or. op.eq.'sum' .or. op.eq.'SUM') then
907 call fgslib_gs_op(hndl,u,1,1,0)
908 else if (op.eq.'* ' .or. op.eq.'mul' .or. op.eq.'MUL') then
909 call fgslib_gs_op(hndl,u,1,2,0)
910 else if (op.eq.'m ' .or. op.eq.'min' .or. op.eq.'mna'
911 & .or. op.eq.'MIN' .or. op.eq.'MNA') then
912 call fgslib_gs_op(hndl,u,1,3,0)
913 else if (op.eq.'M ' .or. op.eq.'max' .or. op.eq.'mxa'
914 & .or. op.eq.'MAX' .or. op.eq.'MXA') then
915 call fgslib_gs_op(hndl,u,1,4,0)
916 else
917 call exitti('gs_op_ms: invalid operation!$',1)
918 endif
919
920 return
921 end
Note: See TracBrowser for help on using the repository browser.