17 character(len=std_len) :: convert_type_elem
25 case(
'tecplot',
'tecplotCC',
'tecline')
27 case(
'tecplotmpi',
'tecplotCCmpi',
'teclinempi')
31 case(
'vtumpi',
'vtuCCmpi')
33 case(
'vtuB',
'vtuBCC',
'vtuBmpi',
'vtuBCCmpi')
35 case(
'vtuB64',
'vtuBCC64',
'vtuBmpi64',
'vtuBCCmpi64')
38 case(
'vtuB23',
'vtuBCC23')
40 case(
'vtuBsym23',
'vtuBCCsym23')
43 case(
'pvtumpi',
'pvtuCCmpi')
45 case(
'pvtuBmpi',
'pvtuBCCmpi')
47 case(
'vtimpi',
'vtiCCmpi')
49 case(
'onegrid',
'onegridmpi')
51 case(
'oneblock',
'oneblockB')
53 case(
'EIvtiCCmpi',
'ESvtiCCmpi',
'SIvtiCCmpi',
'WIvtiCCmpi',
'EIvtuCCmpi',
'ESvtuCCmpi',
'SIvtuCCmpi',
'WIvtuCCmpi')
58 case(
'dat_generic_mpi')
60 case(
'user',
'usermpi')
62 call mpistop(
"usr_special_convert not defined")
67 call mpistop(
"Error in generate_plotfile: Unknown convert_type")
88 integer,
intent(in) :: qunit
90 double precision :: wval1,xval1
91 double precision,
dimension({^D&1:1},1:nw+nwauxio) :: wval
92 double precision,
dimension({^D&1:1},1:ndim) :: xval
93 double precision:: normconv(0:nw+nwauxio)
94 integer :: Morton_no,igrid,ix^D,ig^D,level
95 integer,
pointer :: ig_to_igrid(:^D&,:)
96 integer :: filenr,ncells^D,ncellx^D,jg^D,jig^D
97 integer :: iw,iiw,writenw,iwrite(1:nw+nwauxio),iigrid,idim
98 logical :: fileopen,writeblk(max_blocks)
99 logical :: patchw(ixG^T)
100 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
101 character(len=1024) :: outfilehead
102 character(len=80) :: filename
105 call mpistop(
'please specify level_io>0 for usage with oneblock')
109 call mpistop(
'Set autoconvert=F and convert oneblock data manually')
113 if(
mype==0) print *,
'ONEBLOCK as yet to be parallelized'
114 call mpistop(
'npe>1, oneblock')
118 normconv(0:nw+nwauxio)=one
121 writenw=count(
w_write(1:nw))+nwauxio
129 do iw =nw+1,nw+nwauxio
142 ig_to_igrid(ig^d,
mype)=igrid
143 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
145 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
146 writeblk(igrid)=.true.
152 ncellx^d=ixmhi^d-ixmlo^d+1\
154 igrid=ig_to_igrid(ig^d,
mype)
155 if(writeblk(igrid))
go to 20
161 do ig^d=1,ng^d(level_io)
163 igrid=ig_to_igrid(jig^dd,mype)
164 if(writeblk(igrid)) ncells^d=ncells^d+ncellx^d
168 do iigrid=1,igridstail; igrid=igrids(iigrid)
169 if(.not.writeblk(igrid)) cycle
171 if (nwauxio > 0)
then
172 if (.not.
associated(usr_aux_output))
then
173 call mpistop(
"usr_aux_output not defined")
175 call usr_aux_output(ixg^ll,ixm^ll^ladd1, &
176 ps(igrid)%w,ps(igrid)%x,normconv)
182 do iigrid=1,igridstail; igrid=igrids(iigrid)
183 if (.not.writeblk(igrid)) cycle
185 call phys_to_primitive(ixg^ll,ixg^ll^lsub1,ps(igrid)%w,ps(igrid)%x)
188 ps(igrid)%w(ixg^t,iw_mag(:))=ps(igrid)%w(ixg^t,iw_mag(:))+ps(igrid)%B0(ixg^t,:,0)
192 do iigrid=1,igridstail; igrid=igrids(iigrid)
193 if (.not.writeblk(igrid)) cycle
198 ps(igrid)%w(ixg^t,iw_e)=ps(igrid)%w(ixg^t,iw_e)+0.5d0*sum(ps(igrid)%B0(ixg^t,:,0)**2,dim=ndim+1) &
199 + sum(ps(igrid)%w(ixg^t,iw_mag(:))*ps(igrid)%B0(ixg^t,:,0),dim=ndim+1)
200 ps(igrid)%w(ixg^t,iw_mag(:))=ps(igrid)%w(ixg^t,iw_mag(:))+ps(igrid)%B0(ixg^t,:,0)
205 master_cpu_open :
if (mype == 0)
then
206 inquire(qunit,opened=fileopen)
207 if (.not.fileopen)
then
210 if (autoconvert) filenr=snapshotnext
211 write(filename,
'(a,i4.4,a)') trim(base_filename),filenr,
".blk"
212 select case(convert_type)
214 open(qunit,file=filename,status=
'unknown')
215 write(qunit,*) trim(outfilehead)
216 write(qunit,*) ncells^d
217 write(qunit,*) real(global_time*time_convert_factor)
219 open(qunit,file=filename,form=
'unformatted',status=
'unknown')
220 write(qunit) outfilehead
221 write(qunit) ncells^d
222 write(qunit) real(global_time*time_convert_factor)
225 end if master_cpu_open
228 do ig3=1,ng3(level_io)
229 do ix3=ixmlo3,ixmhi3}
232 do ig2=1,ng2(level_io)
233 do ix2=ixmlo2,ixmhi2}
235 do ig1=1,ng1(level_io)
236 igrid=ig_to_igrid(ig^d,mype)
237 if(.not.writeblk(igrid)) cycle
239 master_write :
if(mype==0)
then
240 select case(convert_type)
242 write(qunit,fmt=
"(100(e14.6))") &
243 ps(igrid)%x(ix^d,1:ndim)*normconv(0),&
244 (ps(igrid)%w(ix^d,iwrite(iw))*normconv(iwrite(iw)),iw=1,writenw)
246 write(qunit) real(ps(igrid)%x(ix^d,1:ndim)*normconv(0)),&
247 (real(ps(igrid)%w(ix^d,iwrite(iw))*normconv(iwrite(iw))),iw=1,writenw)
278 integer,
intent(in) :: qunit
280 double precision :: w_recv(ixG^T,1:nw),x_recv(ixG^T,1:ndim)
281 integer :: itag,Morton_no,igrid,ix^D,iw
284 integer :: igrid_recv,ipe
285 integer,
allocatable :: intstatus(:,:)
287 character(len=80) :: filename
288 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
289 character(len=1024) :: outfilehead
293 if(
mype==0) print *,
'ONEGRID to be used without nwauxio'
294 call mpistop(
'nwauxio>0, onegrid')
298 if(
mype==0.and.nwaux>0) print *,
'warning: ONEGRID used with saveprim, check auxiliaries'
301 master_cpu_open :
if (
mype == 0)
then
303 write(outfilehead,
'(a)')
"#"//
" "//trim(outfilehead)
304 inquire(qunit,opened=fileopen)
305 if (.not.fileopen)
then
309 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".blk"
310 open(qunit,file=filename,status=
'unknown')
312 write(qunit,
"(a)")outfilehead
314 end if master_cpu_open
321 call mpi_send(igrid,1,mpi_integer, 0,itag,
icomm,
ierrmpi)
326 {
do ix^db=ixmlo^db,ixmhi^db\}
328 if( dabs(ps(igrid)%w(ix^d,iw)) < 1.0d-32 ) ps(igrid)%w(ix^d,iw) = zero
330 write(qunit,fmt=
"(100(e14.6))") ps(igrid)%x(ix^d,1:ndim),ps(igrid)%w(ix^d,1:nw)
335 if(mype==0.and.npe>1)
allocate(intstatus(mpi_status_size,1))
337 manycpu :
if (npe>1)
then
339 loop_cpu :
do ipe =1, npe-1
340 loop_morton :
do morton_no=morton_start(ipe),morton_stop(ipe)
342 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
343 call mpi_recv(x_recv,1,type_block_xcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
345 call mpi_recv(w_recv,1,type_block_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
346 {
do ix^db=ixmlo^db,ixmhi^db\}
348 if( dabs(ps(igrid)%w(ix^d,iw)) < smalldouble ) ps(igrid)%w(ix^d,iw) = zero
350 write(qunit,fmt=
"(100(e14.6))") x_recv(ix^d,1:ndim),w_recv(ix^d,1:nw)
358 call mpi_barrier(icomm,ierrmpi)
359 if(mype==0)
deallocate(intstatus)
362 if(mype==0)
close(qunit)
374 integer,
intent(in) :: qunit
376 double precision :: x_TEC(ndim), w_TEC(nw+nwauxio)
377 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
378 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
379 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
380 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
381 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
382 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
383 double precision,
dimension(0:nw+nwauxio) :: normconv
384 integer:: igrid,iigrid,level,igonlevel,iw,idim,ix^D
385 integer:: NumGridsOnLevel(1:nlevelshi)
386 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,ixC^L,ixCC^L
387 integer :: nodes, elems
389 logical :: fileopen,first
390 character(len=80) :: filename
392 character(len=1024) :: tecplothead
393 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
394 character(len=1024) :: outfilehead
397 if(
mype==0) print *,
'tecplot not parallel, use tecplotmpi'
398 call mpistop(
'npe>1, tecplot')
401 if(nw/=count(
w_write(1:nw)))
then
402 if(
mype==0) print *,
'tecplot does not use w_write=F'
403 call mpistop(
'w_write, tecplot')
407 if(
mype==0) print *,
'tecplot with nocartesian'
410 inquire(qunit,opened=fileopen)
411 if(.not.fileopen)
then
415 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".plt"
416 open(qunit,file=filename,status=
'unknown')
421 write(tecplothead,
'(a)')
"VARIABLES = "//trim(outfilehead)
422 write(qunit,
'(a)') tecplothead(1:len_trim(tecplothead))
424 numgridsonlevel(1:nlevelshi)=0
426 numgridsonlevel(level)=0
427 do iigrid=1,igridstail; igrid=igrids(iigrid);
429 numgridsonlevel(level)=numgridsonlevel(level)+1
433 nx^d=ixmhi^d-ixmlo^d+1;
441 nodes=nodes + numgridsonlevel(level)*{nxc^d*}
442 elems=elems + numgridsonlevel(level)*{nx^d*}
445 write(qunit,
"(a,i7,a,1pe12.5,a)") &
446 'ZONE T="all levels", I=',elems, &
450 do iigrid=1,igridstail; igrid=igrids(iigrid);
453 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,ixc^l,ixcc^l,.true.)
454 {
do ix^db=ixccmin^db,ixccmax^db\}
455 x_tec(1:ndim)=xcc_tmp(ix^d,1:ndim)*normconv(0)
456 w_tec(1:nw+nwauxio)=wcc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
457 write(qunit,fmt=
"(100(e24.16))") x_tec, w_tec
463 do level=levmin,levmax
464 nodesonlevel=numgridsonlevel(level)*{nxc^d*}
465 elemsonlevel=numgridsonlevel(level)*{nx^d*}
472 select case(convert_type)
477 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,a)") &
478 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
479 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=POINT, ZONETYPE=', &
480 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
481 do iigrid=1,igridstail; igrid=igrids(iigrid);
482 if (node(plevel_,igrid)/=level) cycle
484 call calc_x(igrid,xc,xcc)
485 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
487 {
do ix^db=ixcmin^db,ixcmax^db\}
488 x_tec(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0)
489 w_tec(1:nw+nwauxio)=wc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
490 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
499 if(ndim+nw+nwauxio>99)
call mpistop(
"adjust format specification in writeout")
500 if(nw+nwauxio==1)
then
503 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,a)") &
504 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
505 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
506 ndim+1,
']=CELLCENTERED), ZONETYPE=', &
507 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
509 if(ndim+nw+nwauxio<10)
then
511 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i1,a,a)") &
512 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
513 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
514 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
515 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
517 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i2,a,a)") &
518 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
519 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
520 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
521 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
526 do iigrid=1,igridstail; igrid=igrids(iigrid);
527 if (node(plevel_,igrid)/=level) cycle
529 call calc_x(igrid,xc,xcc)
530 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
532 write(qunit,fmt=
"(100(e14.6))") xc_tmp(ixc^s,idim)*normconv(0)
536 do iigrid=1,igridstail; igrid=igrids(iigrid);
537 if (node(plevel_,igrid)/=level) cycle
539 call calc_x(igrid,xc,xcc)
540 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
542 write(qunit,fmt=
"(100(e14.6))") wcc_tmp(ixcc^s,iw)*normconv(iw)
546 call mpistop(
'no such tecplot type')
549 do iigrid=1,igridstail; igrid=igrids(iigrid);
550 if (node(plevel_,igrid)/=level) cycle
552 igonlevel=igonlevel+1
568 integer,
intent(in) :: qunit, igrid, igonlevel
570 integer :: nx^D, nxC^D, ix^D
572 nx^d=ixmhi^d-ixmlo^d+1;
579 write(qunit,
'(8(i7,1x))') &
591 write(qunit,
'(4(i7,1x))') &
608 integer,
intent(in):: i1,nx1,ig,igrid
617 integer,
intent(in):: i1,i2,nx1,nx2,ig,igrid
626 integer,
intent(in):: i1,i2,i3,nx1,nx2,nx3,ig,igrid
641 integer,
intent(in) :: qunit
643 double precision :: x_VTK(1:3)
644 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
645 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
646 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
647 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
648 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
649 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
650 double precision,
dimension(0:nw+nwauxio) :: normconv
651 integer:: igrid,iigrid,level,igonlevel,icel,ixC^L,ixCC^L,iw
652 integer:: NumGridsOnLevel(1:nlevelshi)
653 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,nc,np,VTK_type,ix^D
655 character(len=80):: filename
656 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
657 character(len=1024) :: outfilehead
661 if(
mype==0) print *,
'unstructuredvtk not parallel, use vtumpi'
662 call mpistop(
'npe>1, unstructuredvtk')
665 inquire(qunit,opened=fileopen)
666 if(.not.fileopen)
then
670 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
672 open(qunit,file=filename,status=
'unknown')
678 write(qunit,
'(a)')
'<?xml version="1.0"?>'
679 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
680 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
681 write(qunit,
'(a)')
'<UnstructuredGrid>'
682 write(qunit,
'(a)')
'<FieldData>'
683 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
684 'NumberOfTuples="1" format="ascii">'
686 write(qunit,
'(a)')
'</DataArray>'
687 write(qunit,
'(a)')
'</FieldData>'
690 nx^d=ixmhi^d-ixmlo^d+1;
699 do iigrid=1,igridstail; igrid=igrids(iigrid);
704 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
706 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
708 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
713 write(qunit,
'(a,i7,a,i7,a)') &
714 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
715 write(qunit,
'(a)')
'<PointData>'
720 write(qunit,
'(a,a,a)')&
721 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
722 write(qunit,
'(200(1pe14.6))') {(|}wc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
723 write(qunit,
'(a)')
'</DataArray>'
725 write(qunit,
'(a)')
'</PointData>'
726 write(qunit,
'(a)')
'<Points>'
727 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
729 {
do ix^db=ixcmin^db,ixcmax^db \}
731 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
732 write(qunit,
'(3(1pe14.6))') x_vtk
734 write(qunit,
'(a)')
'</DataArray>'
735 write(qunit,
'(a)')
'</Points>'
738 write(qunit,
'(a,i7,a,i7,a)') &
739 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
740 write(qunit,
'(a)')
'<CellData>'
745 write(qunit,
'(a,a,a)')&
746 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
747 write(qunit,
'(200(1pe14.6))') {(|}wcc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
748 write(qunit,
'(a)')
'</DataArray>'
750 write(qunit,
'(a)')
'</CellData>'
751 write(qunit,
'(a)')
'<Points>'
752 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
754 {
do ix^db=ixcmin^db,ixcmax^db \}
756 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
757 write(qunit,
'(3(1pe14.6))') x_vtk
759 write(qunit,
'(a)')
'</DataArray>'
760 write(qunit,
'(a)')
'</Points>'
763 write(qunit,
'(a)')
'<Cells>'
765 write(qunit,
'(a)')
'<DataArray type="Int32" Name="connectivity" format="ascii">'
767 write(qunit,
'(a)')
'</DataArray>'
770 write(qunit,
'(a)')
'<DataArray type="Int32" Name="offsets" format="ascii">'
772 write(qunit,
'(i7)') icel*(2**^nd)
774 write(qunit,
'(a)')
'</DataArray>'
777 write(qunit,
'(a)')
'<DataArray type="Int32" Name="types" format="ascii">'
779 {^ifoned vtk_type=3 \}
780 {^iftwod vtk_type=8 \}
781 {^ifthreed vtk_type=11 \}
783 write(qunit,
'(i2)') vtk_type
785 write(qunit,
'(a)')
'</DataArray>'
787 write(qunit,
'(a)')
'</Cells>'
789 write(qunit,
'(a)')
'</Piece>'
795 write(qunit,
'(a)')
'</UnstructuredGrid>'
796 write(qunit,
'(a)')
'</VTKFile>'
810 integer,
intent(in) :: qunit
812 double precision :: x_VTK(1:3)
813 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
814 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
815 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
816 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
817 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio):: wC_TMP
818 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
819 double precision :: normconv(0:nw+nwauxio)
820 integer,
allocatable :: intstatus(:,:)
822 integer :: itag,ipe,igrid,level,icel,ixC^L,ixCC^L,Morton_no,Morton_length
823 integer :: nx^D,nxC^D,nc,np,VTK_type,ix^D,filenr
825 integer:: length,lengthcc,length_coords,length_conn,length_offsets
827 character(len=80):: filename
828 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
829 character(len=1024) :: outfilehead
830 logical :: fileopen,cell_corner=.false.
831 logical,
allocatable :: Morton_aim(:),Morton_aim_p(:)
846 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
848 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
849 morton_aim_p(morton_no)=.true.
853 call mpi_allreduce(morton_aim_p,morton_aim,morton_length,mpi_logical,mpi_lor,&
856 case(
'vtuB',
'vtuBmpi')
858 case(
'vtuBCC',
'vtuBCCmpi')
863 if(.not. morton_aim(morton_no)) cycle
866 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
880 inquire(qunit,opened=fileopen)
881 if(.not.fileopen)
then
885 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
887 open(qunit,file=filename,status=
'replace')
891 write(qunit,
'(a)')
'<?xml version="1.0"?>'
892 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
893 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
894 write(qunit,
'(a)')
'<UnstructuredGrid>'
895 write(qunit,
'(a)')
'<FieldData>'
896 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
897 'NumberOfTuples="1" format="ascii">'
899 write(qunit,
'(a)')
'</DataArray>'
900 write(qunit,
'(a)')
'</FieldData>'
903 nx^d=ixmhi^d-ixmlo^d+1;
908 lengthcc=nc*size_real
909 length_coords=3*length
910 length_conn=2**^nd*size_int*nc
911 length_offsets=nc*size_int
915 if(.not. morton_aim(morton_no)) cycle
918 write(qunit,
'(a,i7,a,i7,a)') &
919 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
920 write(qunit,
'(a)')
'<PointData>'
925 write(qunit,
'(a,a,a,i16,a)')&
926 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
927 '" format="appended" offset="',offset,
'">'
928 write(qunit,
'(a)')
'</DataArray>'
929 offset=offset+length+size_int
931 write(qunit,
'(a)')
'</PointData>'
932 write(qunit,
'(a)')
'<Points>'
933 write(qunit,
'(a,i16,a)') &
934 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
936 offset=offset+length_coords+size_int
937 write(qunit,
'(a)')
'</Points>'
940 write(qunit,
'(a,i7,a,i7,a)') &
941 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
942 write(qunit,
'(a)')
'<CellData>'
947 write(qunit,
'(a,a,a,i16,a)')&
948 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
949 '" format="appended" offset="',offset,
'">'
950 write(qunit,
'(a)')
'</DataArray>'
951 offset=offset+lengthcc+size_int
953 write(qunit,
'(a)')
'</CellData>'
954 write(qunit,
'(a)')
'<Points>'
955 write(qunit,
'(a,i16,a)') &
956 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
958 offset=offset+length_coords+size_int
959 write(qunit,
'(a)')
'</Points>'
961 write(qunit,
'(a)')
'<Cells>'
963 write(qunit,
'(a,i16,a)')&
964 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
965 offset=offset+length_conn+size_int
967 write(qunit,
'(a,i16,a)') &
968 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
969 offset=offset+length_offsets+size_int
971 write(qunit,
'(a,i16,a)') &
972 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
973 offset=offset+size_int+nc*size_int
974 write(qunit,
'(a)')
'</Cells>'
975 write(qunit,
'(a)')
'</Piece>'
981 if(.not. morton_aim(morton_no)) cycle
984 write(qunit,
'(a,i7,a,i7,a)') &
985 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
986 write(qunit,
'(a)')
'<PointData>'
991 write(qunit,
'(a,a,a,i16,a)')&
992 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
993 '" format="appended" offset="',offset,
'">'
994 write(qunit,
'(a)')
'</DataArray>'
995 offset=offset+length+size_int
997 write(qunit,
'(a)')
'</PointData>'
998 write(qunit,
'(a)')
'<Points>'
999 write(qunit,
'(a,i16,a)') &
1000 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1002 offset=offset+length_coords+size_int
1003 write(qunit,
'(a)')
'</Points>'
1006 write(qunit,
'(a,i7,a,i7,a)') &
1007 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1008 write(qunit,
'(a)')
'<CellData>'
1013 write(qunit,
'(a,a,a,i16,a)')&
1014 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
1015 '" format="appended" offset="',offset,
'">'
1016 write(qunit,
'(a)')
'</DataArray>'
1017 offset=offset+lengthcc+size_int
1019 write(qunit,
'(a)')
'</CellData>'
1020 write(qunit,
'(a)')
'<Points>'
1021 write(qunit,
'(a,i16,a)') &
1022 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1024 offset=offset+length_coords+size_int
1025 write(qunit,
'(a)')
'</Points>'
1027 write(qunit,
'(a)')
'<Cells>'
1029 write(qunit,
'(a,i16,a)')&
1030 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
1031 offset=offset+length_conn+size_int
1033 write(qunit,
'(a,i16,a)') &
1034 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
1035 offset=offset+length_offsets+size_int
1037 write(qunit,
'(a,i16,a)') &
1038 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
1039 offset=offset+size_int+nc*size_int
1040 write(qunit,
'(a)')
'</Cells>'
1041 write(qunit,
'(a)')
'</Piece>'
1046 write(qunit,
'(a)')
'</UnstructuredGrid>'
1047 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
1049 open(qunit,file=filename,access=
'stream',form=
'unformatted',position=
'append')
1051 write(qunit) trim(buf)
1054 if(.not. morton_aim(morton_no)) cycle
1056 call calc_x(igrid,xc,xcc)
1057 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1058 ixc^l,ixcc^l,.true.)
1063 if(cell_corner)
then
1065 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
1067 write(qunit) lengthcc
1068 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
1072 write(qunit) length_coords
1073 {
do ix^db=ixcmin^db,ixcmax^db \}
1075 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1077 write(qunit) real(x_vtk(k))
1081 write(qunit) length_conn
1083 {^ifoned
write(qunit)ix1-1,ix1 \}
1085 write(qunit)(ix2-1)*nxc1+ix1-1, &
1086 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1090 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1091 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1092 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1093 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1094 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1095 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1096 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1097 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1101 write(qunit) length_offsets
1103 write(qunit) icel*(2**^nd)
1106 {^ifoned vtk_type=3 \}
1107 {^iftwod vtk_type=8 \}
1108 {^ifthreed vtk_type=11 \}
1109 write(qunit) size_int*nc
1111 write(qunit) vtk_type
1114 allocate(intstatus(mpi_status_size,1))
1116 ixccmin^d=ixmlo^d; ixccmax^d=ixmhi^d;
1117 ixcmin^d=ixmlo^d-1; ixcmax^d=ixmhi^d;
1119 do morton_no=morton_start(ipe),morton_stop(ipe)
1120 if(.not. morton_aim(morton_no)) cycle
1122 call mpi_recv(xc_tmp,1,type_block_xc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1123 if(cell_corner)
then
1124 call mpi_recv(wc_tmp,1,type_block_wc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1126 call mpi_recv(wcc_tmp,1,type_block_wcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1130 if(.not.w_write(iw)) cycle
1132 if(cell_corner)
then
1134 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
1136 write(qunit) lengthcc
1137 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
1140 write(qunit) length_coords
1141 {
do ix^db=ixcmin^db,ixcmax^db \}
1143 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1145 write(qunit) real(x_vtk(k))
1148 write(qunit) length_conn
1150 {^ifoned
write(qunit)ix1-1,ix1 \}
1152 write(qunit)(ix2-1)*nxc1+ix1-1, &
1153 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1157 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1158 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1159 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1160 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1161 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1162 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1163 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1164 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1167 write(qunit) length_offsets
1169 write(qunit) icel*(2**^nd)
1171 {^ifoned vtk_type=3 \}
1172 {^iftwod vtk_type=8 \}
1173 {^ifthreed vtk_type=11 \}
1174 write(qunit) size_int*nc
1176 write(qunit) vtk_type
1182 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
1183 write(qunit,
'(a)')
'</AppendedData>'
1184 write(qunit,
'(a)')
'</VTKFile>'
1186 deallocate(intstatus)
1189 deallocate(morton_aim,morton_aim_p)
1191 call mpi_barrier(icomm,ierrmpi)
1204 integer,
intent(in) :: qunit
1206 double precision :: x_VTK(1:3)
1207 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
1208 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
1209 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1210 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1211 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio):: wC_TMP
1212 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
1213 double precision :: normconv(0:nw+nwauxio)
1214 integer,
allocatable :: intstatus(:,:)
1216 integer :: itag,ipe,igrid,level,icel,ixC^L,ixCC^L,Morton_no,Morton_length
1217 integer :: nx^D,nxC^D,nc,np,VTK_type,ix^D,filenr
1219 integer:: length,lengthcc,length_coords,length_conn,length_offsets
1221 character(len=80):: filename
1222 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1223 character(len=1024) :: outfilehead
1224 logical :: fileopen,cell_corner=.false.
1225 logical,
allocatable :: Morton_aim(:),Morton_aim_p(:)
1232 morton_aim_p=.false.
1240 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1242 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
1243 morton_aim_p(morton_no)=.true.
1247 call mpi_allreduce(morton_aim_p,morton_aim,morton_length,mpi_logical,mpi_lor,&
1250 case(
'vtuB64',
'vtuBmpi64')
1252 case(
'vtuBCC64',
'vtuBCCmpi64')
1257 if(.not. morton_aim(morton_no)) cycle
1259 call calc_x(igrid,xc,xcc)
1260 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1261 ixc^l,ixcc^l,.true.)
1264 if(cell_corner)
then
1273 inquire(qunit,opened=fileopen)
1274 if(.not.fileopen)
then
1278 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
1280 open(qunit,file=filename,status=
'replace')
1284 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1285 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
1286 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1287 write(qunit,
'(a)')
'<UnstructuredGrid>'
1288 write(qunit,
'(a)')
'<FieldData>'
1289 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1290 'NumberOfTuples="1" format="ascii">'
1292 write(qunit,
'(a)')
'</DataArray>'
1293 write(qunit,
'(a)')
'</FieldData>'
1295 nx^d=ixmhi^d-ixmlo^d+1;
1299 length=np*size_double
1300 lengthcc=nc*size_double
1301 length_coords=3*length
1302 length_conn=2**^nd*size_int*nc
1303 length_offsets=nc*size_int
1306 if(.not. morton_aim(morton_no)) cycle
1307 if(cell_corner)
then
1309 write(qunit,
'(a,i7,a,i7,a)') &
1310 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1311 write(qunit,
'(a)')
'<PointData>'
1316 write(qunit,
'(a,a,a,i16,a)')&
1317 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1318 '" format="appended" offset="',offset,
'">'
1319 write(qunit,
'(a)')
'</DataArray>'
1320 offset=offset+length+size_int
1322 write(qunit,
'(a)')
'</PointData>'
1323 write(qunit,
'(a)')
'<Points>'
1324 write(qunit,
'(a,i16,a)') &
1325 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1327 offset=offset+length_coords+size_int
1328 write(qunit,
'(a)')
'</Points>'
1331 write(qunit,
'(a,i7,a,i7,a)') &
1332 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1333 write(qunit,
'(a)')
'<CellData>'
1338 write(qunit,
'(a,a,a,i16,a)')&
1339 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1340 '" format="appended" offset="',offset,
'">'
1341 write(qunit,
'(a)')
'</DataArray>'
1342 offset=offset+lengthcc+size_int
1344 write(qunit,
'(a)')
'</CellData>'
1345 write(qunit,
'(a)')
'<Points>'
1346 write(qunit,
'(a,i16,a)') &
1347 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1349 offset=offset+length_coords+size_int
1350 write(qunit,
'(a)')
'</Points>'
1352 write(qunit,
'(a)')
'<Cells>'
1354 write(qunit,
'(a,i16,a)')&
1355 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
1356 offset=offset+length_conn+size_int
1358 write(qunit,
'(a,i16,a)') &
1359 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
1360 offset=offset+length_offsets+size_int
1362 write(qunit,
'(a,i16,a)') &
1363 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
1364 offset=offset+size_int+nc*size_int
1365 write(qunit,
'(a)')
'</Cells>'
1366 write(qunit,
'(a)')
'</Piece>'
1372 if(.not. morton_aim(morton_no)) cycle
1373 if(cell_corner)
then
1375 write(qunit,
'(a,i7,a,i7,a)') &
1376 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1377 write(qunit,
'(a)')
'<PointData>'
1382 write(qunit,
'(a,a,a,i16,a)')&
1383 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1384 '" format="appended" offset="',offset,
'">'
1385 write(qunit,
'(a)')
'</DataArray>'
1386 offset=offset+length+size_int
1388 write(qunit,
'(a)')
'</PointData>'
1389 write(qunit,
'(a)')
'<Points>'
1390 write(qunit,
'(a,i16,a)') &
1391 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1393 offset=offset+length_coords+size_int
1394 write(qunit,
'(a)')
'</Points>'
1397 write(qunit,
'(a,i7,a,i7,a)') &
1398 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1399 write(qunit,
'(a)')
'<CellData>'
1404 write(qunit,
'(a,a,a,i16,a)')&
1405 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1406 '" format="appended" offset="',offset,
'">'
1407 write(qunit,
'(a)')
'</DataArray>'
1408 offset=offset+lengthcc+size_int
1410 write(qunit,
'(a)')
'</CellData>'
1411 write(qunit,
'(a)')
'<Points>'
1412 write(qunit,
'(a,i16,a)') &
1413 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1415 offset=offset+length_coords+size_int
1416 write(qunit,
'(a)')
'</Points>'
1418 write(qunit,
'(a)')
'<Cells>'
1420 write(qunit,
'(a,i16,a)')&
1421 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
1422 offset=offset+length_conn+size_int
1424 write(qunit,
'(a,i16,a)') &
1425 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
1426 offset=offset+length_offsets+size_int
1428 write(qunit,
'(a,i16,a)') &
1429 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
1430 offset=offset+size_int+nc*size_int
1431 write(qunit,
'(a)')
'</Cells>'
1432 write(qunit,
'(a)')
'</Piece>'
1436 write(qunit,
'(a)')
'</UnstructuredGrid>'
1437 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
1439 open(qunit,file=filename,access=
'stream',form=
'unformatted',position=
'append')
1441 write(qunit) trim(buf)
1443 if(.not. morton_aim(morton_no)) cycle
1445 call calc_x(igrid,xc,xcc)
1446 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1447 ixc^l,ixcc^l,.true.)
1452 if(cell_corner)
then
1454 write(qunit) {(|}wc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
1456 write(qunit) lengthcc
1457 write(qunit) {(|}wcc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
1460 write(qunit) length_coords
1461 {
do ix^db=ixcmin^db,ixcmax^db \}
1463 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1465 write(qunit) x_vtk(k)
1468 write(qunit) length_conn
1470 {^ifoned
write(qunit)ix1-1,ix1 \}
1472 write(qunit)(ix2-1)*nxc1+ix1-1, &
1473 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1477 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1478 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1479 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1480 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1481 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1482 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1483 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1484 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1487 write(qunit) length_offsets
1489 write(qunit) icel*(2**^nd)
1491 {^ifoned vtk_type=3 \}
1492 {^iftwod vtk_type=8 \}
1493 {^ifthreed vtk_type=11 \}
1494 write(qunit) size_int*nc
1496 write(qunit) vtk_type
1499 allocate(intstatus(mpi_status_size,1))
1501 ixccmin^d=ixmlo^d; ixccmax^d=ixmhi^d;
1502 ixcmin^d=ixmlo^d-1; ixcmax^d=ixmhi^d;
1504 do morton_no=morton_start(ipe),morton_stop(ipe)
1505 if(.not. morton_aim(morton_no)) cycle
1507 call mpi_recv(xc_tmp,1,type_block_xc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1508 if(cell_corner)
then
1509 call mpi_recv(wc_tmp,1,type_block_wc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1511 call mpi_recv(wcc_tmp,1,type_block_wcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1515 if(.not.w_write(iw)) cycle
1517 if(cell_corner)
then
1519 write(qunit) {(|}wc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
1521 write(qunit) lengthcc
1522 write(qunit) {(|}wcc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
1525 write(qunit) length_coords
1526 {
do ix^db=ixcmin^db,ixcmax^db \}
1528 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1530 write(qunit) x_vtk(k)
1533 write(qunit) length_conn
1535 {^ifoned
write(qunit)ix1-1,ix1 \}
1537 write(qunit)(ix2-1)*nxc1+ix1-1, &
1538 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1542 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1543 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1544 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1545 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1546 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1547 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1548 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1549 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1552 write(qunit) length_offsets
1554 write(qunit) icel*(2**^nd)
1556 {^ifoned vtk_type=3 \}
1557 {^iftwod vtk_type=8 \}
1558 {^ifthreed vtk_type=11 \}
1559 write(qunit) size_int*nc
1561 write(qunit) vtk_type
1567 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
1568 write(qunit,
'(a)')
'</AppendedData>'
1569 write(qunit,
'(a)')
'</VTKFile>'
1571 deallocate(intstatus)
1573 deallocate(morton_aim,morton_aim_p)
1575 call mpi_barrier(icomm,ierrmpi)
1585 integer,
intent(in) :: qunit, igrid
1587 integer :: nx^D, nxC^D, ix^D
1589 nx^d=ixmhi^d-ixmlo^d+1;
1592 {^ifoned
write(qunit,
'(2(i7,1x))')ix1-1,ix1 \}
1594 write(qunit,
'(4(i7,1x))')(ix2-1)*nxc1+ix1-1, &
1595 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1598 write(qunit,
'(8(i7,1x))')&
1599 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1600 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1601 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1602 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1603 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1604 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1605 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1606 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1623 integer,
intent(in) :: qunit
1625 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP,xC_TMP_recv
1626 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP,xCC_TMP_recv
1627 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1628 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1629 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP,wC_TMP_recv
1630 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP,wCC_TMP_recv
1631 double precision,
dimension(0:nw+nwauxio) :: normconv
1632 double precision :: origin(1:3), spacing(1:3)
1633 integer :: igrid,iigrid,level,ixC^L,ixCC^L
1634 integer :: NumGridsOnLevel(1:nlevelshi)
1637 integer :: itag,ipe,Morton_no,Morton_length
1638 integer :: ixrvC^L, ixrvCC^L, siz_ind, ind_send(5*^ND), ind_recv(5*^ND)
1639 integer :: wholeExtent(1:6), ig^D
1640 integer,
allocatable :: intstatus(:,:)
1641 logical,
allocatable :: Morton_aim(:),Morton_aim_p(:)
1643 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1644 character(len=1024) :: outfilehead
1645 character(len=80):: filename
1648 if(
levmin/=
levmax)
call mpistop(
'ImageData can only be used when levmin=levmax')
1656 morton_aim_p=.false.
1664 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1666 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
1667 morton_aim_p(morton_no)=.true.
1671 call mpi_allreduce(morton_aim_p,morton_aim,morton_length,mpi_logical,mpi_lor,&
1675 if(.not. morton_aim(morton_no)) cycle
1677 call calc_x(igrid,xc,xcc)
1678 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1679 ixc^l,ixcc^l,.true.)
1681 {^d& ig^d = tree%node%ig^d; }
1683 ind_send=(/ ixc^l,ixcc^l, ig^d /)
1684 call mpi_send(ind_send,siz_ind,mpi_integer, 0,itag,
icomm,
ierrmpi)
1689 inquire(qunit,opened=fileopen)
1690 if(.not.fileopen)
then
1694 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vti"
1696 open(qunit,file=filename,status=
'unknown',form=
'formatted')
1700 nx^d=ixmhi^d-ixmlo^d+1;
1702 {^d& origin(^d) = xprobmin^d*normconv(0); }
1704 {^d&spacing(^d) =
dxlevel(^d)*normconv(0); }
1707 {^d&wholeextent(^d*2-1) = nx^d * ceiling(((xprobmax^d-xprobmin^d)*
writespshift(^d,1)) &
1709 {^d&wholeextent(^d*2) = nx^d * floor(((xprobmax^d-xprobmin^d)*(1.0d0-
writespshift(^d,2))) &
1713 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1714 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="ImageData"'
1715 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1716 write(qunit,
'(a,3(1pe14.6),a,6(i10),a,3(1pe14.6),a)')
' <ImageData Origin="',&
1717 origin,
'" WholeExtent="',wholeextent,
'" Spacing="',spacing,
'">'
1718 write(qunit,
'(a)')
'<FieldData>'
1719 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1720 'NumberOfTuples="1" format="ascii">'
1722 write(qunit,
'(a)')
'</DataArray>'
1723 write(qunit,
'(a)')
'</FieldData>'
1727 if(.not. morton_aim(morton_no)) cycle
1730 {^d& ig^d = tree%node%ig^d; }
1731 call calc_x(igrid,xc,xcc)
1732 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1733 ixc^l,ixcc^l,.true.)
1735 nx^d,normconv,wnamei,wc_tmp,wcc_tmp)
1739 allocate(intstatus(mpi_status_size,1))
1742 if(.not. morton_aim(morton_no)) cycle
1744 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1745 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
1746 ixrvccmin^d=ind_recv(2*^nd+^d);ixrvccmax^d=ind_recv(3*^nd+^d);
1747 ig^d=ind_recv(4*^nd+^d);
1750 call write_vti(qunit,ixg^
ll,ixrvc^l,ixrvcc^l,ig^d,&
1751 nx^d,normconv,wnamei,wc_tmp,wcc_tmp)
1755 write(qunit,
'(a)')
'</ImageData>'
1756 write(qunit,
'(a)')
'</VTKFile>'
1758 if(
npe>1)
deallocate(intstatus)
1761 deallocate(morton_aim,morton_aim_p)
1775 integer,
intent(in) :: qunit
1777 double precision,
dimension(0:nw+nwauxio) :: normconv
1778 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
1779 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
1780 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1781 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1782 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
1783 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
1784 integer :: nx^D,nxC^D,nc,np, igrid,ixC^L,ixCC^L,level,Morton_no
1786 logical :: fileopen,conv_grid
1787 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1788 character(len=1024) :: outfilehead
1789 character(len=80) :: pfilename
1796 inquire(qunit,opened=fileopen)
1797 if(.not.fileopen)
then
1803 open(qunit,file=pfilename,status=
'unknown',form=
'formatted')
1806 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1807 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
1808 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1809 write(qunit,
'(a)')
' <UnstructuredGrid>'
1810 write(qunit,
'(a)')
'<FieldData>'
1811 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1812 'NumberOfTuples="1" format="ascii">'
1814 write(qunit,
'(a)')
'</DataArray>'
1815 write(qunit,
'(a)')
'</FieldData>'
1820 nx^d=ixmhi^d-ixmlo^d+1;
1834 conv_grid=({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1836 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.})
1837 if (.not.conv_grid) cycle
1838 call calc_x(igrid,xc,xcc)
1839 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1840 ixc^l,ixcc^l,.true.)
1841 call write_vtk(qunit,ixg^
ll,ixc^l,ixcc^l,igrid,nc,np,nx^d,nxc^d,&
1842 normconv,wnamei,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp)
1846 write(qunit,
'(a)')
' </UnstructuredGrid>'
1847 write(qunit,
'(a)')
'</VTKFile>'
1867 integer,
intent(in) :: qunit
1869 double precision :: x_VTK(1:3)
1870 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP,xC_TMP_recv
1871 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP,xCC_TMP_recv
1872 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1873 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1874 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP,wC_TMP_recv
1875 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP,wCC_TMP_recv
1876 double precision,
dimension(0:nw+nwauxio) :: normconv
1877 integer:: igrid,iigrid,level,ixC^L,ixCC^L
1878 integer:: NumGridsOnLevel(1:nlevelshi)
1879 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,nc,np,ix^D
1881 integer :: itag,ipe,Morton_no,siz_ind
1882 integer :: ind_send(4*^ND),ind_recv(4*^ND)
1883 integer :: levmin_recv,levmax_recv,level_recv,igrid_recv,ixrvC^L,ixrvCC^L
1884 integer,
allocatable :: intstatus(:,:)
1885 logical :: fileopen,conv_grid,cond_grid_recv
1886 character(len=80):: filename
1887 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1888 character(len=1024) :: outfilehead
1891 inquire(qunit,opened=fileopen)
1892 if(.not.fileopen)
then
1896 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
1898 open(qunit,file=filename,status=
'unknown',form=
'formatted')
1901 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1902 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
1903 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1904 write(qunit,
'(a)')
'<UnstructuredGrid>'
1905 write(qunit,
'(a)')
'<FieldData>'
1906 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1907 'NumberOfTuples="1" format="ascii">'
1909 write(qunit,
'(a)')
'</DataArray>'
1910 write(qunit,
'(a)')
'</FieldData>'
1915 nx^d=ixmhi^d-ixmlo^d+1;
1937 call mpi_send(igrid,1,mpi_integer, 0,itag,
icomm,
ierrmpi)
1944 conv_grid=({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1946 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.})
1948 call mpi_send(conv_grid,1,mpi_logical,0,itag,
icomm,
ierrmpi)
1950 if (.not.conv_grid) cycle
1951 call calc_x(igrid,xc,xcc)
1952 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1953 ixc^l,ixcc^l,.true.)
1956 ind_send=(/ ixc^l,ixcc^l /)
1958 call mpi_send(ind_send,siz_ind,mpi_integer, 0,itag,
icomm,
ierrmpi)
1959 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,
icomm,
ierrmpi)
1966 call write_vtk(qunit,ixg^
ll,ixc^l,ixcc^l,igrid,nc,np,nx^d,nxc^d,&
1967 normconv,wnamei,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp)
1973 allocate(intstatus(mpi_status_size,1))
1977 call mpi_recv(levmin_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1980 call mpi_recv(levmax_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1982 do level=levmin_recv,levmax_recv
1986 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1988 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1989 if (level_recv/=level) cycle
1990 call mpi_recv(cond_grid_recv,1,mpi_logical, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1991 if(.not.cond_grid_recv)cycle
1994 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1995 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
1996 ixrvccmin^d=ind_recv(2*^nd+^d);ixrvccmax^d=ind_recv(3*^nd+^d);
1997 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2004 call write_vtk(qunit,ixg^
ll,ixrvc^l,ixrvcc^l,igrid_recv,&
2005 nc,np,nx^d,nxc^d,normconv,wnamei,&
2006 xc_tmp_recv,xcc_tmp_recv,wc_tmp_recv,wcc_tmp_recv)
2011 write(qunit,
'(a)')
'</UnstructuredGrid>'
2012 write(qunit,
'(a)')
'</VTKFile>'
2017 if(
mype==0)
deallocate(intstatus)
2022 subroutine write_vtk(qunit,ixI^L,ixC^L,ixCC^L,igrid,nc,np,nx^D,nxC^D,&
2023 normconv,wnamei,xC,xCC,wC,wCC)
2026 integer,
intent(in) :: qunit
2027 integer,
intent(in) :: ixI^L,ixC^L,ixCC^L
2028 integer,
intent(in) :: igrid,nc,np,nx^D,nxC^D
2029 double precision,
intent(in) :: normconv(0:nw+nwauxio)
2030 character(len=name_len),
intent(in):: wnamei(1:nw+nwauxio)
2031 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
2032 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
2033 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC
2034 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC
2036 double precision :: x_VTK(1:3)
2037 integer :: iw,ix^D,icel,VTK_type
2040 case(
'vtumpi',
'pvtumpi')
2042 write(qunit,
'(a,i7,a,i7,a)') &
2043 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2044 write(qunit,
'(a)')
'<PointData>'
2049 write(qunit,
'(a,a,a)')&
2050 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2051 write(qunit,
'(200(1pe14.6))') {(|}wc(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
2052 write(qunit,
'(a)')
'</DataArray>'
2054 write(qunit,
'(a)')
'</PointData>'
2055 write(qunit,
'(a)')
'<Points>'
2056 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
2058 {
do ix^db=ixcmin^db,ixcmax^db \}
2060 x_vtk(1:
ndim)=xc(ix^d,1:
ndim)*normconv(0);
2061 write(qunit,
'(3(1pe14.6))') x_vtk
2063 write(qunit,
'(a)')
'</DataArray>'
2064 write(qunit,
'(a)')
'</Points>'
2066 case(
'vtuCCmpi',
'pvtuCCmpi')
2068 write(qunit,
'(a,i7,a,i7,a)') &
2069 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2070 write(qunit,
'(a)')
'<CellData>'
2075 write(qunit,
'(a,a,a)')&
2076 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2077 write(qunit,
'(200(1pe14.6))') {(|}wcc(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
2078 write(qunit,
'(a)')
'</DataArray>'
2080 write(qunit,
'(a)')
'</CellData>'
2081 write(qunit,
'(a)')
'<Points>'
2082 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
2084 {
do ix^db=ixcmin^db,ixcmax^db \}
2086 x_vtk(1:
ndim)=xc(ix^d,1:
ndim)*normconv(0);
2087 write(qunit,
'(3(1pe14.6))') x_vtk
2089 write(qunit,
'(a)')
'</DataArray>'
2090 write(qunit,
'(a)')
'</Points>'
2093 write(qunit,
'(a)')
'<Cells>'
2095 write(qunit,
'(a)')
'<DataArray type="Int32" Name="connectivity" format="ascii">'
2097 write(qunit,
'(a)')
'</DataArray>'
2099 write(qunit,
'(a)')
'<DataArray type="Int32" Name="offsets" format="ascii">'
2101 write(qunit,
'(i7)') icel*(2**^nd)
2103 write(qunit,
'(a)')
'</DataArray>'
2105 write(qunit,
'(a)')
'<DataArray type="Int32" Name="types" format="ascii">'
2107 {^ifoned vtk_type=3 \}
2108 {^iftwod vtk_type=8 \}
2109 {^ifthreed vtk_type=11 \}
2111 write(qunit,
'(i2)') vtk_type
2113 write(qunit,
'(a)')
'</DataArray>'
2114 write(qunit,
'(a)')
'</Cells>'
2115 write(qunit,
'(a)')
'</Piece>'
2120 normconv,wnamei,wC,wCC)
2123 integer,
intent(in) :: qunit
2124 integer,
intent(in) :: ixI^L,ixC^L,ixCC^L
2125 integer,
intent(in) :: ig^D,nx^D
2126 double precision,
intent(in) :: normconv(0:nw+nwauxio)
2127 character(len=name_len),
intent(in):: wnamei(1:nw+nwauxio)
2128 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC
2129 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC
2132 integer :: extent(1:6)
2135 {^d& extent(^d*2-1) = (ig^d-1) * nx^d; }
2136 {^d& extent(^d*2) = (ig^d) * nx^d; }
2139 case(
'vtimpi',
'pvtimpi')
2141 write(qunit,
'(a,6(i10),a)') &
2142 '<Piece Extent="',extent,
'">'
2143 write(qunit,
'(a)')
'<PointData>'
2148 write(qunit,
'(a,a,a)')&
2149 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2150 write(qunit,
'(200(1pe20.12))') {(|}wc(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
2151 write(qunit,
'(a)')
'</DataArray>'
2153 write(qunit,
'(a)')
'</PointData>'
2154 case(
'vtiCCmpi',
'pvtiCCmpi')
2156 write(qunit,
'(a,6(i10),a)') &
2157 '<Piece Extent="',extent,
'">'
2158 write(qunit,
'(a)')
'<CellData>'
2163 write(qunit,
'(a,a,a)')&
2164 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2165 write(qunit,
'(200(1pe20.12))') {(|}wcc(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
2166 write(qunit,
'(a)')
'</DataArray>'
2168 write(qunit,
'(a)')
'</CellData>'
2171 write(qunit,
'(a)')
'</Piece>'
2179 integer,
intent(in) :: qunit
2181 integer :: filenr,iw,ipe,iscalars
2183 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio),outtype
2184 character(len=1024) :: outfilehead
2185 character(len=80) :: filename,pfilename
2188 case(
'pvtumpi',
'pvtuBmpi')
2189 outtype=
"PPointData"
2190 case(
'pvtuCCmpi',
'pvtuBCCmpi')
2193 inquire(qunit,opened=fileopen)
2194 if(.not.fileopen)
then
2198 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".pvtu"
2200 open(qunit,file=filename,status=
'unknown',form=
'formatted')
2210 write(qunit,
'(a)')
'<?xml version="1.0"?>'
2211 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="PUnstructuredGrid"'
2212 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
2213 write(qunit,
'(a)')
' <PUnstructuredGrid GhostLevel="0">'
2215 write(qunit,
'(a,a,a,a,a)')&
2216 ' <',trim(outtype),
' Scalars="',trim(wnamei(iscalars))//
'">'
2219 write(qunit,
'(a,a,a)')&
2220 ' <PDataArray type="Float32" Name="',trim(wnamei(iw)),
'"/>'
2222 do iw=nw+1,nw+nwauxio
2223 write(qunit,
'(a,a,a)')&
2224 ' <PDataArray type="Float32" Name="',trim(wnamei(iw)),
'"/>'
2226 write(qunit,
'(a,a,a)')
' </',trim(outtype),
'>'
2227 write(qunit,
'(a)')
' <PPoints>'
2228 write(qunit,
'(a)')
' <PDataArray type="Float32" NumberOfComponents="3"/>'
2229 write(qunit,
'(a)')
' </PPoints>'
2236 write(qunit,
'(a,a,a)')
' <Piece Source="',trim(pfilename),
'"/>'
2238 write(qunit,
'(a)')
' </PUnstructuredGrid>'
2239 write(qunit,
'(a)')
'</VTKFile>'
2257 integer,
intent(in) :: qunit
2259 double precision :: x_TEC(ndim), w_TEC(nw+nwauxio)
2260 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP,xC_TMP_recv
2261 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP,xCC_TMP_recv
2262 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
2263 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
2264 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP,wC_TMP_recv
2265 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP,wCC_TMP_recv
2266 double precision,
dimension(0:nw+nwauxio) :: normconv
2267 integer:: igrid,iigrid,level,igonlevel,iw,idim,ix^D
2268 integer:: NumGridsOnLevel(1:nlevelshi)
2269 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,ixC^L,ixCC^L
2270 integer :: nodesonlevelmype,elemsonlevelmype
2271 integer :: nodes, elems
2272 integer,
allocatable :: intstatus(:,:)
2273 integer :: itag,Morton_no,ipe,levmin_recv,levmax_recv,igrid_recv,level_recv
2274 integer :: ixrvC^L,ixrvCC^L
2275 integer :: ind_send(2*^ND),ind_recv(2*^ND),siz_ind,igonlevel_recv
2276 integer :: NumGridsOnLevel_mype(1:nlevelshi,0:npe-1)
2278 logical :: fileopen,first
2279 character(len=80) :: filename
2280 character(len=1024) :: tecplothead
2281 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
2282 character(len=1024) :: outfilehead
2284 if(nw/=count(
w_write(1:nw)))
then
2285 if(
mype==0) print *,
'tecplot_mpi does not use w_write=F'
2286 call mpistop(
'w_write, tecplot')
2290 if(
mype==0) print *,
'tecplot_mpi with nocartesian'
2293 master_cpu_open :
if (
mype == 0)
then
2294 inquire(qunit,opened=fileopen)
2295 if (.not.fileopen)
then
2299 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".plt"
2300 open(qunit,file=filename,status=
'unknown')
2303 write(tecplothead,
'(a)')
"VARIABLES = "//trim(outfilehead)
2304 write(qunit,
'(a)') tecplothead(1:len_trim(tecplothead))
2305 end if master_cpu_open
2308 numgridsonlevel(1:nlevelshi)=0
2310 numgridsonlevel(level)=0
2314 numgridsonlevel(level)=numgridsonlevel(level)+1
2316 numgridsonlevel_mype(level,0:npe-1)=0
2317 numgridsonlevel_mype(level,
mype) = numgridsonlevel(level)
2318 call mpi_allreduce(mpi_in_place,numgridsonlevel_mype(level,0:npe-1),npe,mpi_integer,&
2320 call mpi_allreduce(mpi_in_place,numgridsonlevel(level),1,mpi_integer,mpi_sum, &
2324 nx^d=ixmhi^d-ixmlo^d+1;
2327 if(
mype==0.and.npe>1)
allocate(intstatus(mpi_status_size,1))
2334 nodes=nodes + numgridsonlevel(level)*{nxc^d*}
2335 elems=elems + numgridsonlevel(level)*{nx^d*}
2338 if (
mype==0)
write(qunit,
"(a,i7,a,1pe12.5,a)") &
2339 'ZONE T="all levels", I=',elems, &
2345 call calc_x(igrid,xc,xcc)
2346 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,ixc^l,ixcc^l,.true.)
2348 {
do ix^db=ixccmin^db,ixccmax^db\}
2349 x_tec(1:ndim)=xcc_tmp(ix^d,1:ndim)*normconv(0)
2350 w_tec(1:nw+nwauxio)=wcc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2351 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2353 else if (mype/=0)
then
2355 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2356 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision,0,itag,icomm,ierrmpi)
2357 call mpi_send(wcc_tmp,1,type_block_wcc_io, 0,itag,icomm,ierrmpi)
2358 call mpi_send(xcc_tmp,1,type_block_xcc_io, 0,itag,icomm,ierrmpi)
2363 do morton_no=morton_start(ipe),morton_stop(ipe)
2365 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2366 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,&
2367 itag,icomm,intstatus(:,1),ierrmpi)
2368 call mpi_recv(wcc_tmp_recv,1,type_block_wcc_io, ipe,itag,&
2369 icomm,intstatus(:,1),ierrmpi)
2370 call mpi_recv(xcc_tmp_recv,1,type_block_xcc_io, ipe,itag,&
2371 icomm,intstatus(:,1),ierrmpi)
2372 {
do ix^db=ixccmin^db,ixccmax^db\}
2373 x_tec(1:ndim)=xcc_tmp_recv(ix^d,1:ndim)*normconv(0)
2374 w_tec(1:nw+nwauxio)=wcc_tmp_recv(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2375 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2384 itag=1000*morton_stop(mype)
2385 call mpi_send(levmin,1,mpi_integer, 0,itag,icomm,ierrmpi)
2386 itag=2000*morton_stop(mype)
2387 call mpi_send(levmax,1,mpi_integer, 0,itag,icomm,ierrmpi)
2390 do level=levmin,levmax
2391 nodesonlevelmype=numgridsonlevel_mype(level,mype)*{nxc^d*}
2392 elemsonlevelmype=numgridsonlevel_mype(level,mype)*{nx^d*}
2393 nodesonlevel=numgridsonlevel(level)*{nxc^d*}
2394 elemsonlevel=numgridsonlevel(level)*{nx^d*}
2401 select case(convert_type)
2406 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2407 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,a)") &
2408 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2409 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=POINT, ZONETYPE=', &
2410 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2411 do morton_no=morton_start(mype),morton_stop(mype)
2412 igrid = sfc_to_igrid(morton_no)
2415 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2417 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2419 if (node(plevel_,igrid)/=level) cycle
2420 call calc_x(igrid,xc,xcc)
2421 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2422 ixc^l,ixcc^l,.true.)
2425 ind_send=(/ ixc^l /)
2427 call mpi_send(ind_send,siz_ind, mpi_integer, 0,itag,icomm,ierrmpi)
2428 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,icomm,ierrmpi)
2430 call mpi_send(wc_tmp,1,type_block_wc_io, 0,itag,icomm,ierrmpi)
2431 call mpi_send(xc_tmp,1,type_block_xc_io, 0,itag,icomm,ierrmpi)
2433 {
do ix^db=ixcmin^db,ixcmax^db\}
2434 x_tec(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0)
2435 w_tec(1:nw+nwauxio)=wc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2436 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2440 case(
'tecplotCCmpi')
2446 if(ndim+nw+nwauxio>99)
call mpistop(
"adjust format specification in writeout")
2447 if(nw+nwauxio==1)
then
2450 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2451 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,a)") &
2452 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2453 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2454 ndim+1,
']=CELLCENTERED), ZONETYPE=', &
2455 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2457 if(ndim+nw+nwauxio<10)
then
2459 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2460 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i1,a,a)") &
2461 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2462 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2463 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2464 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2466 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2467 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i2,a,a)") &
2468 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2469 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2470 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2471 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2477 do morton_no=morton_start(mype),morton_stop(mype)
2478 igrid = sfc_to_igrid(morton_no)
2481 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2483 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2485 if (node(plevel_,igrid)/=level) cycle
2486 call calc_x(igrid,xc,xcc)
2487 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2490 ind_send=(/ ixc^l /)
2493 call mpi_send(ind_send,siz_ind, mpi_integer, 0,itag,icomm,ierrmpi)
2494 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,icomm,ierrmpi)
2495 call mpi_send(xc_tmp,1,type_block_xc_io, 0,itag,icomm,ierrmpi)
2497 write(qunit,fmt=
"(100(e14.6))") xc_tmp(ixc^s,idim)*normconv(0)
2502 do morton_no=morton_start(mype),morton_stop(mype)
2503 igrid = sfc_to_igrid(morton_no)
2505 itag=morton_no*(ndim+iw)
2506 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2507 itag=igrid*(ndim+iw)
2508 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2510 if (node(plevel_,igrid)/=level) cycle
2511 call calc_x(igrid,xc,xcc)
2512 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2513 ixc^l,ixcc^l,.true.)
2515 ind_send=(/ ixcc^l /)
2517 itag=igrid*(ndim+iw)
2518 call mpi_send(ind_send,siz_ind, mpi_integer, 0,itag,icomm,ierrmpi)
2519 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,icomm,ierrmpi)
2520 call mpi_send(wcc_tmp,1,type_block_wcc_io, 0,itag,icomm,ierrmpi)
2522 write(qunit,fmt=
"(100(e14.6))") wcc_tmp(ixcc^s,iw)*normconv(iw)
2527 call mpistop(
'no such tecplot type')
2531 do morton_no=morton_start(mype),morton_stop(mype)
2532 igrid = sfc_to_igrid(morton_no)
2535 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2537 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2539 if(node(plevel_,igrid)/=level) cycle
2540 igonlevel=igonlevel+1
2543 call mpi_send(igonlevel,1,mpi_integer, 0,itag,icomm,ierrmpi)
2551 if(mype==0 .and.npe>1)
then
2553 itag=1000*morton_stop(ipe)
2554 call mpi_recv(levmin_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2555 itag=2000*morton_stop(ipe)
2556 call mpi_recv(levmax_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2557 do level=levmin_recv,levmax_recv
2558 nodesonlevelmype=numgridsonlevel_mype(level,ipe)*{nxc^d*}
2559 elemsonlevelmype=numgridsonlevel_mype(level,ipe)*{nx^d*}
2560 nodesonlevel=numgridsonlevel(level)*{nxc^d*}
2561 elemsonlevel=numgridsonlevel(level)*{nx^d*}
2562 select case(convert_type)
2567 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2568 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,a)") &
2569 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2570 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=POINT, ZONETYPE=', &
2571 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2572 do morton_no=morton_start(ipe),morton_stop(ipe)
2574 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2576 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2577 if (level_recv/=level) cycle
2580 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,&
2581 icomm,intstatus(:,1),ierrmpi)
2582 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
2583 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2584 ,icomm,intstatus(:,1),ierrmpi)
2585 call mpi_recv(wc_tmp_recv,1,type_block_wc_io, ipe,itag,&
2586 icomm,intstatus(:,1),ierrmpi)
2587 call mpi_recv(xc_tmp_recv,1,type_block_xc_io, ipe,itag,&
2588 icomm,intstatus(:,1),ierrmpi)
2589 {
do ix^db=ixrvcmin^db,ixrvcmax^db\}
2590 x_tec(1:ndim)=xc_tmp_recv(ix^d,1:ndim)*normconv(0)
2591 w_tec(1:nw+nwauxio)=wc_tmp_recv(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2592 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2595 case(
'tecplotCCmpi')
2601 if(ndim+nw+nwauxio>99)
call mpistop(
"adjust format specification in writeout")
2602 if(nw+nwauxio==1)
then
2605 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2606 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,a)") &
2607 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2608 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2609 ndim+1,
']=CELLCENTERED), ZONETYPE=', &
2610 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2612 if(ndim+nw+nwauxio<10)
then
2614 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2615 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i1,a,a)") &
2616 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2617 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2618 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2619 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2621 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2622 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i2,a,a)") &
2623 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2624 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2625 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2626 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2631 do morton_no=morton_start(ipe),morton_stop(ipe)
2633 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2634 itag=igrid_recv*idim
2635 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2636 if (level_recv/=level) cycle
2638 itag=igrid_recv*idim
2639 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2640 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
2641 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2642 ,icomm,intstatus(:,1),ierrmpi)
2643 call mpi_recv(xc_tmp_recv,1,type_block_xc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2644 write(qunit,fmt=
"(100(e14.6))") xc_tmp_recv(ixrvc^s,idim)*normconv(0)
2648 do morton_no=morton_start(ipe),morton_stop(ipe)
2649 itag=morton_no*(ndim+iw)
2650 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2651 itag=igrid_recv*(ndim+iw)
2652 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2653 if (level_recv/=level) cycle
2655 itag=igrid_recv*(ndim+iw)
2656 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2657 ixrvccmin^d=ind_recv(^d);ixrvccmax^d=ind_recv(^nd+^d);
2658 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2659 ,icomm,intstatus(:,1),ierrmpi)
2660 call mpi_recv(wcc_tmp_recv,1,type_block_wcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2661 write(qunit,fmt=
"(100(e14.6))") wcc_tmp_recv(ixrvcc^s,iw)*normconv(iw)
2665 call mpistop(
'no such tecplot type')
2668 do morton_no=morton_start(ipe),morton_stop(ipe)
2670 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2672 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2673 if (level_recv/=level) cycle
2675 call mpi_recv(igonlevel_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2684 call mpi_barrier(icomm,ierrmpi)
2685 if(mype==0)
deallocate(intstatus)
2700 integer,
intent(in) :: qunit
2702 double precision :: x_VTK(1:3)
2703 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
2704 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
2705 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
2706 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
2707 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
2708 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
2709 double precision :: normconv(0:nw+nwauxio)
2711 integer :: igrid,iigrid,level,igonlevel,icel,ixC^L,ixCC^L,Morton_no
2712 integer :: NumGridsOnLevel(1:nlevelshi)
2713 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,nc,np,VTK_type,ix^D
2714 integer:: recsep,k,iw,filenr
2715 integer:: length,lengthcc,offset_points,offset_cells, &
2716 length_coords,length_conn,length_offsets
2719 character(len=6):: bufform
2720 character(len=80) :: pfilename
2721 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
2722 character(len=1024) :: outfilehead
2729 inquire(qunit,opened=fileopen)
2730 if(.not.fileopen)
then
2736 open(qunit,file=pfilename,status=
'unknown',form=
'formatted')
2739 write(qunit,
'(a)')
'<?xml version="1.0"?>'
2740 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
2741 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
2742 write(qunit,
'(a)')
' <UnstructuredGrid>'
2743 write(qunit,
'(a)')
'<FieldData>'
2744 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
2745 'NumberOfTuples="1" format="ascii">'
2747 write(qunit,
'(a)')
'</DataArray>'
2748 write(qunit,
'(a)')
'</FieldData>'
2755 nx^d=ixmhi^d-ixmlo^d+1;
2761 lengthcc=nc*size_real
2763 length_coords=3*length
2764 length_conn=2**^nd*size_int*nc
2765 length_offsets=nc*size_int
2776 if (({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
2778 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
2782 write(qunit,
'(a,i7,a,i7,a)') &
2783 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2784 write(qunit,
'(a)')
'<PointData>'
2788 write(qunit,
'(a,a,a,i16,a)')&
2789 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2790 '" format="appended" offset="',offset,
'">'
2791 write(qunit,
'(a)')
'</DataArray>'
2792 offset=offset+length+size_int
2794 do iw=nw+1,nw+nwauxio
2796 write(qunit,
'(a,a,a,i16,a)')&
2797 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2798 '" format="appended" offset="',offset,
'">'
2799 write(qunit,
'(a)')
'</DataArray>'
2800 offset=offset+length+size_int
2802 write(qunit,
'(a)')
'</PointData>'
2804 write(qunit,
'(a)')
'<Points>'
2805 write(qunit,
'(a,i16,a)') &
2806 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
2808 offset=offset+length_coords+size_int
2809 write(qunit,
'(a)')
'</Points>'
2812 write(qunit,
'(a,i7,a,i7,a)') &
2813 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2814 write(qunit,
'(a)')
'<CellData>'
2818 write(qunit,
'(a,a,a,i16,a)')&
2819 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2820 '" format="appended" offset="',offset,
'">'
2821 write(qunit,
'(a)')
'</DataArray>'
2822 offset=offset+lengthcc+size_int
2824 do iw=nw+1,nw+nwauxio
2826 write(qunit,
'(a,a,a,i16,a)')&
2827 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2828 '" format="appended" offset="',offset,
'">'
2829 write(qunit,
'(a)')
'</DataArray>'
2830 offset=offset+lengthcc+size_int
2832 write(qunit,
'(a)')
'</CellData>'
2833 write(qunit,
'(a)')
'<Points>'
2834 write(qunit,
'(a,i16,a)') &
2835 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
2837 offset=offset+length_coords+size_int
2838 write(qunit,
'(a)')
'</Points>'
2840 write(qunit,
'(a)')
'<Cells>'
2842 write(qunit,
'(a,i16,a)')&
2843 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
2844 offset=offset+length_conn+size_int
2846 write(qunit,
'(a,i16,a)') &
2847 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
2848 offset=offset+length_offsets+size_int
2850 write(qunit,
'(a,i16,a)') &
2851 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
2852 offset=offset+size_int+nc*size_int
2853 write(qunit,
'(a)')
'</Cells>'
2854 write(qunit,
'(a)')
'</Piece>'
2860 write(qunit,
'(a)')
'</UnstructuredGrid>'
2861 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
2868 open(qunit,file=pfilename,access=
'stream',form=
'unformatted',position=
'append')
2870 write(qunit) trim(buf)
2879 if (({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
2881 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
2882 call calc_x(igrid,xc,xcc)
2883 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2884 ixc^l,ixcc^l,.true.)
2890 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
2892 write(qunit) lengthcc
2893 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
2896 do iw=nw+1,nw+nwauxio
2900 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
2902 write(qunit) lengthcc
2903 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
2906 write(qunit) length_coords
2907 {
do ix^db=ixcmin^db,ixcmax^db \}
2909 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
2911 write(qunit) real(x_vtk(k))
2914 write(qunit) length_conn
2916 {^ifoned
write(qunit)ix1-1,ix1 \}
2918 write(qunit)(ix2-1)*nxc1+ix1-1, &
2919 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
2923 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
2924 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
2925 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
2926 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
2927 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
2928 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
2929 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
2930 ix3*nxc2*nxc1+ ix2*nxc1+ix1
2933 write(qunit) length_offsets
2935 write(qunit) icel*(2**^nd)
2937 {^ifoned vtk_type=3 \}
2938 {^iftwod vtk_type=8 \}
2939 {^ifthreed vtk_type=11 \}
2940 write(qunit) size_int*nc
2942 write(qunit) vtk_type
2950 open(qunit,file=pfilename,status=
'unknown',form=
'formatted',position=
'append')
2951 write(qunit,
'(a)')
'</AppendedData>'
2952 write(qunit,
'(a)')
'</VTKFile>'
2965 integer,
intent(in) :: qunit
2967 double precision :: x_VTK(1:3)
2968 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC_TMP
2969 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC_TMP
2970 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC_TMP
2971 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC_TMP
2972 double precision,
dimension(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:nw&
+nwauxio) :: w
2973 double precision :: normconv(0:nw+nwauxio)
2974 double precision :: zlength
2975 double precision ::d3grid,zlengsc,zgridsc
2977 integer:: igrid,iigrid,level,igonlevel,icel,ixCmin1,ixCmin2,&
2978 ixCmin3,ixCmax1,ixCmax2,ixCmax3,ixCCmin1,ixCCmin2,ixCCmin3,ixCCmax1,&
2980 integer:: NumGridsOnLevel(1:nlevelshi)
2981 integer :: nx1,nx2,nx3,nxC1,nxC2,nxC3,nodesonlevel,elemsonlevel,nc,np,&
2982 VTK_type,ix1,ix2,ix3
2983 integer :: size_length,recsep,k,iw
2984 integer :: length,lengthcc,offset_points,offset_cells, length_coords,&
2985 length_conn,length_offsets
2986 integer :: i3grid,n3grid
2989 character(len=6):: bufform
2990 character(len=80):: filename
2991 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:3+nw+nwauxio)
2992 character(len=1024) :: outfilehead
2995 if(
mype==0) print *,
'unstructuredvtkB23 not parallel, use vtumpi'
2996 call mpistop(
'npe>1, unstructuredvtkB23')
3002 inquire(qunit,opened=fileopen)
3003 if(.not.fileopen)
then
3007 open(qunit,file=filename,status=
'replace')
3011 write(qunit,
'(a)')
'<?xml version="1.0"?>'
3012 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
3013 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
3014 write(qunit,
'(a)')
'<UnstructuredGrid>'
3015 write(qunit,
'(a)')
'<FieldData>'
3016 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
3017 'NumberOfTuples="1" format="ascii">'
3019 write(qunit,
'(a)')
'</DataArray>'
3020 write(qunit,
'(a)')
'</FieldData>'
3023 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3024 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3029 lengthcc=nc*size_real
3031 length_coords=3*length
3032 length_conn=2**3*size_int*nc
3033 length_offsets=nc*size_int
3038 zlengsc=2.d0*zgridsc
3039 zlength=zlengsc*(xprobmax1-xprobmin1)
3042 do iigrid=1,igridstail; igrid=igrids(iigrid);
3047 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3050 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3053 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3054 n3grid=nint(zlength/d3grid)
3059 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3060 '" NumberOfCells="',nc,
'">'
3061 write(qunit,
'(a)')
'<PointData>'
3064 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3065 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3066 write(qunit,
'(a)')
'</DataArray>'
3067 offset=offset+length+size_int
3070 do iw=nw+1,nw+nwauxio
3071 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3072 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3073 write(qunit,
'(a)')
'</DataArray>'
3074 offset=offset+length+size_int
3077 write(qunit,
'(a)')
'</PointData>'
3079 write(qunit,
'(a)')
'<Points>'
3080 write(qunit,
'(a,i16,a)') &
3081 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3084 offset=offset+length_coords+size_int
3085 write(qunit,
'(a)')
'</Points>'
3088 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3089 '" NumberOfCells="',nc,
'">'
3090 write(qunit,
'(a)')
'<CellData>'
3093 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3094 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3095 write(qunit,
'(a)')
'</DataArray>'
3096 offset=offset+lengthcc+size_int
3099 do iw=nw+1,nw+nwauxio
3100 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3101 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3102 write(qunit,
'(a)')
'</DataArray>'
3103 offset=offset+lengthcc+size_int
3106 write(qunit,
'(a)')
'</CellData>'
3107 write(qunit,
'(a)')
'<Points>'
3108 write(qunit,
'(a,i16,a)') &
3109 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3112 offset=offset+length_coords+size_int
3113 write(qunit,
'(a)')
'</Points>'
3115 write(qunit,
'(a)')
'<Cells>'
3117 write(qunit,
'(a,i16,a)')&
3118 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',&
3120 offset=offset+length_conn+size_int
3122 write(qunit,
'(a,i16,a)') &
3123 '<DataArray type="Int32" Name="offsets" format="appended" offset="',&
3125 offset=offset+length_offsets+size_int
3127 write(qunit,
'(a,i16,a)') &
3128 '<DataArray type="Int32" Name="types" format="appended" offset="',&
3130 offset=offset+size_length+nc*size_int
3131 write(qunit,
'(a)')
'</Cells>'
3132 write(qunit,
'(a)')
'</Piece>'
3139 write(qunit,
'(a)')
'</UnstructuredGrid>'
3140 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
3142 open(qunit,file=filename,form=
'unformatted',access=
'stream',status=
'old',position=
'append')
3144 write(qunit) trim(buffer)
3148 do iigrid=1,igridstail; igrid=igrids(iigrid);
3153 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3156 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3159 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3160 n3grid=nint(zlength/d3grid)
3165 ixglo1,ixglo2,ixghi1,ixghi2,ps(igrid)%w,ps(igrid)%x)
3169 do ix3=ixglo1,ixghi1
3170 w(ixglo1:ixghi1,ixglo2:ixghi2,ix3,1:nw)=ps(igrid)%w(ixglo1:ixghi1,&
3174 call calc_grid23(qunit,igrid,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
3175 ixcmin1,ixcmin2,ixcmin3,ixcmax1,ixcmax2,ixcmax3,ixccmin1,ixccmin2,&
3176 ixccmin3,ixccmax1,ixccmax2,ixccmax3,.true.,i3grid,d3grid,w,zlength,zgridsc)
3182 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3183 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3185 write(qunit) lengthcc
3186 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3187 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3192 do iw=nw+1,nw+nwauxio
3196 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3197 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3199 write(qunit) lengthcc
3200 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3201 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3206 write(qunit) length_coords
3207 do ix3=ixcmin3,ixcmax3
3208 do ix2=ixcmin2,ixcmax2
3209 do ix1=ixcmin1,ixcmax1
3211 x_vtk(1:3)=xc_tmp(ix1,ix2,ix3,1:3)*normconv(0);
3213 write(qunit) real(x_vtk(k))
3218 write(qunit) length_conn
3223 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3224 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3225 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3226 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3227 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3228 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3229 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3230 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3234 write(qunit) length_offsets
3236 write(qunit) icel*(2**3)
3239 write(qunit) size_int*nc
3241 write(qunit) vtk_type
3250 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
3252 write(qunit,
'(a)')
'</AppendedData>'
3253 write(qunit,
'(a)')
'</VTKFile>'
3267 integer,
intent(in) :: qunit
3269 double precision :: x_VTK(1:3)
3270 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC_TMP
3271 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC_TMP
3272 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC_TMP
3273 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC_TMP
3274 double precision,
dimension(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:nw&
+nwauxio) :: w
3275 double precision :: normconv(0:nw+nwauxio)
3276 double precision ::d3grid,zlengsc,zgridsc
3277 double precision :: zlength
3279 integer:: igrid,iigrid,level,igonlevel,icel,ixCmin1,ixCmin2,&
3280 ixCmin3,ixCmax1,ixCmax2,ixCmax3,ixCCmin1,ixCCmin2,ixCCmin3,ixCCmax1,&
3282 integer:: NumGridsOnLevel(1:nlevelshi)
3283 integer :: nx1,nx2,nx3,nxC1,nxC2,nxC3,nodesonlevel,elemsonlevel,nc,np,&
3284 VTK_type,ix1,ix2,ix3
3285 integer :: size_length,recsep,k,iw
3286 integer :: length,lengthcc,offset_points,offset_cells, length_coords,&
3287 length_conn,length_offsets
3288 integer :: i3grid,n3grid
3290 character(len=80):: filename
3291 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:3+nw+nwauxio)
3292 character(len=1024) :: outfilehead
3294 character(len=6):: bufform
3297 if(
mype==0) print *,
'unstructuredvtkBsym23 not parallel, use vtumpi'
3298 call mpistop(
'npe>1, unstructuredvtkBsym23')
3305 inquire(qunit,opened=fileopen)
3306 if(.not.fileopen)
then
3310 open(qunit,file=filename,status=
'unknown')
3315 write(qunit,
'(a)')
'<?xml version="1.0"?>'
3316 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
3317 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
3318 write(qunit,
'(a)')
'<UnstructuredGrid>'
3319 write(qunit,
'(a)')
'<FieldData>'
3320 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
3321 'NumberOfTuples="1" format="ascii">'
3323 write(qunit,
'(a)')
'</DataArray>'
3324 write(qunit,
'(a)')
'</FieldData>'
3327 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3328 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3333 lengthcc=nc*size_real
3335 length_coords=3*length
3336 length_conn=2**3*size_int*nc
3337 length_offsets=nc*size_int
3343 zlength=zlengsc*(xprobmax1-xprobmin1)
3346 do iigrid=1,igridstail; igrid=igrids(iigrid);
3351 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3354 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3357 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3358 n3grid=nint(zlength/d3grid)
3364 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3365 '" NumberOfCells="',nc,
'">'
3366 write(qunit,
'(a)')
'<PointData>'
3369 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3370 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3371 write(qunit,
'(a)')
'</DataArray>'
3372 offset=offset+length+size_length
3375 do iw=nw+1,nw+nwauxio
3376 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3377 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3378 write(qunit,
'(a)')
'</DataArray>'
3379 offset=offset+length+size_length
3382 write(qunit,
'(a)')
'</PointData>'
3383 write(qunit,
'(a)')
'<Points>'
3384 write(qunit,
'(a,i16,a)') &
3385 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3388 offset=offset+length_coords+size_length
3389 write(qunit,
'(a)')
'</Points>'
3392 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3393 '" NumberOfCells="',nc,
'">'
3394 write(qunit,
'(a)')
'<CellData>'
3397 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3398 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3399 write(qunit,
'(a)')
'</DataArray>'
3400 offset=offset+lengthcc+size_length
3403 do iw=nw+1,nw+nwauxio
3404 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3405 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3406 write(qunit,
'(a)')
'</DataArray>'
3407 offset=offset+lengthcc+size_length
3410 write(qunit,
'(a)')
'</CellData>'
3412 write(qunit,
'(a)')
'<Points>'
3413 write(qunit,
'(a,i16,a)') &
3414 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3417 offset=offset+length_coords+size_length
3418 write(qunit,
'(a)')
'</Points>'
3420 write(qunit,
'(a)')
'<Cells>'
3422 write(qunit,
'(a,i16,a)')&
3423 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',&
3425 offset=offset+length_conn+size_length
3427 write(qunit,
'(a,i16,a)') &
3428 '<DataArray type="Int32" Name="offsets" format="appended" offset="',&
3430 offset=offset+length_offsets+size_length
3432 write(qunit,
'(a,i16,a)') &
3433 '<DataArray type="Int32" Name="types" format="appended" offset="',&
3435 offset=offset+size_length+nc*size_int
3436 write(qunit,
'(a)')
'</Cells>'
3437 write(qunit,
'(a)')
'</Piece>'
3443 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3444 '" NumberOfCells="',nc,
'">'
3445 write(qunit,
'(a)')
'<PointData>'
3448 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3449 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3450 write(qunit,
'(a)')
'</DataArray>'
3451 offset=offset+length+size_length
3454 do iw=nw+1,nw+nwauxio
3455 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3456 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3457 write(qunit,
'(a)')
'</DataArray>'
3458 offset=offset+length+size_length
3461 write(qunit,
'(a)')
'</PointData>'
3462 write(qunit,
'(a)')
'<Points>'
3463 write(qunit,
'(a,i16,a)') &
3464 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3467 offset=offset+length_coords+size_length
3468 write(qunit,
'(a)')
'</Points>'
3471 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3472 '" NumberOfCells="',nc,
'">'
3473 write(qunit,
'(a)')
'<CellData>'
3476 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3477 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3478 write(qunit,
'(a)')
'</DataArray>'
3479 offset=offset+lengthcc+size_length
3482 do iw=nw+1,nw+nwauxio
3483 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3484 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3485 write(qunit,
'(a)')
'</DataArray>'
3486 offset=offset+lengthcc+size_length
3489 write(qunit,
'(a)')
'</CellData>'
3490 write(qunit,
'(a)')
'<Points>'
3491 write(qunit,
'(a,i16,a)') &
3492 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3495 offset=offset+length_coords+size_length
3496 write(qunit,
'(a)')
'</Points>'
3498 write(qunit,
'(a)')
'<Cells>'
3500 write(qunit,
'(a,i16,a)')&
3501 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',&
3503 offset=offset+length_conn+size_length
3505 write(qunit,
'(a,i16,a)') &
3506 '<DataArray type="Int32" Name="offsets" format="appended" offset="',&
3508 offset=offset+length_offsets+size_length
3510 write(qunit,
'(a,i16,a)') &
3511 '<DataArray type="Int32" Name="types" format="appended" offset="',&
3513 offset=offset+size_length+nc*size_int
3514 write(qunit,
'(a)')
'</Cells>'
3515 write(qunit,
'(a)')
'</Piece>'
3523 write(qunit,
'(a)')
'</UnstructuredGrid>'
3524 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
3526 open(qunit,file=filename,form=
'unformatted',access=
'stream',status=
'old',position=
'append')
3528 write(qunit) trim(buffer)
3531 do iigrid=1,igridstail; igrid=igrids(iigrid);
3536 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3539 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3542 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3543 n3grid=nint(zlength/d3grid)
3548 ixglo1,ixglo2,ixghi1,ixghi2,ps(igrid)%w,ps(igrid)%x)
3552 do ix3=ixglo1,ixghi1
3553 w(ixglo1:ixghi1,ixglo2:ixghi2,ix3,1:nw)=ps(igrid)%w(ixglo1:ixghi1,&
3557 call calc_grid23(qunit,igrid,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
3558 ixcmin1,ixcmin2,ixcmin3,ixcmax1,ixcmax2,ixcmax3,ixccmin1,ixccmin2,&
3559 ixccmin3,ixccmax1,ixccmax2,ixccmax3,.true.,i3grid,d3grid,w,zlength,zgridsc)
3566 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3567 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3569 write(qunit) lengthcc
3570 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3571 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3576 do iw=nw+1,nw+nwauxio
3580 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3581 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3583 write(qunit) lengthcc
3584 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3585 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3590 write(qunit) length_coords
3591 do ix3=ixcmin3,ixcmax3
3592 do ix2=ixcmin2,ixcmax2
3593 do ix1=ixcmin1,ixcmax1
3595 x_vtk(1:3)=xc_tmp(ix1,ix2,ix3,1:3)*normconv(0);
3597 write(qunit) real(x_vtk(k))
3602 write(qunit) length_conn
3607 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3608 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3609 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3610 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3611 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3612 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3613 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3614 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3618 write(qunit) length_offsets
3620 write(qunit) icel*(2**3)
3623 write(qunit) size_int*nc
3625 write(qunit) vtk_type
3631 if(iw==2 .or. iw==4 .or. iw==7)
then
3632 wc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,iw)=&
3633 -wc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,iw)
3634 wcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,iw)=&
3635 -wcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,iw)
3640 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3641 =ixcmax1,ixcmin1,-1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3643 write(qunit) lengthcc
3644 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3645 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3650 do iw=nw+1,nw+nwauxio
3654 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3655 =ixcmax1,ixcmin1,-1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3657 write(qunit) lengthcc
3658 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3659 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3664 write(qunit) length_coords
3665 do ix3=ixcmin3,ixcmax3
3666 do ix2=ixcmin2,ixcmax2
3667 do ix1=ixcmax1,ixcmin1,-1
3669 x_vtk(1:3)=xc_tmp(ix1,ix2,ix3,1:3)*normconv(0);
3672 write(qunit) real(x_vtk(k))
3677 write(qunit) length_conn
3682 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3683 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3684 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3685 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3686 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3687 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3688 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3689 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3693 write(qunit) length_offsets
3695 write(qunit) icel*(2**3)
3698 write(qunit) size_int*nc
3700 write(qunit) vtk_type
3709 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
3710 write(qunit,
'(a)')
'</AppendedData>'
3711 write(qunit,
'(a)')
'</VTKFile>'
3716 subroutine calc_grid23(qunit,igrid,xC_TMP,xCC_TMP,wC_TMP,wCC_TMP,normconv,&
3717 ixCmin1,ixCmin2,ixCmin3,ixCmax1,ixCmax2,ixCmax3,ixCCmin1,ixCCmin2,ixCCmin3,&
3718 ixCCmax1,ixCCmax2,ixCCmax3,first,i3grid,d3grid,w,zlength,zgridsc)
3726 integer,
intent(in) :: qunit, igrid,i3grid
3727 logical,
intent(in) :: first
3729 double precision :: dx1,dx2,dx3,d3grid,zlength,zgridsc
3730 double precision :: ldw(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1),&
3731 dwC(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1)
3732 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC
3733 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC
3734 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC
3735 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC
3736 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC_TMP
3737 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC_TMP
3738 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC_TMP
3739 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC_TMP
3740 double precision,
dimension(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:nw&
+nwauxio) :: w
3741 double precision,
dimension(0:nw+nwauxio) :: normconv
3742 integer :: nx1,nx2,nx3, nxC1,nxC2,nxC3, ix1,ix2,ix3, ix, iw, level, idir
3743 integer :: ixCmin1,ixCmin2,ixCmin3,ixCmax1,ixCmax2,ixCmax3,ixCCmin1,&
3744 ixCCmin2,ixCCmin3,ixCCmax1,ixCCmax2,ixCCmax3,nxCC1,nxCC2,nxCC3
3745 integer :: idims,jxCmin1,jxCmin2,jxCmin3,jxCmax1,jxCmax2,jxCmax3
3746 logical,
save :: subfirst=.true.
3749 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3751 dx1=
dx(1,level);dx2=
dx(2,level);dx3=zgridsc*
dx(1,level);
3766 nxcc1=nx1;nxcc2=nx2;nxcc3=nx3;
3767 ixccmin1=ixmlo1;ixccmin2=ixmlo2;ixccmin3=ixmlo1; ixccmax1=ixmhi1
3768 ixccmax2=ixmhi2;ixccmax3=ixmhi1;
3769 do ix=ixccmin1,ixccmax1
3770 xcc(ix,ixccmin2:ixccmax2,ixccmin3:ixccmax3,1)=
rnode(rpxmin1_,igrid)&
3771 +(dble(ix-ixccmin1)+half)*dx1
3773 do ix=ixccmin2,ixccmax2
3774 xcc(ixccmin1:ixccmax1,ix,ixccmin3:ixccmax3,2)=
rnode(rpxmin2_,igrid)&
3775 +(dble(ix-ixccmin2)+half)*dx2
3777 do ix=ixccmin3,ixccmax3
3778 xcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ix,3)=-zlength/two+&
3779 dble(i3grid-1)*d3grid+(dble(ix-ixccmin3)+half)*dx3
3783 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3784 ixcmin1=ixmlo1-1;ixcmin2=ixmlo2-1;ixcmin3=ixmlo1-1; ixcmax1=ixmhi1
3785 ixcmax2=ixmhi2;ixcmax3=ixmhi1;
3786 do ix=ixcmin1,ixcmax1
3787 xc(ix,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1)=
rnode(rpxmin1_,igrid)&
3788 +dble(ix-ixcmin1)*dx1
3790 do ix=ixcmin2,ixcmax2
3791 xc(ixcmin1:ixcmax1,ix,ixcmin3:ixcmax3,2)=
rnode(rpxmin2_,igrid)&
3792 +dble(ix-ixcmin2)*dx2
3794 do ix=ixcmin3,ixcmax3
3795 xc(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ix,3)=-zlength/two+&
3796 dble(i3grid-1)*d3grid+dble(ix-ixcmin3)*dx3
3806 jxcmin1=ixghi1+1-
nghostcells;jxcmin2=ixglo2;jxcmin3=ixglo1;
3807 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixghi1;
3808 do ix1=jxcmin1,jxcmax1
3809 w(ix1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw) = w(jxcmin1&
3810 -1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3812 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixglo1;
3813 jxcmax1=ixglo1-1+
nghostcells;jxcmax2=ixghi2;jxcmax3=ixghi1;
3814 do ix1=jxcmin1,jxcmax1
3815 w(ix1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw) = w(jxcmax1&
3816 +1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3819 jxcmin1=ixglo1;jxcmin2=ixghi2+1-
nghostcells;jxcmin3=ixglo1;
3820 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixghi1;
3821 do ix2=jxcmin2,jxcmax2
3822 w(jxcmin1:jxcmax1,ix2,jxcmin3:jxcmax3,nw-nwextra+1:nw) &
3823 = w(jxcmin1:jxcmax1,jxcmin2-1,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3825 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixglo1;
3826 jxcmax1=ixghi1;jxcmax2=ixglo2-1+
nghostcells;jxcmax3=ixghi1;
3827 do ix2=jxcmin2,jxcmax2
3828 w(jxcmin1:jxcmax1,ix2,jxcmin3:jxcmax3,nw-nwextra+1:nw) &
3829 = w(jxcmin1:jxcmax1,jxcmax2+1,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3832 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixghi1+1-
nghostcells;
3833 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixghi1;
3834 do ix3=jxcmin3,jxcmax3
3835 w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,ix3,nw-nwextra+1:nw) &
3836 = w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,jxcmin3-1,nw-nwextra+1:nw)
3838 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixglo1;
3839 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixglo1-1+
nghostcells;
3840 do ix3=jxcmin3,jxcmax3
3841 w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,ix3,nw-nwextra+1:nw) &
3842 = w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,jxcmax3+1,nw-nwextra+1:nw)
3857 +1,ixglo2+1,ixglo1+1,ixghi1-1,ixghi2-1,ixghi1-1,w,xcc,normconv)
3862 wcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,:)=w(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,:)
3864 do ix3=ixccmin3,ixccmax3
3865 do ix2=ixccmin2,ixccmax2
3866 do ix1=ixccmin1,ixccmax1
3867 wcc(ix1,ix2,ix3,iw_mag(:))=wcc(ix1,ix2,ix3,iw_mag(:))+ps(igrid)%B0(ix1,ix2,&
3874 do ix3=ixccmin3,ixccmax3
3875 do ix2=ixccmin2,ixccmax2
3876 do ix1=ixccmin1,ixccmax1
3877 wcc(ix1,ix2,ix3,iw_e)=w(ix1,ix2,ix3,iw_e) +half*sum(ps(igrid)%B0(ix1,&
3878 ix2,:,0)**2 ) + sum(w(ix1,ix2,ix3,&
3879 iw_mag(:))*ps(igrid)%B0(ix1,ix2,:,0))
3889 if (
b0field.and.iw>iw_mag(1)-1.and.iw<=iw_mag(
ndir))
then
3891 do ix3=ixcmin3,ixcmax3
3892 do ix2=ixcmin2,ixcmax2
3893 do ix1=ixcmin1,ixcmax1
3894 wc(ix1,ix2,ix3,iw)=sum(w(ix1:ix1+1,ix2:ix2+1,ix3,iw) &
3895 +ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3896 ,idir,0))/dble(2**3)+&
3897 sum(w(ix1:ix1+1,ix2:ix2+1,ix3+1,iw) &
3898 +ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3899 ,idir,0))/dble(2**3)
3904 do ix3=ixcmin3,ixcmax3
3905 do ix2=ixcmin2,ixcmax2
3906 do ix1=ixcmin1,ixcmax1
3907 wc(ix1,ix2,ix3,iw)=sum(w(ix1:ix1+1,ix2:ix2+1,ix3:ix3&
3915 do ix3=ixcmin3,ixcmax3
3916 do ix2=ixcmin2,ixcmax2
3917 do ix1=ixcmin1,ixcmax1
3918 wc(ix1,ix2,ix3,iw_e)=sum( w(ix1:ix1+1,ix2:ix2+1,ix3,iw_e) &
3919 +half*sum(ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3920 ,:,0)**2,dim=
ndim+1) + sum( w(ix1:ix1+1,ix2:ix2+1,ix3&
3921 ,iw_mag(:))*ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3922 ,:,0),dim=
ndim+1) ) /dble(2**3)+&
3923 sum( w(ix1:ix1+1,ix2:ix2+1,ix3+1,iw_e) &
3924 +half*sum(ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3925 ,:,0)**2,dim=
ndim+1) + sum( w(ix1:ix1+1,ix2:ix2+1,ix3&
3926 +1,iw_mag(:))*ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3927 ,:,0),dim=
ndim+1) ) /dble(2**3)
3934 xc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:3) &
3935 = xc(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:3)
3936 wc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:nw&
3937 +
nwauxio) = wc(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:nw&
3939 xcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,&
3940 1:3) = xcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,&
3941 ixccmin3:ixccmax3,1:3)
3942 wcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,1:nw&
3943 +
nwauxio) = wcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,&
3952 integer,
intent(in) :: qunit, igrid
3954 integer :: nx1,nx2,nx3, nxC1,nxC2,nxC3, ix1,ix2,ix3
3956 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3957 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3961 write(qunit,
'(8(i7,1x))')&
3962 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3963 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3964 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3965 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3966 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3967 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3968 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3969 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3977 ixImax3,ixOmin1,ixOmin2,ixOmin3,ixOmax1,ixOmax2,ixOmax3,w,x,normconv)
3985 integer,
intent(in) :: ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
3986 ixImax3,ixOmin1,ixOmin2,ixOmin3,ixOmax1,ixOmax2,ixOmax3
3987 double precision,
intent(in) :: x(ixImin1:ixImax1,ixImin2:ixImax2,&
3988 ixImin3:ixImax3,1:3)
3989 double precision :: w(ixImin1:ixImax1,ixImin2:ixImax2,&
3990 ixImin3:ixImax3,nw+nwauxio)
3991 double precision :: normconv(0:nw+nwauxio)
3993 double precision :: qvec(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:ndir),&
3994 curlvec(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:ndir)
4022 Handles computations for coordinates and variables in output.
subroutine calc_grid(qunit, igrid, xC, xCC, xC_TMP, xCC_TMP, wC_TMP, wCC_TMP, normconv, ixCL, ixCCL, first)
Compute both corner as well as cell-centered values for output.
subroutine getheadernames(wnamei, xandwnamei, outfilehead)
get all variables names
subroutine calc_x(igrid, xC, xCC)
computes cell corner (xC) and cell center (xCC) coordinates
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
subroutine unstructuredvtkb64(qunit)
subroutine punstructuredvtk_mpi(qunit)
subroutine tecplot_mpi(qunit)
subroutine oneblock(qunit)
subroutine calc_grid23(qunit, igrid, xC_TMP, xCC_TMP, wC_TMP, wCC_TMP, normconv, ixCmin1, ixCmin2, ixCmin3, ixCmax1, ixCmax2, ixCmax3, ixCCmin1, ixCCmin2, ixCCmin3, ixCCmax1, ixCCmax2, ixCCmax3, first, i3grid, d3grid, w, zlength, zgridsc)
subroutine write_pvtu(qunit)
subroutine imagedatavtk_mpi(qunit)
subroutine save_connvtk(qunit, igrid)
integer function nodenumbertec2d(i1, i2, nx1, nx2, ig, igrid)
subroutine tecplot(qunit)
subroutine generate_plotfile
integer function nodenumbertec1d(i1, nx1, ig, igrid)
subroutine unstructuredvtk(qunit)
subroutine unstructuredvtkb23(qunit)
subroutine unstructuredvtkb(qunit)
integer function nodenumbertec3d(i1, i2, i3, nx1, nx2, nx3, ig, igrid)
subroutine write_vtk(qunit, ixIL, ixCL, ixCCL, igrid, nc, np, nxD, nxCD, normconv, wnamei, xC, xCC, wC, wCC)
subroutine save_conntec(qunit, igrid, igonlevel)
subroutine save_connvtk23(qunit, igrid)
subroutine onegrid(qunit)
subroutine unstructuredvtk_mpi(qunit)
subroutine specialvar_output23(ixImin1, ixImin2, ixImin3, ixImax1, ixImax2, ixImax3, ixOmin1, ixOmin2, ixOmin3, ixOmax1, ixOmax2, ixOmax3, w, x, normconv)
subroutine write_vti(qunit, ixIL, ixCL, ixCCL, igD, nxD, normconv, wnamei, wC, wCC)
subroutine punstructuredvtkb_mpi(qunit)
subroutine unstructuredvtkbsym23(qunit)
Module with basic grid data structures.
integer, dimension(:), allocatable, save sfc_to_igrid
Go from a Morton number to an igrid index (for a single processor)
integer, dimension(:), allocatable, save morton_start
First Morton number per processor.
integer, dimension(:), allocatable, save morton_stop
Last Morton number per processor.
type(tree_node_ptr), dimension(:,:), allocatable, save igrid_to_node
Array to go from an [igrid, ipe] index to a node pointer.
update ghost cells of all blocks including physical boundaries
subroutine getbc(time, qdt, psb, nwstart, nwbc, req_diag)
do update ghost cells of all blocks including physical boundaries
This module contains definitions of global parameters and variables and some generic functions/subrou...
double precision, dimension(:), allocatable w_convert_factor
Conversion factors the primitive variables.
type(state), pointer block
Block pointer for using one block and its previous state.
integer type_block_wcc_io
logical nocartesian
IO switches for conversion.
double precision global_time
The global simulation time.
integer type_block_xc_io
MPI type for IO: cell corner (xc) or cell center (xcc) coordinates.
integer snapshotini
Resume from the snapshot with this index.
logical saveprim
If true, convert from conservative to primitive variables in output.
character(len=std_len) convert_type
Which format to use when converting.
integer, parameter ndim
Number of spatial dimensions for grid variables.
integer, parameter rpxmin
double precision time_convert_factor
Conversion factor for time unit.
integer icomm
The MPI communicator.
integer, dimension(:), allocatable ng
number of grid blocks in domain per dimension, in array over levels
integer type_block_xcc_io
integer mype
The rank of the current MPI task.
integer type_block_io
MPI type for IO: block excluding ghost cells.
integer, parameter plevel_
double precision length_convert_factor
Conversion factor for length unit.
integer ndir
Number of spatial dimensions (components) for vector variables.
integer ixm
the mesh range of a physical block without ghost cells
integer ierrmpi
A global MPI error return code.
logical autoconvert
If true, already convert to output format during the run.
integer type_block_wc_io
MPI type for IO: cell corner (wc) or cell center (wcc) variables.
integer snapshotnext
IO: snapshot and collapsed views output numbers/labels.
integer npe
The number of MPI tasks.
integer nwauxio
Number of auxiliary variables that are only included in output.
logical, dimension(:), allocatable w_write
if true write the w variable in output
logical b0field
split magnetic field as background B0 field
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
logical, dimension(:), allocatable writelevel
double precision, dimension(:,:), allocatable dx
integer nghostcells
Number of ghost cells surrounding a grid.
double precision, dimension(^nd) dxlevel
store unstretched cell size of current level
integer, parameter rpxmax
logical slab_uniform
uniform Cartesian geometry or not (stretched Cartesian)
character(len=std_len) base_filename
Base file name for simulation output, which will be followed by a number.
double precision, dimension(^nd, 2) writespshift
domain percentage cut off shifted from each boundary when converting data
integer, parameter unitconvert
integer, dimension(:,:), allocatable node
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_convert), pointer phys_to_primitive
logical phys_req_diagonal
Whether the physics routines require diagonal ghost cells, for example for computing a curl.
procedure(sub_check_params), pointer phys_te_images
Module with all the methods that users can customize in AMRVAC.
procedure(aux_output), pointer usr_aux_output
procedure(special_convert), pointer usr_special_convert