Writes grid attributes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(silo_obj), | intent(inout) | :: | this |
A silo object |
||
| character(len=*), | intent(in) | :: | mesh_name |
Mesh name |
||
| real(kind=wp), | intent(in) | :: | x1(:) |
x1-axis |
||
| real(kind=wp), | intent(in) | :: | x2(:) |
x2-axis |
||
| real(kind=wp), | intent(in) | :: | x3(:) |
x3-axis |
||
| integer, | intent(in) | :: | iter |
Iteration at write |
||
| real(kind=wp), | intent(in) | :: | time |
Time at write |
impure subroutine silo_obj_WriteGrid(this,mesh_name,x1,x2,x3,iter,time) !> Writes grid attributes. implicit none class(silo_obj), intent(inout) :: this !! A silo object character(len=*),intent(in) :: mesh_name !! Mesh name real(wp), intent(in) :: x1(:) !! x1-axis real(wp), intent(in) :: x2(:) !! x2-axis real(wp), intent(in) :: x3(:) !! x3-axis integer, intent(in) :: iter !! Iteration at write real(wp), intent(in) :: time !! Time at write ! Work variables integer :: ierr,status character(len=SILOstr), allocatable :: names(:) integer, allocatable :: lnames(:),types(:) integer :: i,n,optlist integer :: Ng(3) Ng = [size(x1),size(x2),size(x3)] ! Write using poor man's IO: sequential (serial) writes among a silo group do n=1,this%nproc_node if (n.eq.this%silo_rank) then ! Open database ierr=DBopen(this%siloname,len_trim(this%siloname),SILOdriver,DB_APPEND,this%fid_DAT) ! Switch to appropriate directory ierr = DBsetdir(this%fid_DAT,this%dirname,len_trim(this%dirname)) ! Write your portion of grid ierr = dbputqm(this%fid_DAT,mesh_name,len_trim(mesh_name),"x1",2,"x2",2,"x3",2, & real(x1,leapSP), real(x2,leapSP), real(x3,leapSP), & Ng,3,DB_FLOAT,DB_COLLINEAR, DB_F77NULL, status) ! Close file so that next silo_rank can open it ierr =DBclose(this%fid_DAT) if (ierr.ne.0) call this%parallel%Stop('Error closing SILO file') end if ! Synchronize SILO ranks call MPI_BARRIER(this%silo_comm) end do ! Add mesh meta data allocate(names(this%parallel%nproc)) allocate(lnames(this%parallel%nproc)) allocate(types(this%parallel%nproc)) if (this%parallel%RankIsRoot()) then do i=1,this%parallel%nproc write(names(i), '(2A,I5.5,2A,I5.5,2A)') trim(adjustl(this%filename)),'_g_',& this%group_ids(i),SILO_EXTENSION,':',mod(i-1,this%nproc_node)+1,'/',mesh_name lnames(i)=len_trim(names(i)) types(i)=DB_QUAD_RECT end do ierr = DBmkoptlist(2,optlist) ierr = DBaddiopt(optlist,DBOPT_DTIME,time) ierr = DBaddiopt(optlist,DBOPT_CYCLE,iter) ierr = DBputmmesh(this%fid_VDB, mesh_name, len_trim(mesh_name), this%parallel%nproc,names,lnames,types,optlist,ierr) ierr = DBfreeoptlist(optlist) end if return end subroutine silo_obj_WriteGrid