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 integer :: Morton_no,igrid,ix^D,ig^D,level
91 integer,
pointer :: ig_to_igrid(:^D&,:)
92 logical :: fileopen,writeblk(max_blocks)
93 character(len=80) :: filename
94 integer :: filenr,ncells^D,ncellx^D,jg^D,jig^D
96 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
97 character(len=1024) :: outfilehead
99 double precision :: wval1,xval1
100 double precision,
dimension({^D&1:1},1:nw+nwauxio) :: wval
101 double precision,
dimension({^D&1:1},1:ndim) :: xval
102 double precision:: normconv(0:nw+nwauxio)
104 integer :: iw,iiw,writenw,iwrite(1:nw+nwauxio),iigrid,idim
105 logical :: patchw(ixG^T)
108 call mpistop(
'please specify level_io>0 for usage with oneblock')
112 call mpistop(
'Set autoconvert=F and convert oneblock data manually')
116 if(
mype==0) print *,
'ONEBLOCK as yet to be parallelized'
117 call mpistop(
'npe>1, oneblock')
121 normconv(0:nw+nwauxio)=one
124 writenw=count(
w_write(1:nw))+nwauxio
132 do iw =nw+1,nw+nwauxio
145 ig_to_igrid(ig^d,
mype)=igrid
146 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
148 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
149 writeblk(igrid)=.true.
155 ncellx^d=ixmhi^d-ixmlo^d+1\
157 igrid=ig_to_igrid(ig^d,
mype)
158 if(writeblk(igrid))
go to 20
164 do ig^d=1,ng^d(level_io)
166 igrid=ig_to_igrid(jig^dd,mype)
167 if(writeblk(igrid)) ncells^d=ncells^d+ncellx^d
171 do iigrid=1,igridstail; igrid=igrids(iigrid)
172 if(.not.writeblk(igrid)) cycle
174 if (nwauxio > 0)
then
175 if (.not.
associated(usr_aux_output))
then
176 call mpistop(
"usr_aux_output not defined")
178 call usr_aux_output(ixg^ll,ixm^ll^ladd1, &
179 ps(igrid)%w,ps(igrid)%x,normconv)
185 do iigrid=1,igridstail; igrid=igrids(iigrid)
186 if (.not.writeblk(igrid)) cycle
188 call phys_to_primitive(ixg^ll,ixg^ll^lsub1,ps(igrid)%w,ps(igrid)%x)
191 ps(igrid)%w(ixg^t,iw_mag(:))=ps(igrid)%w(ixg^t,iw_mag(:))+ps(igrid)%B0(ixg^t,:,0)
195 do iigrid=1,igridstail; igrid=igrids(iigrid)
196 if (.not.writeblk(igrid)) cycle
201 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) &
202 + sum(ps(igrid)%w(ixg^t,iw_mag(:))*ps(igrid)%B0(ixg^t,:,0),dim=ndim+1)
203 ps(igrid)%w(ixg^t,iw_mag(:))=ps(igrid)%w(ixg^t,iw_mag(:))+ps(igrid)%B0(ixg^t,:,0)
208 master_cpu_open :
if (mype == 0)
then
209 inquire(qunit,opened=fileopen)
210 if (.not.fileopen)
then
213 if (autoconvert) filenr=snapshotnext
214 write(filename,
'(a,i4.4,a)') trim(base_filename),filenr,
".blk"
215 select case(convert_type)
217 open(qunit,file=filename,status=
'unknown')
218 write(qunit,*) trim(outfilehead)
219 write(qunit,*) ncells^d
220 write(qunit,*) real(global_time*time_convert_factor)
222 open(qunit,file=filename,form=
'unformatted',status=
'unknown')
223 write(qunit) outfilehead
224 write(qunit) ncells^d
225 write(qunit) real(global_time*time_convert_factor)
228 end if master_cpu_open
231 do ig3=1,ng3(level_io)
232 do ix3=ixmlo3,ixmhi3}
235 do ig2=1,ng2(level_io)
236 do ix2=ixmlo2,ixmhi2}
238 do ig1=1,ng1(level_io)
239 igrid=ig_to_igrid(ig^d,mype)
240 if(.not.writeblk(igrid)) cycle
242 master_write :
if(mype==0)
then
243 select case(convert_type)
245 write(qunit,fmt=
"(100(e14.6))") &
246 ps(igrid)%x(ix^d,1:ndim)*normconv(0),&
247 (ps(igrid)%w(ix^d,iwrite(iw))*normconv(iwrite(iw)),iw=1,writenw)
249 write(qunit) real(ps(igrid)%x(ix^d,1:ndim)*normconv(0)),&
250 (real(ps(igrid)%w(ix^d,iwrite(iw))*normconv(iwrite(iw))),iw=1,writenw)
281 integer,
intent(in) :: qunit
283 integer :: itag,Morton_no,igrid,ix^D,iw
285 character(len=80) :: filename
288 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
289 character(len=1024) :: outfilehead
292 integer :: igrid_recv,ipe
293 double precision :: w_recv(ixG^T,1:nw),x_recv(ixG^T,1:ndim)
294 integer,
allocatable :: intstatus(:,:)
297 if(
mype==0) print *,
'ONEGRID to be used without nwauxio'
298 call mpistop(
'nwauxio>0, onegrid')
302 if(
mype==0.and.nwaux>0) print *,
'warning: ONEGRID used with saveprim, check auxiliaries'
305 master_cpu_open :
if (
mype == 0)
then
307 write(outfilehead,
'(a)')
"#"//
" "//trim(outfilehead)
308 inquire(qunit,opened=fileopen)
309 if (.not.fileopen)
then
313 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".blk"
314 open(qunit,file=filename,status=
'unknown')
316 write(qunit,
"(a)")outfilehead
318 end if master_cpu_open
325 call mpi_send(igrid,1,mpi_integer, 0,itag,
icomm,
ierrmpi)
330 {
do ix^db=ixmlo^db,ixmhi^db\}
332 if( dabs(ps(igrid)%w(ix^d,iw)) < 1.0d-32 ) ps(igrid)%w(ix^d,iw) = zero
334 write(qunit,fmt=
"(100(e14.6))") ps(igrid)%x(ix^d,1:ndim),ps(igrid)%w(ix^d,1:nw)
339 if(mype==0.and.npe>1)
allocate(intstatus(mpi_status_size,1))
341 manycpu :
if (npe>1)
then
343 loop_cpu :
do ipe =1, npe-1
344 loop_morton :
do morton_no=morton_start(ipe),morton_stop(ipe)
346 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
347 call mpi_recv(x_recv,1,type_block_xcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
349 call mpi_recv(w_recv,1,type_block_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
350 {
do ix^db=ixmlo^db,ixmhi^db\}
352 if( dabs(ps(igrid)%w(ix^d,iw)) < smalldouble ) ps(igrid)%w(ix^d,iw) = zero
354 write(qunit,fmt=
"(100(e14.6))") x_recv(ix^d,1:ndim),w_recv(ix^d,1:nw)
362 call mpi_barrier(icomm,ierrmpi)
363 if(mype==0)
deallocate(intstatus)
366 if(mype==0)
close(qunit)
378 integer,
intent(in) :: qunit
380 integer:: igrid,iigrid,level,igonlevel,iw,idim,ix^D
381 integer:: NumGridsOnLevel(1:nlevelshi)
382 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,ixC^L,ixCC^L
383 integer :: nodes, elems
384 double precision :: x_TEC(ndim), w_TEC(nw+nwauxio)
385 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
386 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
387 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
388 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
389 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
390 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
391 double precision,
dimension(0:nw+nwauxio) :: normconv
392 logical :: fileopen,first
393 character(len=80) :: filename
396 character(len=1024) :: tecplothead
397 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
398 character(len=1024) :: outfilehead
401 if(
mype==0) print *,
'tecplot not parallel, use tecplotmpi'
402 call mpistop(
'npe>1, tecplot')
405 if(nw/=count(
w_write(1:nw)))
then
406 if(
mype==0) print *,
'tecplot does not use w_write=F'
407 call mpistop(
'w_write, tecplot')
411 if(
mype==0) print *,
'tecplot with nocartesian'
414 inquire(qunit,opened=fileopen)
415 if(.not.fileopen)
then
419 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".plt"
420 open(qunit,file=filename,status=
'unknown')
425 write(tecplothead,
'(a)')
"VARIABLES = "//trim(outfilehead)
426 write(qunit,
'(a)') tecplothead(1:len_trim(tecplothead))
428 numgridsonlevel(1:nlevelshi)=0
430 numgridsonlevel(level)=0
431 do iigrid=1,igridstail; igrid=igrids(iigrid);
433 numgridsonlevel(level)=numgridsonlevel(level)+1
437 nx^d=ixmhi^d-ixmlo^d+1;
445 nodes=nodes + numgridsonlevel(level)*{nxc^d*}
446 elems=elems + numgridsonlevel(level)*{nx^d*}
449 write(qunit,
"(a,i7,a,1pe12.5,a)") &
450 'ZONE T="all levels", I=',elems, &
454 do iigrid=1,igridstail; igrid=igrids(iigrid);
457 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,ixc^l,ixcc^l,.true.)
458 {
do ix^db=ixccmin^db,ixccmax^db\}
459 x_tec(1:ndim)=xcc_tmp(ix^d,1:ndim)*normconv(0)
460 w_tec(1:nw+nwauxio)=wcc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
461 write(qunit,fmt=
"(100(e24.16))") x_tec, w_tec
467 do level=levmin,levmax
468 nodesonlevel=numgridsonlevel(level)*{nxc^d*}
469 elemsonlevel=numgridsonlevel(level)*{nx^d*}
476 select case(convert_type)
481 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,a)") &
482 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
483 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=POINT, ZONETYPE=', &
484 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
485 do iigrid=1,igridstail; igrid=igrids(iigrid);
486 if (node(plevel_,igrid)/=level) cycle
488 call calc_x(igrid,xc,xcc)
489 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
491 {
do ix^db=ixcmin^db,ixcmax^db\}
492 x_tec(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0)
493 w_tec(1:nw+nwauxio)=wc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
494 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
503 if(ndim+nw+nwauxio>99)
call mpistop(
"adjust format specification in writeout")
504 if(nw+nwauxio==1)
then
507 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,a)") &
508 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
509 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
510 ndim+1,
']=CELLCENTERED), ZONETYPE=', &
511 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
513 if(ndim+nw+nwauxio<10)
then
515 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i1,a,a)") &
516 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
517 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
518 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
519 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
521 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i2,a,a)") &
522 'ZONE T="',level,
'"',
', N=',nodesonlevel,
', E=',elemsonlevel, &
523 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
524 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
525 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
530 do iigrid=1,igridstail; igrid=igrids(iigrid);
531 if (node(plevel_,igrid)/=level) cycle
533 call calc_x(igrid,xc,xcc)
534 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
536 write(qunit,fmt=
"(100(e14.6))") xc_tmp(ixc^s,idim)*normconv(0)
540 do iigrid=1,igridstail; igrid=igrids(iigrid);
541 if (node(plevel_,igrid)/=level) cycle
543 call calc_x(igrid,xc,xcc)
544 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
546 write(qunit,fmt=
"(100(e14.6))") wcc_tmp(ixcc^s,iw)*normconv(iw)
550 call mpistop(
'no such tecplot type')
553 do iigrid=1,igridstail; igrid=igrids(iigrid);
554 if (node(plevel_,igrid)/=level) cycle
556 igonlevel=igonlevel+1
572 integer,
intent(in) :: qunit, igrid, igonlevel
574 integer :: nx^D, nxC^D, ix^D
576 nx^d=ixmhi^d-ixmlo^d+1;
583 write(qunit,
'(8(i7,1x))') &
595 write(qunit,
'(4(i7,1x))') &
612 integer,
intent(in):: i1,nx1,ig,igrid
621 integer,
intent(in):: i1,i2,nx1,nx2,ig,igrid
630 integer,
intent(in):: i1,i2,i3,nx1,nx2,nx3,ig,igrid
645 integer,
intent(in) :: qunit
647 double precision :: x_VTK(1:3)
648 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
649 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
650 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
651 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
652 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
653 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
654 double precision,
dimension(0:nw+nwauxio) :: normconv
655 integer:: igrid,iigrid,level,igonlevel,icel,ixC^L,ixCC^L,iw
656 integer:: NumGridsOnLevel(1:nlevelshi)
657 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,nc,np,VTK_type,ix^D
658 character(len=80):: filename
660 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
661 character(len=1024) :: outfilehead
665 if(
mype==0) print *,
'unstructuredvtk not parallel, use vtumpi'
666 call mpistop(
'npe>1, unstructuredvtk')
669 inquire(qunit,opened=fileopen)
670 if(.not.fileopen)
then
674 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
676 open(qunit,file=filename,status=
'unknown')
682 write(qunit,
'(a)')
'<?xml version="1.0"?>'
683 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
684 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
685 write(qunit,
'(a)')
'<UnstructuredGrid>'
686 write(qunit,
'(a)')
'<FieldData>'
687 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
688 'NumberOfTuples="1" format="ascii">'
690 write(qunit,
'(a)')
'</DataArray>'
691 write(qunit,
'(a)')
'</FieldData>'
694 nx^d=ixmhi^d-ixmlo^d+1;
703 do iigrid=1,igridstail; igrid=igrids(iigrid);
708 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
710 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
712 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
717 write(qunit,
'(a,i7,a,i7,a)') &
718 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
719 write(qunit,
'(a)')
'<PointData>'
724 write(qunit,
'(a,a,a)')&
725 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
726 write(qunit,
'(200(1pe14.6))') {(|}wc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
727 write(qunit,
'(a)')
'</DataArray>'
729 write(qunit,
'(a)')
'</PointData>'
730 write(qunit,
'(a)')
'<Points>'
731 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
733 {
do ix^db=ixcmin^db,ixcmax^db \}
735 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
736 write(qunit,
'(3(1pe14.6))') x_vtk
738 write(qunit,
'(a)')
'</DataArray>'
739 write(qunit,
'(a)')
'</Points>'
742 write(qunit,
'(a,i7,a,i7,a)') &
743 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
744 write(qunit,
'(a)')
'<CellData>'
749 write(qunit,
'(a,a,a)')&
750 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
751 write(qunit,
'(200(1pe14.6))') {(|}wcc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
752 write(qunit,
'(a)')
'</DataArray>'
754 write(qunit,
'(a)')
'</CellData>'
755 write(qunit,
'(a)')
'<Points>'
756 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
758 {
do ix^db=ixcmin^db,ixcmax^db \}
760 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
761 write(qunit,
'(3(1pe14.6))') x_vtk
763 write(qunit,
'(a)')
'</DataArray>'
764 write(qunit,
'(a)')
'</Points>'
767 write(qunit,
'(a)')
'<Cells>'
769 write(qunit,
'(a)')
'<DataArray type="Int32" Name="connectivity" format="ascii">'
771 write(qunit,
'(a)')
'</DataArray>'
774 write(qunit,
'(a)')
'<DataArray type="Int32" Name="offsets" format="ascii">'
776 write(qunit,
'(i7)') icel*(2**^nd)
778 write(qunit,
'(a)')
'</DataArray>'
781 write(qunit,
'(a)')
'<DataArray type="Int32" Name="types" format="ascii">'
783 {^ifoned vtk_type=3 \}
784 {^iftwod vtk_type=8 \}
785 {^ifthreed vtk_type=11 \}
787 write(qunit,
'(i2)') vtk_type
789 write(qunit,
'(a)')
'</DataArray>'
791 write(qunit,
'(a)')
'</Cells>'
793 write(qunit,
'(a)')
'</Piece>'
799 write(qunit,
'(a)')
'</UnstructuredGrid>'
800 write(qunit,
'(a)')
'</VTKFile>'
814 integer,
intent(in) :: qunit
816 double precision :: x_VTK(1:3)
817 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
818 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
819 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
820 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
821 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio):: wC_TMP
822 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
823 double precision :: normconv(0:nw+nwauxio)
824 integer,
allocatable :: intstatus(:,:)
825 integer :: itag,ipe,igrid,level,icel,ixC^L,ixCC^L,Morton_no,Morton_length
826 integer :: nx^D,nxC^D,nc,np,VTK_type,ix^D,filenr
829 integer:: length,lengthcc,length_coords,length_conn,length_offsets
831 character(len=80):: filename
832 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
833 character(len=1024) :: outfilehead
834 logical :: fileopen,cell_corner=.false.
835 logical,
allocatable :: Morton_aim(:),Morton_aim_p(:)
850 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
852 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
853 morton_aim_p(morton_no)=.true.
857 call mpi_allreduce(morton_aim_p,morton_aim,morton_length,mpi_logical,mpi_lor,&
860 case(
'vtuB',
'vtuBmpi')
862 case(
'vtuBCC',
'vtuBCCmpi')
867 if(.not. morton_aim(morton_no)) cycle
870 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
884 inquire(qunit,opened=fileopen)
885 if(.not.fileopen)
then
889 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
891 open(qunit,file=filename,status=
'replace')
895 write(qunit,
'(a)')
'<?xml version="1.0"?>'
896 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
897 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
898 write(qunit,
'(a)')
'<UnstructuredGrid>'
899 write(qunit,
'(a)')
'<FieldData>'
900 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
901 'NumberOfTuples="1" format="ascii">'
903 write(qunit,
'(a)')
'</DataArray>'
904 write(qunit,
'(a)')
'</FieldData>'
907 nx^d=ixmhi^d-ixmlo^d+1;
912 lengthcc=nc*size_real
913 length_coords=3*length
914 length_conn=2**^nd*size_int*nc
915 length_offsets=nc*size_int
919 if(.not. morton_aim(morton_no)) cycle
922 write(qunit,
'(a,i7,a,i7,a)') &
923 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
924 write(qunit,
'(a)')
'<PointData>'
929 write(qunit,
'(a,a,a,i16,a)')&
930 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
931 '" format="appended" offset="',offset,
'">'
932 write(qunit,
'(a)')
'</DataArray>'
933 offset=offset+length+size_int
935 write(qunit,
'(a)')
'</PointData>'
936 write(qunit,
'(a)')
'<Points>'
937 write(qunit,
'(a,i16,a)') &
938 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
940 offset=offset+length_coords+size_int
941 write(qunit,
'(a)')
'</Points>'
944 write(qunit,
'(a,i7,a,i7,a)') &
945 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
946 write(qunit,
'(a)')
'<CellData>'
951 write(qunit,
'(a,a,a,i16,a)')&
952 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
953 '" format="appended" offset="',offset,
'">'
954 write(qunit,
'(a)')
'</DataArray>'
955 offset=offset+lengthcc+size_int
957 write(qunit,
'(a)')
'</CellData>'
958 write(qunit,
'(a)')
'<Points>'
959 write(qunit,
'(a,i16,a)') &
960 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
962 offset=offset+length_coords+size_int
963 write(qunit,
'(a)')
'</Points>'
965 write(qunit,
'(a)')
'<Cells>'
967 write(qunit,
'(a,i16,a)')&
968 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
969 offset=offset+length_conn+size_int
971 write(qunit,
'(a,i16,a)') &
972 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
973 offset=offset+length_offsets+size_int
975 write(qunit,
'(a,i16,a)') &
976 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
977 offset=offset+size_int+nc*size_int
978 write(qunit,
'(a)')
'</Cells>'
979 write(qunit,
'(a)')
'</Piece>'
985 if(.not. morton_aim(morton_no)) cycle
988 write(qunit,
'(a,i7,a,i7,a)') &
989 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
990 write(qunit,
'(a)')
'<PointData>'
995 write(qunit,
'(a,a,a,i16,a)')&
996 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
997 '" format="appended" offset="',offset,
'">'
998 write(qunit,
'(a)')
'</DataArray>'
999 offset=offset+length+size_int
1001 write(qunit,
'(a)')
'</PointData>'
1002 write(qunit,
'(a)')
'<Points>'
1003 write(qunit,
'(a,i16,a)') &
1004 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1006 offset=offset+length_coords+size_int
1007 write(qunit,
'(a)')
'</Points>'
1010 write(qunit,
'(a,i7,a,i7,a)') &
1011 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1012 write(qunit,
'(a)')
'<CellData>'
1017 write(qunit,
'(a,a,a,i16,a)')&
1018 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
1019 '" format="appended" offset="',offset,
'">'
1020 write(qunit,
'(a)')
'</DataArray>'
1021 offset=offset+lengthcc+size_int
1023 write(qunit,
'(a)')
'</CellData>'
1024 write(qunit,
'(a)')
'<Points>'
1025 write(qunit,
'(a,i16,a)') &
1026 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1028 offset=offset+length_coords+size_int
1029 write(qunit,
'(a)')
'</Points>'
1031 write(qunit,
'(a)')
'<Cells>'
1033 write(qunit,
'(a,i16,a)')&
1034 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
1035 offset=offset+length_conn+size_int
1037 write(qunit,
'(a,i16,a)') &
1038 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
1039 offset=offset+length_offsets+size_int
1041 write(qunit,
'(a,i16,a)') &
1042 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
1043 offset=offset+size_int+nc*size_int
1044 write(qunit,
'(a)')
'</Cells>'
1045 write(qunit,
'(a)')
'</Piece>'
1050 write(qunit,
'(a)')
'</UnstructuredGrid>'
1051 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
1053 open(qunit,file=filename,access=
'stream',form=
'unformatted',position=
'append')
1055 write(qunit) trim(buf)
1058 if(.not. morton_aim(morton_no)) cycle
1060 call calc_x(igrid,xc,xcc)
1061 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1062 ixc^l,ixcc^l,.true.)
1067 if(cell_corner)
then
1069 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
1071 write(qunit) lengthcc
1072 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
1076 write(qunit) length_coords
1077 {
do ix^db=ixcmin^db,ixcmax^db \}
1079 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1081 write(qunit) real(x_vtk(k))
1085 write(qunit) length_conn
1087 {^ifoned
write(qunit)ix1-1,ix1 \}
1089 write(qunit)(ix2-1)*nxc1+ix1-1, &
1090 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1094 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1095 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1096 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1097 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1098 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1099 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1100 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1101 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1105 write(qunit) length_offsets
1107 write(qunit) icel*(2**^nd)
1110 {^ifoned vtk_type=3 \}
1111 {^iftwod vtk_type=8 \}
1112 {^ifthreed vtk_type=11 \}
1113 write(qunit) size_int*nc
1115 write(qunit) vtk_type
1118 allocate(intstatus(mpi_status_size,1))
1120 ixccmin^d=ixmlo^d; ixccmax^d=ixmhi^d;
1121 ixcmin^d=ixmlo^d-1; ixcmax^d=ixmhi^d;
1123 do morton_no=morton_start(ipe),morton_stop(ipe)
1124 if(.not. morton_aim(morton_no)) cycle
1126 call mpi_recv(xc_tmp,1,type_block_xc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1127 if(cell_corner)
then
1128 call mpi_recv(wc_tmp,1,type_block_wc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1130 call mpi_recv(wcc_tmp,1,type_block_wcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1134 if(.not.w_write(iw)) cycle
1136 if(cell_corner)
then
1138 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
1140 write(qunit) lengthcc
1141 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
1144 write(qunit) length_coords
1145 {
do ix^db=ixcmin^db,ixcmax^db \}
1147 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1149 write(qunit) real(x_vtk(k))
1152 write(qunit) length_conn
1154 {^ifoned
write(qunit)ix1-1,ix1 \}
1156 write(qunit)(ix2-1)*nxc1+ix1-1, &
1157 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1161 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1162 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1163 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1164 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1165 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1166 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1167 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1168 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1171 write(qunit) length_offsets
1173 write(qunit) icel*(2**^nd)
1175 {^ifoned vtk_type=3 \}
1176 {^iftwod vtk_type=8 \}
1177 {^ifthreed vtk_type=11 \}
1178 write(qunit) size_int*nc
1180 write(qunit) vtk_type
1186 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
1187 write(qunit,
'(a)')
'</AppendedData>'
1188 write(qunit,
'(a)')
'</VTKFile>'
1190 deallocate(intstatus)
1193 deallocate(morton_aim,morton_aim_p)
1195 call mpi_barrier(icomm,ierrmpi)
1208 integer,
intent(in) :: qunit
1210 double precision :: x_VTK(1:3)
1211 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
1212 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
1213 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1214 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1215 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio):: wC_TMP
1216 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
1217 double precision :: normconv(0:nw+nwauxio)
1218 integer,
allocatable :: intstatus(:,:)
1219 integer :: itag,ipe,igrid,level,icel,ixC^L,ixCC^L,Morton_no,Morton_length
1220 integer :: nx^D,nxC^D,nc,np,VTK_type,ix^D,filenr
1223 integer:: length,lengthcc,length_coords,length_conn,length_offsets
1225 character(len=80):: filename
1226 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1227 character(len=1024) :: outfilehead
1228 logical :: fileopen,cell_corner=.false.
1229 logical,
allocatable :: Morton_aim(:),Morton_aim_p(:)
1236 morton_aim_p=.false.
1244 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1246 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
1247 morton_aim_p(morton_no)=.true.
1251 call mpi_allreduce(morton_aim_p,morton_aim,morton_length,mpi_logical,mpi_lor,&
1254 case(
'vtuB64',
'vtuBmpi64')
1256 case(
'vtuBCC64',
'vtuBCCmpi64')
1261 if(.not. morton_aim(morton_no)) cycle
1263 call calc_x(igrid,xc,xcc)
1264 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1265 ixc^l,ixcc^l,.true.)
1268 if(cell_corner)
then
1277 inquire(qunit,opened=fileopen)
1278 if(.not.fileopen)
then
1282 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
1284 open(qunit,file=filename,status=
'replace')
1288 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1289 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
1290 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1291 write(qunit,
'(a)')
'<UnstructuredGrid>'
1292 write(qunit,
'(a)')
'<FieldData>'
1293 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1294 'NumberOfTuples="1" format="ascii">'
1296 write(qunit,
'(a)')
'</DataArray>'
1297 write(qunit,
'(a)')
'</FieldData>'
1299 nx^d=ixmhi^d-ixmlo^d+1;
1303 length=np*size_double
1304 lengthcc=nc*size_double
1305 length_coords=3*length
1306 length_conn=2**^nd*size_int*nc
1307 length_offsets=nc*size_int
1310 if(.not. morton_aim(morton_no)) cycle
1311 if(cell_corner)
then
1313 write(qunit,
'(a,i7,a,i7,a)') &
1314 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1315 write(qunit,
'(a)')
'<PointData>'
1320 write(qunit,
'(a,a,a,i16,a)')&
1321 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1322 '" format="appended" offset="',offset,
'">'
1323 write(qunit,
'(a)')
'</DataArray>'
1324 offset=offset+length+size_int
1326 write(qunit,
'(a)')
'</PointData>'
1327 write(qunit,
'(a)')
'<Points>'
1328 write(qunit,
'(a,i16,a)') &
1329 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1331 offset=offset+length_coords+size_int
1332 write(qunit,
'(a)')
'</Points>'
1335 write(qunit,
'(a,i7,a,i7,a)') &
1336 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1337 write(qunit,
'(a)')
'<CellData>'
1342 write(qunit,
'(a,a,a,i16,a)')&
1343 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1344 '" format="appended" offset="',offset,
'">'
1345 write(qunit,
'(a)')
'</DataArray>'
1346 offset=offset+lengthcc+size_int
1348 write(qunit,
'(a)')
'</CellData>'
1349 write(qunit,
'(a)')
'<Points>'
1350 write(qunit,
'(a,i16,a)') &
1351 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1353 offset=offset+length_coords+size_int
1354 write(qunit,
'(a)')
'</Points>'
1356 write(qunit,
'(a)')
'<Cells>'
1358 write(qunit,
'(a,i16,a)')&
1359 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
1360 offset=offset+length_conn+size_int
1362 write(qunit,
'(a,i16,a)') &
1363 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
1364 offset=offset+length_offsets+size_int
1366 write(qunit,
'(a,i16,a)') &
1367 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
1368 offset=offset+size_int+nc*size_int
1369 write(qunit,
'(a)')
'</Cells>'
1370 write(qunit,
'(a)')
'</Piece>'
1376 if(.not. morton_aim(morton_no)) cycle
1377 if(cell_corner)
then
1379 write(qunit,
'(a,i7,a,i7,a)') &
1380 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1381 write(qunit,
'(a)')
'<PointData>'
1386 write(qunit,
'(a,a,a,i16,a)')&
1387 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1388 '" format="appended" offset="',offset,
'">'
1389 write(qunit,
'(a)')
'</DataArray>'
1390 offset=offset+length+size_int
1392 write(qunit,
'(a)')
'</PointData>'
1393 write(qunit,
'(a)')
'<Points>'
1394 write(qunit,
'(a,i16,a)') &
1395 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1397 offset=offset+length_coords+size_int
1398 write(qunit,
'(a)')
'</Points>'
1401 write(qunit,
'(a,i7,a,i7,a)') &
1402 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
1403 write(qunit,
'(a)')
'<CellData>'
1408 write(qunit,
'(a,a,a,i16,a)')&
1409 '<DataArray type="Float64" Name="',trim(wnamei(iw)), &
1410 '" format="appended" offset="',offset,
'">'
1411 write(qunit,
'(a)')
'</DataArray>'
1412 offset=offset+lengthcc+size_int
1414 write(qunit,
'(a)')
'</CellData>'
1415 write(qunit,
'(a)')
'<Points>'
1416 write(qunit,
'(a,i16,a)') &
1417 '<DataArray type="Float64" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
1419 offset=offset+length_coords+size_int
1420 write(qunit,
'(a)')
'</Points>'
1422 write(qunit,
'(a)')
'<Cells>'
1424 write(qunit,
'(a,i16,a)')&
1425 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
1426 offset=offset+length_conn+size_int
1428 write(qunit,
'(a,i16,a)') &
1429 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
1430 offset=offset+length_offsets+size_int
1432 write(qunit,
'(a,i16,a)') &
1433 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
1434 offset=offset+size_int+nc*size_int
1435 write(qunit,
'(a)')
'</Cells>'
1436 write(qunit,
'(a)')
'</Piece>'
1440 write(qunit,
'(a)')
'</UnstructuredGrid>'
1441 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
1443 open(qunit,file=filename,access=
'stream',form=
'unformatted',position=
'append')
1445 write(qunit) trim(buf)
1447 if(.not. morton_aim(morton_no)) cycle
1449 call calc_x(igrid,xc,xcc)
1450 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1451 ixc^l,ixcc^l,.true.)
1456 if(cell_corner)
then
1458 write(qunit) {(|}wc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
1460 write(qunit) lengthcc
1461 write(qunit) {(|}wcc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
1464 write(qunit) length_coords
1465 {
do ix^db=ixcmin^db,ixcmax^db \}
1467 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1469 write(qunit) x_vtk(k)
1472 write(qunit) length_conn
1474 {^ifoned
write(qunit)ix1-1,ix1 \}
1476 write(qunit)(ix2-1)*nxc1+ix1-1, &
1477 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1481 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1482 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1483 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1484 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1485 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1486 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1487 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1488 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1491 write(qunit) length_offsets
1493 write(qunit) icel*(2**^nd)
1495 {^ifoned vtk_type=3 \}
1496 {^iftwod vtk_type=8 \}
1497 {^ifthreed vtk_type=11 \}
1498 write(qunit) size_int*nc
1500 write(qunit) vtk_type
1503 allocate(intstatus(mpi_status_size,1))
1505 ixccmin^d=ixmlo^d; ixccmax^d=ixmhi^d;
1506 ixcmin^d=ixmlo^d-1; ixcmax^d=ixmhi^d;
1508 do morton_no=morton_start(ipe),morton_stop(ipe)
1509 if(.not. morton_aim(morton_no)) cycle
1511 call mpi_recv(xc_tmp,1,type_block_xc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1512 if(cell_corner)
then
1513 call mpi_recv(wc_tmp,1,type_block_wc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1515 call mpi_recv(wcc_tmp,1,type_block_wcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
1519 if(.not.w_write(iw)) cycle
1521 if(cell_corner)
then
1523 write(qunit) {(|}wc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
1525 write(qunit) lengthcc
1526 write(qunit) {(|}wcc_tmp(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
1529 write(qunit) length_coords
1530 {
do ix^db=ixcmin^db,ixcmax^db \}
1532 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
1534 write(qunit) x_vtk(k)
1537 write(qunit) length_conn
1539 {^ifoned
write(qunit)ix1-1,ix1 \}
1541 write(qunit)(ix2-1)*nxc1+ix1-1, &
1542 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1546 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1547 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1548 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1549 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1550 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1551 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1552 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1553 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1556 write(qunit) length_offsets
1558 write(qunit) icel*(2**^nd)
1560 {^ifoned vtk_type=3 \}
1561 {^iftwod vtk_type=8 \}
1562 {^ifthreed vtk_type=11 \}
1563 write(qunit) size_int*nc
1565 write(qunit) vtk_type
1571 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
1572 write(qunit,
'(a)')
'</AppendedData>'
1573 write(qunit,
'(a)')
'</VTKFile>'
1575 deallocate(intstatus)
1577 deallocate(morton_aim,morton_aim_p)
1579 call mpi_barrier(icomm,ierrmpi)
1589 integer,
intent(in) :: qunit, igrid
1591 integer :: nx^D, nxC^D, ix^D
1593 nx^d=ixmhi^d-ixmlo^d+1;
1596 {^ifoned
write(qunit,
'(2(i7,1x))')ix1-1,ix1 \}
1598 write(qunit,
'(4(i7,1x))')(ix2-1)*nxc1+ix1-1, &
1599 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
1602 write(qunit,
'(8(i7,1x))')&
1603 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
1604 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1605 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1606 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
1607 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
1608 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
1609 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
1610 ix3*nxc2*nxc1+ ix2*nxc1+ix1
1627 integer,
intent(in) :: qunit
1629 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP,xC_TMP_recv
1630 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP,xCC_TMP_recv
1631 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1632 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1633 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP,wC_TMP_recv
1634 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP,wCC_TMP_recv
1635 double precision,
dimension(0:nw+nwauxio) :: normconv
1636 integer:: igrid,iigrid,level,ixC^L,ixCC^L
1637 integer:: NumGridsOnLevel(1:nlevelshi)
1639 character(len=80):: filename
1641 integer,
allocatable :: intstatus(:,:)
1642 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
1646 integer :: itag,ipe,Morton_no,Morton_length
1647 integer :: ixrvC^L, ixrvCC^L, siz_ind, ind_send(5*^ND), ind_recv(5*^ND)
1648 double precision :: origin(1:3), spacing(1:3)
1649 integer :: wholeExtent(1:6), ig^D
1652 if(
levmin/=
levmax)
call mpistop(
'ImageData can only be used when levmin=levmax')
1660 morton_aim_p=.false.
1668 if(({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1670 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
1671 morton_aim_p(morton_no)=.true.
1675 call mpi_allreduce(morton_aim_p,morton_aim,morton_length,mpi_logical,mpi_lor,&
1679 if(.not. morton_aim(morton_no)) cycle
1681 call calc_x(igrid,xc,xcc)
1682 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1683 ixc^l,ixcc^l,.true.)
1685 {^d& ig^d = tree%node%ig^d; }
1687 ind_send=(/ ixc^l,ixcc^l, ig^d /)
1688 call mpi_send(ind_send,siz_ind,mpi_integer, 0,itag,
icomm,
ierrmpi)
1693 inquire(qunit,opened=fileopen)
1694 if(.not.fileopen)
then
1698 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vti"
1700 open(qunit,file=filename,status=
'unknown',form=
'formatted')
1704 nx^d=ixmhi^d-ixmlo^d+1;
1706 {^d& origin(^d) = xprobmin^d*normconv(0); }
1708 {^d&spacing(^d) =
dxlevel(^d)*normconv(0); }
1711 {^d&wholeextent(^d*2-1) = nx^d * ceiling(((xprobmax^d-xprobmin^d)*
writespshift(^d,1)) &
1713 {^d&wholeextent(^d*2) = nx^d * floor(((xprobmax^d-xprobmin^d)*(1.0d0-
writespshift(^d,2))) &
1717 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1718 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="ImageData"'
1719 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1720 write(qunit,
'(a,3(1pe14.6),a,6(i10),a,3(1pe14.6),a)')
' <ImageData Origin="',&
1721 origin,
'" WholeExtent="',wholeextent,
'" Spacing="',spacing,
'">'
1722 write(qunit,
'(a)')
'<FieldData>'
1723 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1724 'NumberOfTuples="1" format="ascii">'
1726 write(qunit,
'(a)')
'</DataArray>'
1727 write(qunit,
'(a)')
'</FieldData>'
1731 if(.not. morton_aim(morton_no)) cycle
1734 {^d& ig^d = tree%node%ig^d; }
1735 call calc_x(igrid,xc,xcc)
1736 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1737 ixc^l,ixcc^l,.true.)
1739 nx^d,normconv,wnamei,wc_tmp,wcc_tmp)
1743 allocate(intstatus(mpi_status_size,1))
1746 if(.not. morton_aim(morton_no)) cycle
1748 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1749 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
1750 ixrvccmin^d=ind_recv(2*^nd+^d);ixrvccmax^d=ind_recv(3*^nd+^d);
1751 ig^d=ind_recv(4*^nd+^d);
1754 call write_vti(qunit,ixg^
ll,ixrvc^l,ixrvcc^l,ig^d,&
1755 nx^d,normconv,wnamei,wc_tmp,wcc_tmp)
1759 write(qunit,
'(a)')
'</ImageData>'
1760 write(qunit,
'(a)')
'</VTKFile>'
1762 if(
npe>1)
deallocate(intstatus)
1765 deallocate(morton_aim,morton_aim_p)
1779 integer,
intent(in) :: qunit
1781 double precision,
dimension(0:nw+nwauxio) :: normconv
1782 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
1783 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
1784 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1785 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1786 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
1787 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
1788 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1789 character(len=1024) :: outfilehead
1790 integer :: nx^D,nxC^D,nc,np, igrid,ixC^L,ixCC^L,level,Morton_no
1791 character(len=80) :: pfilename
1793 logical :: fileopen,conv_grid
1800 inquire(qunit,opened=fileopen)
1801 if(.not.fileopen)
then
1807 open(qunit,file=pfilename,status=
'unknown',form=
'formatted')
1810 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1811 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
1812 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1813 write(qunit,
'(a)')
' <UnstructuredGrid>'
1814 write(qunit,
'(a)')
'<FieldData>'
1815 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1816 'NumberOfTuples="1" format="ascii">'
1818 write(qunit,
'(a)')
'</DataArray>'
1819 write(qunit,
'(a)')
'</FieldData>'
1824 nx^d=ixmhi^d-ixmlo^d+1;
1838 conv_grid=({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1840 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.})
1841 if (.not.conv_grid) cycle
1842 call calc_x(igrid,xc,xcc)
1843 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1844 ixc^l,ixcc^l,.true.)
1845 call write_vtk(qunit,ixg^
ll,ixc^l,ixcc^l,igrid,nc,np,nx^d,nxc^d,&
1846 normconv,wnamei,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp)
1850 write(qunit,
'(a)')
' </UnstructuredGrid>'
1851 write(qunit,
'(a)')
'</VTKFile>'
1871 integer,
intent(in) :: qunit
1873 double precision :: x_VTK(1:3)
1874 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP,xC_TMP_recv
1875 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP,xCC_TMP_recv
1876 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
1877 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
1878 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP,wC_TMP_recv
1879 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP,wCC_TMP_recv
1880 double precision,
dimension(0:nw+nwauxio) :: normconv
1881 integer:: igrid,iigrid,level,ixC^L,ixCC^L
1882 integer:: NumGridsOnLevel(1:nlevelshi)
1883 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,nc,np,ix^D
1884 character(len=80):: filename
1886 integer,
allocatable :: intstatus(:,:)
1887 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
1888 character(len=1024) :: outfilehead
1889 logical :: fileopen,conv_grid,cond_grid_recv
1890 integer :: itag,ipe,Morton_no,siz_ind
1891 integer :: ind_send(4*^ND),ind_recv(4*^ND)
1892 integer :: levmin_recv,levmax_recv,level_recv,igrid_recv,ixrvC^L,ixrvCC^L
1895 inquire(qunit,opened=fileopen)
1896 if(.not.fileopen)
then
1900 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".vtu"
1902 open(qunit,file=filename,status=
'unknown',form=
'formatted')
1905 write(qunit,
'(a)')
'<?xml version="1.0"?>'
1906 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
1907 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
1908 write(qunit,
'(a)')
'<UnstructuredGrid>'
1909 write(qunit,
'(a)')
'<FieldData>'
1910 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
1911 'NumberOfTuples="1" format="ascii">'
1913 write(qunit,
'(a)')
'</DataArray>'
1914 write(qunit,
'(a)')
'</FieldData>'
1919 nx^d=ixmhi^d-ixmlo^d+1;
1941 call mpi_send(igrid,1,mpi_integer, 0,itag,
icomm,
ierrmpi)
1948 conv_grid=({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
1950 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.})
1952 call mpi_send(conv_grid,1,mpi_logical,0,itag,
icomm,
ierrmpi)
1954 if (.not.conv_grid) cycle
1955 call calc_x(igrid,xc,xcc)
1956 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
1957 ixc^l,ixcc^l,.true.)
1960 ind_send=(/ ixc^l,ixcc^l /)
1962 call mpi_send(ind_send,siz_ind,mpi_integer, 0,itag,
icomm,
ierrmpi)
1963 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,
icomm,
ierrmpi)
1970 call write_vtk(qunit,ixg^
ll,ixc^l,ixcc^l,igrid,nc,np,nx^d,nxc^d,&
1971 normconv,wnamei,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp)
1977 allocate(intstatus(mpi_status_size,1))
1981 call mpi_recv(levmin_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1984 call mpi_recv(levmax_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1986 do level=levmin_recv,levmax_recv
1990 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1992 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1993 if (level_recv/=level) cycle
1994 call mpi_recv(cond_grid_recv,1,mpi_logical, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1995 if(.not.cond_grid_recv)cycle
1998 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,
icomm,intstatus(:,1),
ierrmpi)
1999 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
2000 ixrvccmin^d=ind_recv(2*^nd+^d);ixrvccmax^d=ind_recv(3*^nd+^d);
2001 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2008 call write_vtk(qunit,ixg^
ll,ixrvc^l,ixrvcc^l,igrid_recv,&
2009 nc,np,nx^d,nxc^d,normconv,wnamei,&
2010 xc_tmp_recv,xcc_tmp_recv,wc_tmp_recv,wcc_tmp_recv)
2015 write(qunit,
'(a)')
'</UnstructuredGrid>'
2016 write(qunit,
'(a)')
'</VTKFile>'
2021 if(
mype==0)
deallocate(intstatus)
2026 subroutine write_vtk(qunit,ixI^L,ixC^L,ixCC^L,igrid,nc,np,nx^D,nxC^D,&
2027 normconv,wnamei,xC,xCC,wC,wCC)
2030 integer,
intent(in) :: qunit
2031 integer,
intent(in) :: ixI^L,ixC^L,ixCC^L
2032 integer,
intent(in) :: igrid,nc,np,nx^D,nxC^D
2033 double precision,
intent(in) :: normconv(0:nw+nwauxio)
2034 character(len=name_len),
intent(in):: wnamei(1:nw+nwauxio)
2035 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
2036 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
2037 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC
2038 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC
2040 double precision :: x_VTK(1:3)
2041 integer :: iw,ix^D,icel,VTK_type
2044 case(
'vtumpi',
'pvtumpi')
2046 write(qunit,
'(a,i7,a,i7,a)') &
2047 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2048 write(qunit,
'(a)')
'<PointData>'
2053 write(qunit,
'(a,a,a)')&
2054 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2055 write(qunit,
'(200(1pe14.6))') {(|}wc(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
2056 write(qunit,
'(a)')
'</DataArray>'
2058 write(qunit,
'(a)')
'</PointData>'
2059 write(qunit,
'(a)')
'<Points>'
2060 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
2062 {
do ix^db=ixcmin^db,ixcmax^db \}
2064 x_vtk(1:
ndim)=xc(ix^d,1:
ndim)*normconv(0);
2065 write(qunit,
'(3(1pe14.6))') x_vtk
2067 write(qunit,
'(a)')
'</DataArray>'
2068 write(qunit,
'(a)')
'</Points>'
2070 case(
'vtuCCmpi',
'pvtuCCmpi')
2072 write(qunit,
'(a,i7,a,i7,a)') &
2073 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2074 write(qunit,
'(a)')
'<CellData>'
2079 write(qunit,
'(a,a,a)')&
2080 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2081 write(qunit,
'(200(1pe14.6))') {(|}wcc(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
2082 write(qunit,
'(a)')
'</DataArray>'
2084 write(qunit,
'(a)')
'</CellData>'
2085 write(qunit,
'(a)')
'<Points>'
2086 write(qunit,
'(a)')
'<DataArray type="Float32" NumberOfComponents="3" format="ascii">'
2088 {
do ix^db=ixcmin^db,ixcmax^db \}
2090 x_vtk(1:
ndim)=xc(ix^d,1:
ndim)*normconv(0);
2091 write(qunit,
'(3(1pe14.6))') x_vtk
2093 write(qunit,
'(a)')
'</DataArray>'
2094 write(qunit,
'(a)')
'</Points>'
2097 write(qunit,
'(a)')
'<Cells>'
2099 write(qunit,
'(a)')
'<DataArray type="Int32" Name="connectivity" format="ascii">'
2101 write(qunit,
'(a)')
'</DataArray>'
2103 write(qunit,
'(a)')
'<DataArray type="Int32" Name="offsets" format="ascii">'
2105 write(qunit,
'(i7)') icel*(2**^nd)
2107 write(qunit,
'(a)')
'</DataArray>'
2109 write(qunit,
'(a)')
'<DataArray type="Int32" Name="types" format="ascii">'
2111 {^ifoned vtk_type=3 \}
2112 {^iftwod vtk_type=8 \}
2113 {^ifthreed vtk_type=11 \}
2115 write(qunit,
'(i2)') vtk_type
2117 write(qunit,
'(a)')
'</DataArray>'
2118 write(qunit,
'(a)')
'</Cells>'
2119 write(qunit,
'(a)')
'</Piece>'
2124 normconv,wnamei,wC,wCC)
2127 integer,
intent(in) :: qunit
2128 integer,
intent(in) :: ixI^L,ixC^L,ixCC^L
2129 integer,
intent(in) :: ig^D,nx^D
2130 double precision,
intent(in) :: normconv(0:nw+nwauxio)
2131 character(len=name_len),
intent(in):: wnamei(1:nw+nwauxio)
2132 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC
2133 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC
2136 integer :: extent(1:6)
2139 {^d& extent(^d*2-1) = (ig^d-1) * nx^d; }
2140 {^d& extent(^d*2) = (ig^d) * nx^d; }
2143 case(
'vtimpi',
'pvtimpi')
2145 write(qunit,
'(a,6(i10),a)') &
2146 '<Piece Extent="',extent,
'">'
2147 write(qunit,
'(a)')
'<PointData>'
2152 write(qunit,
'(a,a,a)')&
2153 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2154 write(qunit,
'(200(1pe20.12))') {(|}wc(ix^d,iw)*normconv(iw),{ix^d=ixcmin^d,ixcmax^d)}
2155 write(qunit,
'(a)')
'</DataArray>'
2157 write(qunit,
'(a)')
'</PointData>'
2158 case(
'vtiCCmpi',
'pvtiCCmpi')
2160 write(qunit,
'(a,6(i10),a)') &
2161 '<Piece Extent="',extent,
'">'
2162 write(qunit,
'(a)')
'<CellData>'
2167 write(qunit,
'(a,a,a)')&
2168 '<DataArray type="Float64" Name="',trim(wnamei(iw)),
'" format="ascii">'
2169 write(qunit,
'(200(1pe20.12))') {(|}wcc(ix^d,iw)*normconv(iw),{ix^d=ixccmin^d,ixccmax^d)}
2170 write(qunit,
'(a)')
'</DataArray>'
2172 write(qunit,
'(a)')
'</CellData>'
2175 write(qunit,
'(a)')
'</Piece>'
2183 integer,
intent(in) :: qunit
2185 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio),outtype
2186 character(len=1024) :: outfilehead
2187 character(len=80) :: filename,pfilename
2188 integer :: filenr,iw,ipe,iscalars
2192 case(
'pvtumpi',
'pvtuBmpi')
2193 outtype=
"PPointData"
2194 case(
'pvtuCCmpi',
'pvtuBCCmpi')
2197 inquire(qunit,opened=fileopen)
2198 if(.not.fileopen)
then
2202 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".pvtu"
2204 open(qunit,file=filename,status=
'unknown',form=
'formatted')
2214 write(qunit,
'(a)')
'<?xml version="1.0"?>'
2215 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="PUnstructuredGrid"'
2216 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
2217 write(qunit,
'(a)')
' <PUnstructuredGrid GhostLevel="0">'
2219 write(qunit,
'(a,a,a,a,a)')&
2220 ' <',trim(outtype),
' Scalars="',trim(wnamei(iscalars))//
'">'
2223 write(qunit,
'(a,a,a)')&
2224 ' <PDataArray type="Float32" Name="',trim(wnamei(iw)),
'"/>'
2226 do iw=nw+1,nw+nwauxio
2227 write(qunit,
'(a,a,a)')&
2228 ' <PDataArray type="Float32" Name="',trim(wnamei(iw)),
'"/>'
2230 write(qunit,
'(a,a,a)')
' </',trim(outtype),
'>'
2231 write(qunit,
'(a)')
' <PPoints>'
2232 write(qunit,
'(a)')
' <PDataArray type="Float32" NumberOfComponents="3"/>'
2233 write(qunit,
'(a)')
' </PPoints>'
2240 write(qunit,
'(a,a,a)')
' <Piece Source="',trim(pfilename),
'"/>'
2242 write(qunit,
'(a)')
' </PUnstructuredGrid>'
2243 write(qunit,
'(a)')
'</VTKFile>'
2261 integer,
intent(in) :: qunit
2263 integer:: igrid,iigrid,level,igonlevel,iw,idim,ix^D
2264 integer:: NumGridsOnLevel(1:nlevelshi)
2265 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,ixC^L,ixCC^L
2266 integer :: nodesonlevelmype,elemsonlevelmype
2267 integer :: nodes, elems
2268 integer,
allocatable :: intstatus(:,:)
2269 double precision :: x_TEC(ndim), w_TEC(nw+nwauxio)
2270 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP,xC_TMP_recv
2271 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP,xCC_TMP_recv
2272 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
2273 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
2274 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP,wC_TMP_recv
2275 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP,wCC_TMP_recv
2276 double precision,
dimension(0:nw+nwauxio) :: normconv
2277 logical :: fileopen,first
2278 integer :: itag,Morton_no,ipe,levmin_recv,levmax_recv,igrid_recv,level_recv
2279 integer :: ixrvC^L,ixrvCC^L
2280 integer :: ind_send(2*^ND),ind_recv(2*^ND),siz_ind,igonlevel_recv
2281 integer :: NumGridsOnLevel_mype(1:nlevelshi,0:npe-1)
2282 character(len=80) :: filename
2284 character(len=1024) :: tecplothead
2285 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
2286 character(len=1024) :: outfilehead
2288 if(nw/=count(
w_write(1:nw)))
then
2289 if(
mype==0) print *,
'tecplot_mpi does not use w_write=F'
2290 call mpistop(
'w_write, tecplot')
2294 if(
mype==0) print *,
'tecplot_mpi with nocartesian'
2297 master_cpu_open :
if (
mype == 0)
then
2298 inquire(qunit,opened=fileopen)
2299 if (.not.fileopen)
then
2303 write(filename,
'(a,i4.4,a)') trim(
base_filename),filenr,
".plt"
2304 open(qunit,file=filename,status=
'unknown')
2307 write(tecplothead,
'(a)')
"VARIABLES = "//trim(outfilehead)
2308 write(qunit,
'(a)') tecplothead(1:len_trim(tecplothead))
2309 end if master_cpu_open
2312 numgridsonlevel(1:nlevelshi)=0
2314 numgridsonlevel(level)=0
2318 numgridsonlevel(level)=numgridsonlevel(level)+1
2320 numgridsonlevel_mype(level,0:npe-1)=0
2321 numgridsonlevel_mype(level,
mype) = numgridsonlevel(level)
2322 call mpi_allreduce(mpi_in_place,numgridsonlevel_mype(level,0:npe-1),npe,mpi_integer,&
2324 call mpi_allreduce(mpi_in_place,numgridsonlevel(level),1,mpi_integer,mpi_sum, &
2328 nx^d=ixmhi^d-ixmlo^d+1;
2331 if(
mype==0.and.npe>1)
allocate(intstatus(mpi_status_size,1))
2338 nodes=nodes + numgridsonlevel(level)*{nxc^d*}
2339 elems=elems + numgridsonlevel(level)*{nx^d*}
2342 if (
mype==0)
write(qunit,
"(a,i7,a,1pe12.5,a)") &
2343 'ZONE T="all levels", I=',elems, &
2349 call calc_x(igrid,xc,xcc)
2350 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,ixc^l,ixcc^l,.true.)
2352 {
do ix^db=ixccmin^db,ixccmax^db\}
2353 x_tec(1:ndim)=xcc_tmp(ix^d,1:ndim)*normconv(0)
2354 w_tec(1:nw+nwauxio)=wcc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2355 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2357 else if (mype/=0)
then
2359 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2360 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision,0,itag,icomm,ierrmpi)
2361 call mpi_send(wcc_tmp,1,type_block_wcc_io, 0,itag,icomm,ierrmpi)
2362 call mpi_send(xcc_tmp,1,type_block_xcc_io, 0,itag,icomm,ierrmpi)
2367 do morton_no=morton_start(ipe),morton_stop(ipe)
2369 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2370 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,&
2371 itag,icomm,intstatus(:,1),ierrmpi)
2372 call mpi_recv(wcc_tmp_recv,1,type_block_wcc_io, ipe,itag,&
2373 icomm,intstatus(:,1),ierrmpi)
2374 call mpi_recv(xcc_tmp_recv,1,type_block_xcc_io, ipe,itag,&
2375 icomm,intstatus(:,1),ierrmpi)
2376 {
do ix^db=ixccmin^db,ixccmax^db\}
2377 x_tec(1:ndim)=xcc_tmp_recv(ix^d,1:ndim)*normconv(0)
2378 w_tec(1:nw+nwauxio)=wcc_tmp_recv(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2379 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2388 itag=1000*morton_stop(mype)
2389 call mpi_send(levmin,1,mpi_integer, 0,itag,icomm,ierrmpi)
2390 itag=2000*morton_stop(mype)
2391 call mpi_send(levmax,1,mpi_integer, 0,itag,icomm,ierrmpi)
2394 do level=levmin,levmax
2395 nodesonlevelmype=numgridsonlevel_mype(level,mype)*{nxc^d*}
2396 elemsonlevelmype=numgridsonlevel_mype(level,mype)*{nx^d*}
2397 nodesonlevel=numgridsonlevel(level)*{nxc^d*}
2398 elemsonlevel=numgridsonlevel(level)*{nx^d*}
2405 select case(convert_type)
2410 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2411 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,a)") &
2412 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2413 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=POINT, ZONETYPE=', &
2414 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2415 do morton_no=morton_start(mype),morton_stop(mype)
2416 igrid = sfc_to_igrid(morton_no)
2419 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2421 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2423 if (node(plevel_,igrid)/=level) cycle
2424 call calc_x(igrid,xc,xcc)
2425 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2426 ixc^l,ixcc^l,.true.)
2429 ind_send=(/ ixc^l /)
2431 call mpi_send(ind_send,siz_ind, mpi_integer, 0,itag,icomm,ierrmpi)
2432 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,icomm,ierrmpi)
2434 call mpi_send(wc_tmp,1,type_block_wc_io, 0,itag,icomm,ierrmpi)
2435 call mpi_send(xc_tmp,1,type_block_xc_io, 0,itag,icomm,ierrmpi)
2437 {
do ix^db=ixcmin^db,ixcmax^db\}
2438 x_tec(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0)
2439 w_tec(1:nw+nwauxio)=wc_tmp(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2440 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2444 case(
'tecplotCCmpi')
2450 if(ndim+nw+nwauxio>99)
call mpistop(
"adjust format specification in writeout")
2451 if(nw+nwauxio==1)
then
2454 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2455 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,a)") &
2456 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2457 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2458 ndim+1,
']=CELLCENTERED), ZONETYPE=', &
2459 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2461 if(ndim+nw+nwauxio<10)
then
2463 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2464 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i1,a,a)") &
2465 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2466 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2467 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2468 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2470 if (mype==0.and.(nodesonlevelmype>0.and.elemsonlevelmype>0))&
2471 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i2,a,a)") &
2472 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2473 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2474 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2475 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2481 do morton_no=morton_start(mype),morton_stop(mype)
2482 igrid = sfc_to_igrid(morton_no)
2485 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2487 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2489 if (node(plevel_,igrid)/=level) cycle
2490 call calc_x(igrid,xc,xcc)
2491 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2494 ind_send=(/ ixc^l /)
2497 call mpi_send(ind_send,siz_ind, mpi_integer, 0,itag,icomm,ierrmpi)
2498 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,icomm,ierrmpi)
2499 call mpi_send(xc_tmp,1,type_block_xc_io, 0,itag,icomm,ierrmpi)
2501 write(qunit,fmt=
"(100(e14.6))") xc_tmp(ixc^s,idim)*normconv(0)
2506 do morton_no=morton_start(mype),morton_stop(mype)
2507 igrid = sfc_to_igrid(morton_no)
2509 itag=morton_no*(ndim+iw)
2510 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2511 itag=igrid*(ndim+iw)
2512 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2514 if (node(plevel_,igrid)/=level) cycle
2515 call calc_x(igrid,xc,xcc)
2516 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2517 ixc^l,ixcc^l,.true.)
2519 ind_send=(/ ixcc^l /)
2521 itag=igrid*(ndim+iw)
2522 call mpi_send(ind_send,siz_ind, mpi_integer, 0,itag,icomm,ierrmpi)
2523 call mpi_send(normconv,nw+nwauxio+1,mpi_double_precision, 0,itag,icomm,ierrmpi)
2524 call mpi_send(wcc_tmp,1,type_block_wcc_io, 0,itag,icomm,ierrmpi)
2526 write(qunit,fmt=
"(100(e14.6))") wcc_tmp(ixcc^s,iw)*normconv(iw)
2531 call mpistop(
'no such tecplot type')
2535 do morton_no=morton_start(mype),morton_stop(mype)
2536 igrid = sfc_to_igrid(morton_no)
2539 call mpi_send(igrid,1,mpi_integer, 0,itag,icomm,ierrmpi)
2541 call mpi_send(node(plevel_,igrid),1,mpi_integer, 0,itag,icomm,ierrmpi)
2543 if(node(plevel_,igrid)/=level) cycle
2544 igonlevel=igonlevel+1
2547 call mpi_send(igonlevel,1,mpi_integer, 0,itag,icomm,ierrmpi)
2555 if(mype==0 .and.npe>1)
then
2557 itag=1000*morton_stop(ipe)
2558 call mpi_recv(levmin_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2559 itag=2000*morton_stop(ipe)
2560 call mpi_recv(levmax_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2561 do level=levmin_recv,levmax_recv
2562 nodesonlevelmype=numgridsonlevel_mype(level,ipe)*{nxc^d*}
2563 elemsonlevelmype=numgridsonlevel_mype(level,ipe)*{nx^d*}
2564 nodesonlevel=numgridsonlevel(level)*{nxc^d*}
2565 elemsonlevel=numgridsonlevel(level)*{nx^d*}
2566 select case(convert_type)
2571 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2572 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,a)") &
2573 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2574 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=POINT, ZONETYPE=', &
2575 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2576 do morton_no=morton_start(ipe),morton_stop(ipe)
2578 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2580 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2581 if (level_recv/=level) cycle
2584 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,&
2585 icomm,intstatus(:,1),ierrmpi)
2586 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
2587 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2588 ,icomm,intstatus(:,1),ierrmpi)
2589 call mpi_recv(wc_tmp_recv,1,type_block_wc_io, ipe,itag,&
2590 icomm,intstatus(:,1),ierrmpi)
2591 call mpi_recv(xc_tmp_recv,1,type_block_xc_io, ipe,itag,&
2592 icomm,intstatus(:,1),ierrmpi)
2593 {
do ix^db=ixrvcmin^db,ixrvcmax^db\}
2594 x_tec(1:ndim)=xc_tmp_recv(ix^d,1:ndim)*normconv(0)
2595 w_tec(1:nw+nwauxio)=wc_tmp_recv(ix^d,1:nw+nwauxio)*normconv(1:nw+nwauxio)
2596 write(qunit,fmt=
"(100(e14.6))") x_tec, w_tec
2599 case(
'tecplotCCmpi')
2605 if(ndim+nw+nwauxio>99)
call mpistop(
"adjust format specification in writeout")
2606 if(nw+nwauxio==1)
then
2609 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2610 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,a)") &
2611 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2612 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2613 ndim+1,
']=CELLCENTERED), ZONETYPE=', &
2614 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2616 if(ndim+nw+nwauxio<10)
then
2618 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2619 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i1,a,a)") &
2620 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2621 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2622 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2623 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2625 if(nodesonlevelmype>0.and.elemsonlevelmype>0) &
2626 write(qunit,
"(a,i7,a,a,i7,a,i7,a,f25.16,a,i1,a,i2,a,a)") &
2627 'ZONE T="',level,
'"',
', N=',nodesonlevelmype,
', E=',elemsonlevelmype, &
2628 ', SOLUTIONTIME=',global_time*time_convert_factor,
', DATAPACKING=BLOCK, VARLOCATION=([', &
2629 ndim+1,
'-',ndim+nw+nwauxio,
']=CELLCENTERED), ZONETYPE=', &
2630 {^ifoned
'FELINESEG'}{^iftwod
'FEQUADRILATERAL'}{^ifthreed
'FEBRICK'}
2635 do morton_no=morton_start(ipe),morton_stop(ipe)
2637 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2638 itag=igrid_recv*idim
2639 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2640 if (level_recv/=level) cycle
2642 itag=igrid_recv*idim
2643 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2644 ixrvcmin^d=ind_recv(^d);ixrvcmax^d=ind_recv(^nd+^d);
2645 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2646 ,icomm,intstatus(:,1),ierrmpi)
2647 call mpi_recv(xc_tmp_recv,1,type_block_xc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2648 write(qunit,fmt=
"(100(e14.6))") xc_tmp_recv(ixrvc^s,idim)*normconv(0)
2652 do morton_no=morton_start(ipe),morton_stop(ipe)
2653 itag=morton_no*(ndim+iw)
2654 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2655 itag=igrid_recv*(ndim+iw)
2656 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2657 if (level_recv/=level) cycle
2659 itag=igrid_recv*(ndim+iw)
2660 call mpi_recv(ind_recv,siz_ind, mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2661 ixrvccmin^d=ind_recv(^d);ixrvccmax^d=ind_recv(^nd+^d);
2662 call mpi_recv(normconv,nw+nwauxio+1, mpi_double_precision,ipe,itag&
2663 ,icomm,intstatus(:,1),ierrmpi)
2664 call mpi_recv(wcc_tmp_recv,1,type_block_wcc_io, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2665 write(qunit,fmt=
"(100(e14.6))") wcc_tmp_recv(ixrvcc^s,iw)*normconv(iw)
2669 call mpistop(
'no such tecplot type')
2672 do morton_no=morton_start(ipe),morton_stop(ipe)
2674 call mpi_recv(igrid_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2676 call mpi_recv(level_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2677 if (level_recv/=level) cycle
2679 call mpi_recv(igonlevel_recv,1,mpi_integer, ipe,itag,icomm,intstatus(:,1),ierrmpi)
2688 call mpi_barrier(icomm,ierrmpi)
2689 if(mype==0)
deallocate(intstatus)
2704 integer,
intent(in) :: qunit
2706 double precision :: x_VTK(1:3)
2707 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC_TMP
2708 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC_TMP
2709 double precision,
dimension(ixMlo^D-1:ixMhi^D,ndim) :: xC
2710 double precision,
dimension(ixMlo^D:ixMhi^D,ndim) :: xCC
2711 double precision,
dimension(ixMlo^D-1:ixMhi^D,nw+nwauxio) :: wC_TMP
2712 double precision,
dimension(ixMlo^D:ixMhi^D,nw+nwauxio) :: wCC_TMP
2713 integer :: igrid,iigrid,level,igonlevel,icel,ixC^L,ixCC^L,Morton_no
2714 integer :: NumGridsOnLevel(1:nlevelshi)
2715 integer :: nx^D,nxC^D,nodesonlevel,elemsonlevel,nc,np,VTK_type,ix^D
2716 double precision :: normconv(0:nw+nwauxio)
2717 character(len=80) :: pfilename
2718 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:ndim+nw+nwauxio)
2719 character(len=1024) :: outfilehead
2721 integer:: recsep,k,iw,filenr
2722 integer:: length,lengthcc,offset_points,offset_cells, &
2723 length_coords,length_conn,length_offsets
2725 character(len=6):: bufform
2733 inquire(qunit,opened=fileopen)
2734 if(.not.fileopen)
then
2740 open(qunit,file=pfilename,status=
'unknown',form=
'formatted')
2743 write(qunit,
'(a)')
'<?xml version="1.0"?>'
2744 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
2745 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
2746 write(qunit,
'(a)')
' <UnstructuredGrid>'
2747 write(qunit,
'(a)')
'<FieldData>'
2748 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
2749 'NumberOfTuples="1" format="ascii">'
2751 write(qunit,
'(a)')
'</DataArray>'
2752 write(qunit,
'(a)')
'</FieldData>'
2759 nx^d=ixmhi^d-ixmlo^d+1;
2765 lengthcc=nc*size_real
2767 length_coords=3*length
2768 length_conn=2**^nd*size_int*nc
2769 length_offsets=nc*size_int
2780 if (({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
2782 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
2786 write(qunit,
'(a,i7,a,i7,a)') &
2787 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2788 write(qunit,
'(a)')
'<PointData>'
2792 write(qunit,
'(a,a,a,i16,a)')&
2793 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2794 '" format="appended" offset="',offset,
'">'
2795 write(qunit,
'(a)')
'</DataArray>'
2796 offset=offset+length+size_int
2798 do iw=nw+1,nw+nwauxio
2800 write(qunit,
'(a,a,a,i16,a)')&
2801 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2802 '" format="appended" offset="',offset,
'">'
2803 write(qunit,
'(a)')
'</DataArray>'
2804 offset=offset+length+size_int
2806 write(qunit,
'(a)')
'</PointData>'
2808 write(qunit,
'(a)')
'<Points>'
2809 write(qunit,
'(a,i16,a)') &
2810 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
2812 offset=offset+length_coords+size_int
2813 write(qunit,
'(a)')
'</Points>'
2816 write(qunit,
'(a,i7,a,i7,a)') &
2817 '<Piece NumberOfPoints="',np,
'" NumberOfCells="',nc,
'">'
2818 write(qunit,
'(a)')
'<CellData>'
2822 write(qunit,
'(a,a,a,i16,a)')&
2823 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2824 '" format="appended" offset="',offset,
'">'
2825 write(qunit,
'(a)')
'</DataArray>'
2826 offset=offset+lengthcc+size_int
2828 do iw=nw+1,nw+nwauxio
2830 write(qunit,
'(a,a,a,i16,a)')&
2831 '<DataArray type="Float32" Name="',trim(wnamei(iw)), &
2832 '" format="appended" offset="',offset,
'">'
2833 write(qunit,
'(a)')
'</DataArray>'
2834 offset=offset+lengthcc+size_int
2836 write(qunit,
'(a)')
'</CellData>'
2837 write(qunit,
'(a)')
'<Points>'
2838 write(qunit,
'(a,i16,a)') &
2839 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',offset,
'"/>'
2841 offset=offset+length_coords+size_int
2842 write(qunit,
'(a)')
'</Points>'
2844 write(qunit,
'(a)')
'<Cells>'
2846 write(qunit,
'(a,i16,a)')&
2847 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',offset,
'"/>'
2848 offset=offset+length_conn+size_int
2850 write(qunit,
'(a,i16,a)') &
2851 '<DataArray type="Int32" Name="offsets" format="appended" offset="',offset,
'"/>'
2852 offset=offset+length_offsets+size_int
2854 write(qunit,
'(a,i16,a)') &
2855 '<DataArray type="Int32" Name="types" format="appended" offset="',offset,
'"/>'
2856 offset=offset+size_int+nc*size_int
2857 write(qunit,
'(a)')
'</Cells>'
2858 write(qunit,
'(a)')
'</Piece>'
2864 write(qunit,
'(a)')
'</UnstructuredGrid>'
2865 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
2872 open(qunit,file=pfilename,access=
'stream',form=
'unformatted',position=
'append')
2874 write(qunit) trim(buf)
2883 if (({
rnode(
rpxmin^
d_,igrid)>=xprobmin^d+(xprobmax^d-xprobmin^d)&
2885 <=xprobmax^d-(xprobmax^d-xprobmin^d)*
writespshift(^d,2)|.and.}))
then
2886 call calc_x(igrid,xc,xcc)
2887 call calc_grid(qunit,igrid,xc,xcc,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
2888 ixc^l,ixcc^l,.true.)
2894 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
2896 write(qunit) lengthcc
2897 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
2900 do iw=nw+1,nw+nwauxio
2904 write(qunit) {(|}real(wc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixcmin^d,ixcmax^d)}
2906 write(qunit) lengthcc
2907 write(qunit) {(|}real(wcc_tmp(ix^d,iw)*normconv(iw)),{ix^d=ixccmin^d,ixccmax^d)}
2910 write(qunit) length_coords
2911 {
do ix^db=ixcmin^db,ixcmax^db \}
2913 x_vtk(1:ndim)=xc_tmp(ix^d,1:ndim)*normconv(0);
2915 write(qunit) real(x_vtk(k))
2918 write(qunit) length_conn
2920 {^ifoned
write(qunit)ix1-1,ix1 \}
2922 write(qunit)(ix2-1)*nxc1+ix1-1, &
2923 (ix2-1)*nxc1+ix1,ix2*nxc1+ix1-1,ix2*nxc1+ix1
2927 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
2928 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
2929 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
2930 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
2931 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
2932 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
2933 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
2934 ix3*nxc2*nxc1+ ix2*nxc1+ix1
2937 write(qunit) length_offsets
2939 write(qunit) icel*(2**^nd)
2941 {^ifoned vtk_type=3 \}
2942 {^iftwod vtk_type=8 \}
2943 {^ifthreed vtk_type=11 \}
2944 write(qunit) size_int*nc
2946 write(qunit) vtk_type
2954 open(qunit,file=pfilename,status=
'unknown',form=
'formatted',position=
'append')
2955 write(qunit,
'(a)')
'</AppendedData>'
2956 write(qunit,
'(a)')
'</VTKFile>'
2969 integer,
intent(in) :: qunit
2971 double precision :: x_VTK(1:3)
2972 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC_TMP
2973 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC_TMP
2974 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC_TMP
2975 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC_TMP
2976 double precision,
dimension(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:nw&
+nwauxio) :: w
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 double precision :: normconv(0:nw+nwauxio)
2984 character(len=80):: filename
2985 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:3+nw+nwauxio)
2986 character(len=1024) :: outfilehead
2988 integer :: size_length,recsep,k,iw
2989 integer :: length,lengthcc,offset_points,offset_cells, length_coords,&
2990 length_conn,length_offsets
2991 integer :: i3grid,n3grid
2992 double precision ::d3grid,zlengsc,zgridsc
2994 character(len=6):: bufform
2995 double precision :: zlength
2999 if(
mype==0) print *,
'unstructuredvtkB23 not parallel, use vtumpi'
3000 call mpistop(
'npe>1, unstructuredvtkB23')
3006 inquire(qunit,opened=fileopen)
3007 if(.not.fileopen)
then
3011 open(qunit,file=filename,status=
'replace')
3015 write(qunit,
'(a)')
'<?xml version="1.0"?>'
3016 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
3017 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
3018 write(qunit,
'(a)')
'<UnstructuredGrid>'
3019 write(qunit,
'(a)')
'<FieldData>'
3020 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
3021 'NumberOfTuples="1" format="ascii">'
3023 write(qunit,
'(a)')
'</DataArray>'
3024 write(qunit,
'(a)')
'</FieldData>'
3027 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3028 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3033 lengthcc=nc*size_real
3035 length_coords=3*length
3036 length_conn=2**3*size_int*nc
3037 length_offsets=nc*size_int
3042 zlengsc=2.d0*zgridsc
3043 zlength=zlengsc*(xprobmax1-xprobmin1)
3046 do iigrid=1,igridstail; igrid=igrids(iigrid);
3051 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3054 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3057 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3058 n3grid=nint(zlength/d3grid)
3063 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3064 '" NumberOfCells="',nc,
'">'
3065 write(qunit,
'(a)')
'<PointData>'
3068 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3069 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3070 write(qunit,
'(a)')
'</DataArray>'
3071 offset=offset+length+size_int
3074 do iw=nw+1,nw+nwauxio
3075 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3076 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3077 write(qunit,
'(a)')
'</DataArray>'
3078 offset=offset+length+size_int
3081 write(qunit,
'(a)')
'</PointData>'
3083 write(qunit,
'(a)')
'<Points>'
3084 write(qunit,
'(a,i16,a)') &
3085 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3088 offset=offset+length_coords+size_int
3089 write(qunit,
'(a)')
'</Points>'
3092 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3093 '" NumberOfCells="',nc,
'">'
3094 write(qunit,
'(a)')
'<CellData>'
3097 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3098 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3099 write(qunit,
'(a)')
'</DataArray>'
3100 offset=offset+lengthcc+size_int
3103 do iw=nw+1,nw+nwauxio
3104 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3105 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3106 write(qunit,
'(a)')
'</DataArray>'
3107 offset=offset+lengthcc+size_int
3110 write(qunit,
'(a)')
'</CellData>'
3111 write(qunit,
'(a)')
'<Points>'
3112 write(qunit,
'(a,i16,a)') &
3113 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3116 offset=offset+length_coords+size_int
3117 write(qunit,
'(a)')
'</Points>'
3119 write(qunit,
'(a)')
'<Cells>'
3121 write(qunit,
'(a,i16,a)')&
3122 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',&
3124 offset=offset+length_conn+size_int
3126 write(qunit,
'(a,i16,a)') &
3127 '<DataArray type="Int32" Name="offsets" format="appended" offset="',&
3129 offset=offset+length_offsets+size_int
3131 write(qunit,
'(a,i16,a)') &
3132 '<DataArray type="Int32" Name="types" format="appended" offset="',&
3134 offset=offset+size_length+nc*size_int
3135 write(qunit,
'(a)')
'</Cells>'
3136 write(qunit,
'(a)')
'</Piece>'
3143 write(qunit,
'(a)')
'</UnstructuredGrid>'
3144 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
3146 open(qunit,file=filename,form=
'unformatted',access=
'stream',status=
'old',position=
'append')
3148 write(qunit) trim(buffer)
3152 do iigrid=1,igridstail; igrid=igrids(iigrid);
3157 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3160 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3163 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3164 n3grid=nint(zlength/d3grid)
3169 ixglo1,ixglo2,ixghi1,ixghi2,ps(igrid)%w,ps(igrid)%x)
3173 do ix3=ixglo1,ixghi1
3174 w(ixglo1:ixghi1,ixglo2:ixghi2,ix3,1:nw)=ps(igrid)%w(ixglo1:ixghi1,&
3178 call calc_grid23(qunit,igrid,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
3179 ixcmin1,ixcmin2,ixcmin3,ixcmax1,ixcmax2,ixcmax3,ixccmin1,ixccmin2,&
3180 ixccmin3,ixccmax1,ixccmax2,ixccmax3,.true.,i3grid,d3grid,w,zlength,zgridsc)
3186 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3187 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3189 write(qunit) lengthcc
3190 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3191 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3196 do iw=nw+1,nw+nwauxio
3200 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3201 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3203 write(qunit) lengthcc
3204 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3205 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3210 write(qunit) length_coords
3211 do ix3=ixcmin3,ixcmax3
3212 do ix2=ixcmin2,ixcmax2
3213 do ix1=ixcmin1,ixcmax1
3215 x_vtk(1:3)=xc_tmp(ix1,ix2,ix3,1:3)*normconv(0);
3217 write(qunit) real(x_vtk(k))
3222 write(qunit) length_conn
3227 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3228 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3229 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3230 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3231 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3232 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3233 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3234 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3238 write(qunit) length_offsets
3240 write(qunit) icel*(2**3)
3243 write(qunit) size_int*nc
3245 write(qunit) vtk_type
3254 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
3256 write(qunit,
'(a)')
'</AppendedData>'
3257 write(qunit,
'(a)')
'</VTKFile>'
3271 integer,
intent(in) :: qunit
3273 double precision :: x_VTK(1:3)
3274 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC_TMP
3275 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC_TMP
3276 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC_TMP
3277 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC_TMP
3278 double precision,
dimension(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:nw&
+nwauxio) :: w
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 double precision :: normconv(0:nw+nwauxio)
3286 character(len=80):: filename
3287 character(len=name_len) :: wnamei(1:nw+nwauxio),xandwnamei(1:3+nw+nwauxio)
3288 character(len=1024) :: outfilehead
3290 integer :: size_length,recsep,k,iw
3291 integer :: length,lengthcc,offset_points,offset_cells, length_coords,&
3292 length_conn,length_offsets
3293 integer :: i3grid,n3grid
3294 double precision ::d3grid,zlengsc,zgridsc
3296 character(len=6):: bufform
3297 double precision :: zlength
3301 if(
mype==0) print *,
'unstructuredvtkBsym23 not parallel, use vtumpi'
3302 call mpistop(
'npe>1, unstructuredvtkBsym23')
3309 inquire(qunit,opened=fileopen)
3310 if(.not.fileopen)
then
3314 open(qunit,file=filename,status=
'unknown')
3319 write(qunit,
'(a)')
'<?xml version="1.0"?>'
3320 write(qunit,
'(a)',advance=
'no')
'<VTKFile type="UnstructuredGrid"'
3321 write(qunit,
'(a)')
' version="0.1" byte_order="LittleEndian">'
3322 write(qunit,
'(a)')
'<UnstructuredGrid>'
3323 write(qunit,
'(a)')
'<FieldData>'
3324 write(qunit,
'(2a)')
'<DataArray type="Float32" Name="TIME" ',&
3325 'NumberOfTuples="1" format="ascii">'
3327 write(qunit,
'(a)')
'</DataArray>'
3328 write(qunit,
'(a)')
'</FieldData>'
3331 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3332 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3337 lengthcc=nc*size_real
3339 length_coords=3*length
3340 length_conn=2**3*size_int*nc
3341 length_offsets=nc*size_int
3347 zlength=zlengsc*(xprobmax1-xprobmin1)
3350 do iigrid=1,igridstail; igrid=igrids(iigrid);
3355 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3358 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3361 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3362 n3grid=nint(zlength/d3grid)
3368 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3369 '" NumberOfCells="',nc,
'">'
3370 write(qunit,
'(a)')
'<PointData>'
3373 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3374 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3375 write(qunit,
'(a)')
'</DataArray>'
3376 offset=offset+length+size_length
3379 do iw=nw+1,nw+nwauxio
3380 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3381 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3382 write(qunit,
'(a)')
'</DataArray>'
3383 offset=offset+length+size_length
3386 write(qunit,
'(a)')
'</PointData>'
3387 write(qunit,
'(a)')
'<Points>'
3388 write(qunit,
'(a,i16,a)') &
3389 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3392 offset=offset+length_coords+size_length
3393 write(qunit,
'(a)')
'</Points>'
3396 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3397 '" NumberOfCells="',nc,
'">'
3398 write(qunit,
'(a)')
'<CellData>'
3401 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3402 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3403 write(qunit,
'(a)')
'</DataArray>'
3404 offset=offset+lengthcc+size_length
3407 do iw=nw+1,nw+nwauxio
3408 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3409 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3410 write(qunit,
'(a)')
'</DataArray>'
3411 offset=offset+lengthcc+size_length
3414 write(qunit,
'(a)')
'</CellData>'
3416 write(qunit,
'(a)')
'<Points>'
3417 write(qunit,
'(a,i16,a)') &
3418 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3421 offset=offset+length_coords+size_length
3422 write(qunit,
'(a)')
'</Points>'
3424 write(qunit,
'(a)')
'<Cells>'
3426 write(qunit,
'(a,i16,a)')&
3427 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',&
3429 offset=offset+length_conn+size_length
3431 write(qunit,
'(a,i16,a)') &
3432 '<DataArray type="Int32" Name="offsets" format="appended" offset="',&
3434 offset=offset+length_offsets+size_length
3436 write(qunit,
'(a,i16,a)') &
3437 '<DataArray type="Int32" Name="types" format="appended" offset="',&
3439 offset=offset+size_length+nc*size_int
3440 write(qunit,
'(a)')
'</Cells>'
3441 write(qunit,
'(a)')
'</Piece>'
3447 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3448 '" NumberOfCells="',nc,
'">'
3449 write(qunit,
'(a)')
'<PointData>'
3452 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3453 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3454 write(qunit,
'(a)')
'</DataArray>'
3455 offset=offset+length+size_length
3458 do iw=nw+1,nw+nwauxio
3459 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3460 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3461 write(qunit,
'(a)')
'</DataArray>'
3462 offset=offset+length+size_length
3465 write(qunit,
'(a)')
'</PointData>'
3466 write(qunit,
'(a)')
'<Points>'
3467 write(qunit,
'(a,i16,a)') &
3468 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3471 offset=offset+length_coords+size_length
3472 write(qunit,
'(a)')
'</Points>'
3475 write(qunit,
'(a,i7,a,i7,a)')
'<Piece NumberOfPoints="',np,&
3476 '" NumberOfCells="',nc,
'">'
3477 write(qunit,
'(a)')
'<CellData>'
3480 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3481 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3482 write(qunit,
'(a)')
'</DataArray>'
3483 offset=offset+lengthcc+size_length
3486 do iw=nw+1,nw+nwauxio
3487 write(qunit,
'(a,a,a,i16,a)')
'<DataArray type="Float32" Name="',&
3488 trim(wnamei(iw)),
'" format="appended" offset="',offset,
'">'
3489 write(qunit,
'(a)')
'</DataArray>'
3490 offset=offset+lengthcc+size_length
3493 write(qunit,
'(a)')
'</CellData>'
3494 write(qunit,
'(a)')
'<Points>'
3495 write(qunit,
'(a,i16,a)') &
3496 '<DataArray type="Float32" NumberOfComponents="3" format="appended" offset="',&
3499 offset=offset+length_coords+size_length
3500 write(qunit,
'(a)')
'</Points>'
3502 write(qunit,
'(a)')
'<Cells>'
3504 write(qunit,
'(a,i16,a)')&
3505 '<DataArray type="Int32" Name="connectivity" format="appended" offset="',&
3507 offset=offset+length_conn+size_length
3509 write(qunit,
'(a,i16,a)') &
3510 '<DataArray type="Int32" Name="offsets" format="appended" offset="',&
3512 offset=offset+length_offsets+size_length
3514 write(qunit,
'(a,i16,a)') &
3515 '<DataArray type="Int32" Name="types" format="appended" offset="',&
3517 offset=offset+size_length+nc*size_int
3518 write(qunit,
'(a)')
'</Cells>'
3519 write(qunit,
'(a)')
'</Piece>'
3527 write(qunit,
'(a)')
'</UnstructuredGrid>'
3528 write(qunit,
'(a)')
'<AppendedData encoding="raw">'
3530 open(qunit,file=filename,form=
'unformatted',access=
'stream',status=
'old',position=
'append')
3532 write(qunit) trim(buffer)
3535 do iigrid=1,igridstail; igrid=igrids(iigrid);
3540 if ((
rnode(rpxmin1_,igrid)>=xprobmin1+(xprobmax1-xprobmin1)&
3543 .and.(
rnode(rpxmax1_,igrid)<=xprobmax1-(xprobmax1-xprobmin1)&
3546 d3grid=zgridsc*(
rnode(rpxmax1_,igrid)-
rnode(rpxmin1_,igrid))
3547 n3grid=nint(zlength/d3grid)
3552 ixglo1,ixglo2,ixghi1,ixghi2,ps(igrid)%w,ps(igrid)%x)
3556 do ix3=ixglo1,ixghi1
3557 w(ixglo1:ixghi1,ixglo2:ixghi2,ix3,1:nw)=ps(igrid)%w(ixglo1:ixghi1,&
3561 call calc_grid23(qunit,igrid,xc_tmp,xcc_tmp,wc_tmp,wcc_tmp,normconv,&
3562 ixcmin1,ixcmin2,ixcmin3,ixcmax1,ixcmax2,ixcmax3,ixccmin1,ixccmin2,&
3563 ixccmin3,ixccmax1,ixccmax2,ixccmax3,.true.,i3grid,d3grid,w,zlength,zgridsc)
3570 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3571 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3573 write(qunit) lengthcc
3574 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3575 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3580 do iw=nw+1,nw+nwauxio
3584 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3585 =ixcmin1,ixcmax1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3587 write(qunit) lengthcc
3588 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3589 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3594 write(qunit) length_coords
3595 do ix3=ixcmin3,ixcmax3
3596 do ix2=ixcmin2,ixcmax2
3597 do ix1=ixcmin1,ixcmax1
3599 x_vtk(1:3)=xc_tmp(ix1,ix2,ix3,1:3)*normconv(0);
3601 write(qunit) real(x_vtk(k))
3606 write(qunit) length_conn
3611 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3612 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3613 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3614 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3615 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3616 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3617 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3618 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3622 write(qunit) length_offsets
3624 write(qunit) icel*(2**3)
3627 write(qunit) size_int*nc
3629 write(qunit) vtk_type
3635 if(iw==2 .or. iw==4 .or. iw==7)
then
3636 wc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,iw)=&
3637 -wc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,iw)
3638 wcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,iw)=&
3639 -wcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,iw)
3644 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3645 =ixcmax1,ixcmin1,-1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3647 write(qunit) lengthcc
3648 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3649 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3654 do iw=nw+1,nw+nwauxio
3658 write(qunit) (((real(wc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3659 =ixcmax1,ixcmin1,-1),ix2=ixcmin2,ixcmax2),ix3=ixcmin3,ixcmax3)
3661 write(qunit) lengthcc
3662 write(qunit) (((real(wcc_tmp(ix1,ix2,ix3,iw)*normconv(iw)),ix1&
3663 =ixccmin1,ixccmax1),ix2=ixccmin2,ixccmax2),ix3&
3668 write(qunit) length_coords
3669 do ix3=ixcmin3,ixcmax3
3670 do ix2=ixcmin2,ixcmax2
3671 do ix1=ixcmax1,ixcmin1,-1
3673 x_vtk(1:3)=xc_tmp(ix1,ix2,ix3,1:3)*normconv(0);
3676 write(qunit) real(x_vtk(k))
3681 write(qunit) length_conn
3686 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3687 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3688 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3689 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3690 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3691 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3692 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3693 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3697 write(qunit) length_offsets
3699 write(qunit) icel*(2**3)
3702 write(qunit) size_int*nc
3704 write(qunit) vtk_type
3713 open(qunit,file=filename,status=
'unknown',form=
'formatted',position=
'append')
3714 write(qunit,
'(a)')
'</AppendedData>'
3715 write(qunit,
'(a)')
'</VTKFile>'
3720 subroutine calc_grid23(qunit,igrid,xC_TMP,xCC_TMP,wC_TMP,wCC_TMP,normconv,&
3721 ixCmin1,ixCmin2,ixCmin3,ixCmax1,ixCmax2,ixCmax3,ixCCmin1,ixCCmin2,ixCCmin3,&
3722 ixCCmax1,ixCCmax2,ixCCmax3,first,i3grid,d3grid,w,zlength,zgridsc)
3730 integer,
intent(in) :: qunit, igrid,i3grid
3731 logical,
intent(in) :: first
3733 integer :: nx1,nx2,nx3, nxC1,nxC2,nxC3, ix1,ix2,ix3, ix, iw, level, idir
3734 integer :: ixCmin1,ixCmin2,ixCmin3,ixCmax1,ixCmax2,ixCmax3,ixCCmin1,&
3735 ixCCmin2,ixCCmin3,ixCCmax1,ixCCmax2,ixCCmax3,nxCC1,nxCC2,nxCC3
3736 double precision :: dx1,dx2,dx3,d3grid,zlength,zgridsc
3737 integer :: idims,jxCmin1,jxCmin2,jxCmin3,jxCmax1,jxCmax2,jxCmax3
3738 double precision :: ldw(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1),&
3739 dwC(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1)
3740 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC
3741 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC
3742 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC
3743 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC
3744 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,3) :: xC_TMP
3745 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,&
3) :: xCC_TMP
3746 double precision,
dimension(ixMlo1-1:ixMhi1,ixMlo2-1:ixMhi2,ixMlo1&
-1:ixMhi1,nw+nwauxio) :: wC_TMP
3747 double precision,
dimension(ixMlo1:ixMhi1,ixMlo2:ixMhi2,ixMlo1:ixMhi1,nw&
+nwauxio) :: wCC_TMP
3748 double precision,
dimension(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:nw&
+nwauxio) :: w
3749 double precision,
dimension(0:nw+nwauxio) :: normconv
3750 logical,
save :: subfirst=.true.
3753 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3755 dx1=
dx(1,level);dx2=
dx(2,level);dx3=zgridsc*
dx(1,level);
3770 nxcc1=nx1;nxcc2=nx2;nxcc3=nx3;
3771 ixccmin1=ixmlo1;ixccmin2=ixmlo2;ixccmin3=ixmlo1; ixccmax1=ixmhi1
3772 ixccmax2=ixmhi2;ixccmax3=ixmhi1;
3773 do ix=ixccmin1,ixccmax1
3774 xcc(ix,ixccmin2:ixccmax2,ixccmin3:ixccmax3,1)=
rnode(rpxmin1_,igrid)&
3775 +(dble(ix-ixccmin1)+half)*dx1
3777 do ix=ixccmin2,ixccmax2
3778 xcc(ixccmin1:ixccmax1,ix,ixccmin3:ixccmax3,2)=
rnode(rpxmin2_,igrid)&
3779 +(dble(ix-ixccmin2)+half)*dx2
3781 do ix=ixccmin3,ixccmax3
3782 xcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ix,3)=-zlength/two+&
3783 dble(i3grid-1)*d3grid+(dble(ix-ixccmin3)+half)*dx3
3787 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3788 ixcmin1=ixmlo1-1;ixcmin2=ixmlo2-1;ixcmin3=ixmlo1-1; ixcmax1=ixmhi1
3789 ixcmax2=ixmhi2;ixcmax3=ixmhi1;
3790 do ix=ixcmin1,ixcmax1
3791 xc(ix,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1)=
rnode(rpxmin1_,igrid)&
3792 +dble(ix-ixcmin1)*dx1
3794 do ix=ixcmin2,ixcmax2
3795 xc(ixcmin1:ixcmax1,ix,ixcmin3:ixcmax3,2)=
rnode(rpxmin2_,igrid)&
3796 +dble(ix-ixcmin2)*dx2
3798 do ix=ixcmin3,ixcmax3
3799 xc(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ix,3)=-zlength/two+&
3800 dble(i3grid-1)*d3grid+dble(ix-ixcmin3)*dx3
3810 jxcmin1=ixghi1+1-
nghostcells;jxcmin2=ixglo2;jxcmin3=ixglo1;
3811 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixghi1;
3812 do ix1=jxcmin1,jxcmax1
3813 w(ix1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw) = w(jxcmin1&
3814 -1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3816 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixglo1;
3817 jxcmax1=ixglo1-1+
nghostcells;jxcmax2=ixghi2;jxcmax3=ixghi1;
3818 do ix1=jxcmin1,jxcmax1
3819 w(ix1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw) = w(jxcmax1&
3820 +1,jxcmin2:jxcmax2,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3823 jxcmin1=ixglo1;jxcmin2=ixghi2+1-
nghostcells;jxcmin3=ixglo1;
3824 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixghi1;
3825 do ix2=jxcmin2,jxcmax2
3826 w(jxcmin1:jxcmax1,ix2,jxcmin3:jxcmax3,nw-nwextra+1:nw) &
3827 = w(jxcmin1:jxcmax1,jxcmin2-1,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3829 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixglo1;
3830 jxcmax1=ixghi1;jxcmax2=ixglo2-1+
nghostcells;jxcmax3=ixghi1;
3831 do ix2=jxcmin2,jxcmax2
3832 w(jxcmin1:jxcmax1,ix2,jxcmin3:jxcmax3,nw-nwextra+1:nw) &
3833 = w(jxcmin1:jxcmax1,jxcmax2+1,jxcmin3:jxcmax3,nw-nwextra+1:nw)
3836 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixghi1+1-
nghostcells;
3837 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixghi1;
3838 do ix3=jxcmin3,jxcmax3
3839 w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,ix3,nw-nwextra+1:nw) &
3840 = w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,jxcmin3-1,nw-nwextra+1:nw)
3842 jxcmin1=ixglo1;jxcmin2=ixglo2;jxcmin3=ixglo1;
3843 jxcmax1=ixghi1;jxcmax2=ixghi2;jxcmax3=ixglo1-1+
nghostcells;
3844 do ix3=jxcmin3,jxcmax3
3845 w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,ix3,nw-nwextra+1:nw) &
3846 = w(jxcmin1:jxcmax1,jxcmin2:jxcmax2,jxcmax3+1,nw-nwextra+1:nw)
3861 +1,ixglo2+1,ixglo1+1,ixghi1-1,ixghi2-1,ixghi1-1,w,xcc,normconv)
3866 wcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,:)=w(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,:)
3868 do ix3=ixccmin3,ixccmax3
3869 do ix2=ixccmin2,ixccmax2
3870 do ix1=ixccmin1,ixccmax1
3871 wcc(ix1,ix2,ix3,iw_mag(:))=wcc(ix1,ix2,ix3,iw_mag(:))+ps(igrid)%B0(ix1,ix2,&
3878 do ix3=ixccmin3,ixccmax3
3879 do ix2=ixccmin2,ixccmax2
3880 do ix1=ixccmin1,ixccmax1
3881 wcc(ix1,ix2,ix3,iw_e)=w(ix1,ix2,ix3,iw_e) +half*sum(ps(igrid)%B0(ix1,&
3882 ix2,:,0)**2 ) + sum(w(ix1,ix2,ix3,&
3883 iw_mag(:))*ps(igrid)%B0(ix1,ix2,:,0))
3893 if (
b0field.and.iw>iw_mag(1)-1.and.iw<=iw_mag(
ndir))
then
3895 do ix3=ixcmin3,ixcmax3
3896 do ix2=ixcmin2,ixcmax2
3897 do ix1=ixcmin1,ixcmax1
3898 wc(ix1,ix2,ix3,iw)=sum(w(ix1:ix1+1,ix2:ix2+1,ix3,iw) &
3899 +ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3900 ,idir,0))/dble(2**3)+&
3901 sum(w(ix1:ix1+1,ix2:ix2+1,ix3+1,iw) &
3902 +ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3903 ,idir,0))/dble(2**3)
3908 do ix3=ixcmin3,ixcmax3
3909 do ix2=ixcmin2,ixcmax2
3910 do ix1=ixcmin1,ixcmax1
3911 wc(ix1,ix2,ix3,iw)=sum(w(ix1:ix1+1,ix2:ix2+1,ix3:ix3&
3919 do ix3=ixcmin3,ixcmax3
3920 do ix2=ixcmin2,ixcmax2
3921 do ix1=ixcmin1,ixcmax1
3922 wc(ix1,ix2,ix3,iw_e)=sum( w(ix1:ix1+1,ix2:ix2+1,ix3,iw_e) &
3923 +half*sum(ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3924 ,:,0)**2,dim=
ndim+1) + sum( w(ix1:ix1+1,ix2:ix2+1,ix3&
3925 ,iw_mag(:))*ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3926 ,:,0),dim=
ndim+1) ) /dble(2**3)+&
3927 sum( w(ix1:ix1+1,ix2:ix2+1,ix3+1,iw_e) &
3928 +half*sum(ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3929 ,:,0)**2,dim=
ndim+1) + sum( w(ix1:ix1+1,ix2:ix2+1,ix3&
3930 +1,iw_mag(:))*ps(igrid)%B0(ix1:ix1+1,ix2:ix2+1&
3931 ,:,0),dim=
ndim+1) ) /dble(2**3)
3938 xc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:3) &
3939 = xc(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:3)
3940 wc_tmp(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:nw&
3941 +
nwauxio) = wc(ixcmin1:ixcmax1,ixcmin2:ixcmax2,ixcmin3:ixcmax3,1:nw&
3943 xcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,&
3944 1:3) = xcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,&
3945 ixccmin3:ixccmax3,1:3)
3946 wcc_tmp(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,1:nw&
3947 +
nwauxio) = wcc(ixccmin1:ixccmax1,ixccmin2:ixccmax2,ixccmin3:ixccmax3,&
3956 integer,
intent(in) :: qunit, igrid
3958 integer :: nx1,nx2,nx3, nxC1,nxC2,nxC3, ix1,ix2,ix3
3960 nx1=ixmhi1-ixmlo1+1;nx2=ixmhi2-ixmlo2+1;nx3=ixmhi1-ixmlo1+1;
3961 nxc1=nx1+1;nxc2=nx2+1;nxc3=nx3+1;
3965 write(qunit,
'(8(i7,1x))')&
3966 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1-1, &
3967 (ix3-1)*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3968 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3969 (ix3-1)*nxc2*nxc1+ ix2*nxc1+ix1,&
3970 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1-1,&
3971 ix3*nxc2*nxc1+(ix2-1)*nxc1+ix1,&
3972 ix3*nxc2*nxc1+ ix2*nxc1+ix1-1,&
3973 ix3*nxc2*nxc1+ ix2*nxc1+ix1
3981 ixImax3,ixOmin1,ixOmin2,ixOmin3,ixOmax1,ixOmax2,ixOmax3,w,x,normconv)
3989 integer,
intent(in) :: ixImin1,ixImin2,ixImin3,ixImax1,ixImax2,&
3990 ixImax3,ixOmin1,ixOmin2,ixOmin3,ixOmax1,ixOmax2,ixOmax3
3991 double precision,
intent(in) :: x(ixImin1:ixImax1,ixImin2:ixImax2,&
3992 ixImin3:ixImax3,1:3)
3993 double precision :: w(ixImin1:ixImax1,ixImin2:ixImax2,&
3994 ixImin3:ixImax3,nw+nwauxio)
3995 double precision :: normconv(0:nw+nwauxio)
3997 double precision :: qvec(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:ndir),&
3998 curlvec(ixGlo1:ixGhi1,ixGlo2:ixGhi2,ixGlo1:ixGhi1,1:ndir)
4026 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
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.
double precision, dimension(ndim, 2) writespshift
logical, dimension(:), allocatable w_write
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.
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.
integer, parameter unitconvert
integer, dimension(:,:), allocatable node
double precision, dimension(ndim) dxlevel
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