get all variables names
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=name_len) | :: | wnamei(1:nw+nwauxio) | ||||
| character(len=name_len) | :: | xandwnamei(1:ndim+nw+nwauxio) | ||||
| character(len=1024) | :: | outfilehead |
subroutine getheadernames(wnamei,xandwnamei,outfilehead) ! this collects all variables names in the wnamei character array, getting the info from ! the prim_wnames/cons_wnames strings (depending on saveprim). It combines this info with names ! for the dimensional directions in the xandwnamei array. In the outfilehead, it collects ! the dimensional names, and only those names from the nw variables for output (through w_write) ! together with the added names for nwauxio variables use mod_usr_methods, only: usr_add_aux_names use mod_global_parameters use mod_geometry use mod_comm_lib, only: mpistop character(len=name_len) :: wnamei(1:nw+nwauxio),& xandwnamei(1:ndim+nw+nwauxio) character(len=1024) :: outfilehead integer:: space_position,iw,ind character(len=name_len):: wname character(len=std_len):: aux_variable_names character(len=std_len):: scanstring logical, save:: first=.true. ! in case additional variables are computed and stored for output if (nwauxio>0) then if (.not. associated(usr_add_aux_names)) then call mpistop("usr_add_aux_names not defined") else call usr_add_aux_names(aux_variable_names) end if end if ! --- part to provide variable names from prim_wnames/cons_wnames strings if(saveprim) then scanstring=TRIM(aux_variable_names) wnamei(1:nw)=prim_wnames(1:nw) else scanstring=TRIM(aux_variable_names) wnamei(1:nw)=cons_wnames(1:nw) endif space_position=index(scanstring,' ') do iw=nw+1,nw+nwauxio do while (space_position==1) scanstring=scanstring(2:) space_position=index(scanstring,' ') enddo wname=scanstring(:space_position-1) scanstring=scanstring(space_position+1:) space_position=index(scanstring,' ') ! fill all names, even those that we will not write away from the first nw wnamei(iw)=TRIM(wname) enddo ! --- end of part to provide variable names select case (coordinate) case( spherical ) xandwnamei(1)="r"; xandwnamei(2)="Theta"; xandwnamei(3)="Phi" case( cylindrical ) xandwnamei(1)="R"; if( phi_ == 2 )then xandwnamei(2)="Phi" else xandwnamei(2)="Z" endif if( phi_ == 2 )then xandwnamei(3)="Z" else xandwnamei(3)="Phi" endif case default xandwnamei(1)="X"; xandwnamei(2)="Y"; xandwnamei(3)="Z" end select xandwnamei(ndim+1:ndim+nw+nwauxio)=wnamei(1:nw+nwauxio) ! in outfilehead, collect the dimensional names, and all output variable names ! first all dimensions write(outfilehead,'(a)') TRIM(xandwnamei(1)) do iw=2,ndim wname=xandwnamei(iw) write(outfilehead,'(a)')outfilehead(1:len_trim(outfilehead))//" "//TRIM(& wname) enddo ! then all nw variables, with w_write control for inclusion do iw=ndim+1,ndim+nw wname=xandwnamei(iw) if(w_write(iw-ndim)) then write(outfilehead,'(a)')outfilehead(1:len_trim(outfilehead))//" "//TRIM(& wname) endif enddo ! then all nwauxio variables if(nwauxio>0) then do iw=ndim+nw+1,ndim+nw+nwauxio wname=xandwnamei(iw) write(outfilehead,'(a)')outfilehead(1:len_trim(outfilehead))//" "//TRIM(& wname) enddo endif if(first.and.mype==0)then print*,'-------------------------------------------------------------------------------' write(unitterm,*& )'Saving visual data. Coordinate directions and variable names are:' ind=0 do iw=1,ndim ind=ind+1 print *,ind,xandwnamei(iw) enddo do iw=1+ndim,nw+ndim if(w_write(iw-ndim)) then ind=ind+1 write(*,*) ind,wnamei(iw-ndim) end if end do do iw=ndim+nw+1,ndim+nw+nwauxio ind=ind+1 print *,ind,wnamei(iw-ndim) enddo write(unitterm,*)'time =', global_time print*,'-------------------------------------------------------------------------------' first=.false. endif end subroutine getheadernames