64 TYPE(t_region
),
POINTER :: regions(:)
67 INTEGER ::
i, icont, ipatch, ireg
70 CHARACTER(CHRLEN+17) :: fname
71 CHARACTER(CHRLEN) :: rcsidentstring,
msg, timestring
74 INTEGER ::
status(mpi_status_size)
76 INTEGER,
PARAMETER :: one = 1
77 INTEGER :: bctype, errorflag, ilev, iregfile,
n, n1, n2, naiv, narv, &
78 ncont, ncv, ncvtile, ndimp, ndimt, ndvtile, npcls, nidnumberp
79 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: ndimplag
80 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: nextidnumber
81 INTEGER,
ALLOCATABLE,
DIMENSION(:,:) :: aivfile, ivar
82 INTEGER,
POINTER,
DIMENSION(:) :: pcvplagmass, pcvtilemass
83 INTEGER,
POINTER,
DIMENSION(:,:) :: paiv
85 REAL(RFREAL),
ALLOCATABLE,
DIMENSION(:,:) :: arvfile, cvfile, dvfile, rvar
86 REAL(RFREAL),
POINTER,
DIMENSION(:,:) :: parv, pcv, pcvtile, pdvtile
88 TYPE(t_patch),
POINTER :: ppatch
89 TYPE(t_plag),
POINTER :: pplag
95 rcsidentstring =
'$RCSfile: PLAG_WriteSolution.F90,v $ $Revision: 1.6 $'
97 global => regions(1)%global
100 'PLAG_WriteSolution.F90' )
102 IF (.NOT. (global%plagUsed .eqv. .true.))
THEN
103 IF (global%myProcid == masterproc)
THEN
104 WRITE(stdout,
'(A,3X,A)') solver_name,
'Warning: PLAG seems to be OFF.'
109 IF ( global%myProcid == masterproc .AND. &
110 global%verbLevel > verbose_none )
THEN
111 WRITE(stdout,
'(A,3X,A)') solver_name,
'Writing PLAG solution file...'
116 ALLOCATE( ivar(3,1),stat=errorflag )
117 global%error = errorflag
118 IF (global%error /= err_none)
THEN
119 CALL
errorstop( global,err_allocate,__line__,
'ivar' )
122 ALLOCATE( rvar(1,1),stat=errorflag )
123 global%error = errorflag
124 IF (global%error /= err_none)
THEN
125 CALL
errorstop( global,err_allocate,__line__,
'rvar' )
128 ALLOCATE( ndimplag(global%nRegions),stat=errorflag )
129 global%error = errorflag
130 IF (global%error /= err_none)
THEN
131 CALL
errorstop( global,err_allocate,__line__,
'nDimPlag' )
134 ALLOCATE( nextidnumber(global%nRegions),stat=errorflag )
135 global%error = errorflag
136 IF (global%error /= err_none)
THEN
137 CALL
errorstop( global,err_allocate,__line__,
'nextIdNumber' )
145 IF (global%myProcid == masterproc)
THEN
147 IF (global%solutFormat == format_ascii)
THEN
148 WRITE(fname,
'(A,1PE11.5)') &
149 trim(global%outDir)//trim(global%casename)//
'.plag_sola_',global%currentTime
150 OPEN(if_solut,file=fname,
form=
'formatted',
status=
'unknown',iostat=errorflag)
151 ELSE IF (global%solutFormat == format_binary)
THEN
152 WRITE(fname,
'(A,1PE11.5)') &
153 trim(global%outDir)//trim(global%casename)//
'.plag_solb_', global%currentTime
154 OPEN(if_solut,file=fname,
form=
'unformatted',
status=
'unknown',iostat=errorflag)
157 global%error = errorflag
158 IF (global%error /= err_none)
THEN
159 CALL
errorstop( global,err_file_open,__line__,
'File: '//trim(fname) )
163 rvar(1,1) = global%currentTime
167 IF (global%myProcid == masterproc)
THEN
174 DO ireg=1,global%nRegions
178 ilev = regions(ireg)%currLevel
180 IF ( global%myProcid == masterproc )
THEN
181 ndimplag(ireg) = regions(ireg)%levels(ilev)%plag%nPcls
184 IF ( regions(ireg)%procid /= masterproc )
THEN
185 CALL mpi_recv( ndimplag(ireg),1,mpi_integer, &
186 regions(ireg)%procid,ireg, &
187 global%mpiComm,
status,global%mpierr )
188 IF ( global%mpierr /= err_none )
THEN
189 CALL
errorstop( global,err_mpi_trouble,__line__ )
195 ndimp = regions(ireg)%levels(ilev)%plag%nPcls
198 IF ( regions(ireg)%procid == global%myProcid )
THEN
199 CALL mpi_send( ndimp,1,mpi_integer,masterproc,ireg, &
200 global%mpiComm,global%mpierr )
201 IF ( global%mpierr /= err_none )
THEN
202 CALL
errorstop( global,err_mpi_trouble,__line__ )
214 CALL mpi_bcast( ndimplag,global%nRegions,mpi_integer,masterproc, &
215 global%mpiComm,global%mpierr )
216 IF ( global%mpierr /= err_none )
THEN
217 CALL
errorstop( global,err_mpi_trouble,__line__ )
224 DO ireg=1,global%nRegions
228 ilev = regions(ireg)%currLevel
230 IF ( global%myProcid == masterproc )
THEN
231 nextidnumber(ireg) = regions(ireg)%levels(ilev)%plag%nextIdNumber
234 IF ( regions(ireg)%procid /= masterproc )
THEN
235 CALL mpi_recv( nextidnumber(ireg),1,mpi_integer, &
236 regions(ireg)%procid,ireg, &
237 global%mpiComm,
status,global%mpierr )
238 IF ( global%mpierr /= err_none )
THEN
239 CALL
errorstop( global,err_mpi_trouble,__line__ )
245 nidnumberp = regions(ireg)%levels(ilev)%plag%nextIdNumber
248 IF ( regions(ireg)%procid == global%myProcid )
THEN
249 CALL mpi_send( nidnumberp,1,mpi_integer,masterproc,ireg, &
250 global%mpiComm,global%mpierr )
251 IF ( global%mpierr /= err_none )
THEN
252 CALL
errorstop( global,err_mpi_trouble,__line__ )
264 CALL mpi_bcast( nextidnumber,global%nRegions,mpi_integer,masterproc, &
265 global%mpiComm,global%mpierr )
266 IF ( global%mpierr /= err_none )
THEN
267 CALL
errorstop( global,err_mpi_trouble,__line__ )
273 DO ireg=1,global%nRegions
277 ilev = regions(ireg)%currLevel
278 ncont = regions(ireg)%plagInput%nCont
281 ncv = cv_plag_last+ncont
282 ndimp = ndimplag(ireg)
286 pplag => regions(ireg)%levels(ilev)%plag
290 pcvplagmass => pplag%cvPlagMass
294 IF ( global%myProcid == masterproc )
THEN
296 ivar(2,1) = ndimplag(ireg)
297 ivar(3,1) = nextidnumber(ireg)
308 IF ( regions(ireg)%procid == global%myProcid .OR. &
309 global%myProcid==masterproc )
THEN
310 ALLOCATE( aivfile(naiv,ndimp),stat=errorflag )
311 global%error = errorflag
312 IF (global%error /= err_none)
THEN
313 CALL
errorstop( global,err_allocate,__line__,
'aivFile' )
319 IF ( regions(ireg)%procid == global%myProcid )
THEN
323 aivfile(1,
n) = paiv(aiv_plag_pidini,
i)
324 aivfile(2,
n) = paiv(aiv_plag_regini,
i)
325 aivfile(3,
n) = paiv(aiv_plag_regcrt,
i)
326 aivfile(4,
n) = paiv(aiv_plag_icells,
i)
327 aivfile(5,
n) = paiv(aiv_plag_indexi,
i)
328 aivfile(6,
n) = paiv(aiv_plag_indexj,
i)
329 aivfile(7,
n) = paiv(aiv_plag_indexk,
i)
330 aivfile(8,
n) = paiv(aiv_plag_burnstat,
i)
331 aivfile(9,
n) = paiv(aiv_plag_status,
i)
337 IF ( global%myProcid == masterproc )
THEN
339 IF ( regions(ireg)%procid /= masterproc )
THEN
340 CALL mpi_recv( aivfile,naiv*ndimp,mpi_integer, &
341 regions(ireg)%procid,ireg, &
342 global%mpiComm,
status,global%mpierr )
343 IF ( global%mpierr /= err_none )
THEN
344 CALL
errorstop( global,err_mpi_trouble,__line__ )
353 IF (regions(ireg)%procid == global%myProcid)
THEN
354 CALL mpi_send( aivfile,naiv*ndimp,mpi_integer,masterproc,ireg, &
355 global%mpiComm,global%mpierr )
356 IF ( global%mpierr /= err_none )
THEN
357 CALL
errorstop( global,err_mpi_trouble,__line__ )
365 IF (
ALLOCATED(aivfile) )
THEN
366 DEALLOCATE( aivfile,stat=errorflag )
367 global%error = errorflag
368 IF ( global%error /= err_none )
THEN
369 CALL
errorstop( global,err_deallocate,__line__,
'aivFile' )
375 IF ( regions(ireg)%procid == global%myProcid .OR. &
376 global%myProcid==masterproc )
THEN
377 ALLOCATE( arvfile(narv,ndimp),stat=errorflag )
378 global%error = errorflag
379 IF ( global%error /= err_none )
THEN
380 CALL
errorstop( global,err_allocate,__line__,
'arvFile' )
386 IF ( regions(ireg)%procid == global%myProcid )
THEN
390 arvfile(1,
n) = parv(arv_plag_spload,
i)
391 arvfile(2,
n) = parv(arv_plag_distot,
i)
397 IF ( global%myProcid == masterproc )
THEN
399 IF ( regions(ireg)%procid /= masterproc )
THEN
400 CALL mpi_recv( arvfile,narv*ndimp,mpi_rfreal, &
401 regions(ireg)%procid,ireg, &
402 global%mpiComm,
status,global%mpierr )
403 IF ( global%mpierr /= err_none )
THEN
404 CALL
errorstop( global,err_mpi_trouble,__line__ )
413 IF ( regions(ireg)%procid == global%myProcid )
THEN
414 CALL mpi_send( arvfile,narv*ndimp,mpi_rfreal,masterproc,ireg, &
415 global%mpiComm,global%mpierr )
416 IF ( global%mpierr /= err_none )
THEN
417 CALL
errorstop( global,err_mpi_trouble,__line__ )
425 IF (
ALLOCATED(arvfile) )
THEN
426 DEALLOCATE( arvfile,stat=errorflag )
427 global%error = errorflag
428 IF (global%error /= err_none)
THEN
429 CALL
errorstop( global,err_deallocate,__line__,
'arvFile' )
435 IF ( regions(ireg)%procid == global%myProcid .OR. &
436 global%myProcid==masterproc )
THEN
437 ALLOCATE( cvfile(ncv,ndimp),stat=errorflag )
438 global%error = errorflag
439 IF ( global%error /= err_none )
THEN
440 CALL
errorstop( global,err_allocate,__line__,
'cvFile' )
446 IF ( regions(ireg)%procid == global%myProcid )
THEN
450 cvfile(1,
n) = pcv(cv_plag_xmom,
i)
451 cvfile(2,
n) = pcv(cv_plag_ymom,
i)
452 cvfile(3,
n) = pcv(cv_plag_zmom,
i)
453 cvfile(4,
n) = pcv(cv_plag_ener,
i)
454 cvfile(5,
n) = pcv(cv_plag_xpos,
i)
455 cvfile(6,
n) = pcv(cv_plag_ypos,
i)
456 cvfile(7,
n) = pcv(cv_plag_zpos,
i)
457 cvfile(8,
n) = pcv(cv_plag_enervapor,
i)
459 cvfile(cv_plag_last+icont,
n) = pcv(pcvplagmass(icont),
i)
466 IF ( global%myProcid == masterproc )
THEN
468 IF ( regions(ireg)%procid /= masterproc )
THEN
469 CALL mpi_recv( cvfile,ncv*ndimp,mpi_rfreal, &
470 regions(ireg)%procid,ireg, &
471 global%mpiComm,
status,global%mpierr )
472 IF ( global%mpierr /= err_none )
THEN
473 CALL
errorstop( global,err_mpi_trouble,__line__ )
482 IF ( regions(ireg)%procid == global%myProcid )
THEN
483 CALL mpi_send( cvfile,ncv*ndimp,mpi_rfreal,masterproc,ireg, &
484 global%mpiComm,global%mpierr )
485 IF ( global%mpierr /= err_none )
THEN
486 CALL
errorstop( global,err_mpi_trouble,__line__ )
494 IF (
ALLOCATED(cvfile) )
THEN
495 DEALLOCATE( cvfile,stat=errorflag )
496 global%error = errorflag
497 IF ( global%error /= err_none )
THEN
498 CALL
errorstop( global,err_deallocate,__line__,
'cvFile' )
507 DO ireg=1,global%nRegions
511 ilev = regions(ireg)%currLevel
512 ncvtile = cv_tile_last+ncont
517 DO ipatch=1,regions(ireg)%nPatches
518 ppatch => regions(ireg)%levels(ilev)%patches(ipatch)
519 bctype = ppatch%bcType
521 IF ( bctype>=bc_injection .AND. bctype<=bc_injection+bc_range )
THEN
525 n1 = abs(ppatch%l1end -ppatch%l1beg ) + 1
526 n2 = abs(ppatch%l2end -ppatch%l2beg ) + 1
531 ptileplag => ppatch%tilePlag
532 pcvtile => ptileplag%cv
533 pcvtilemass => ptileplag%cvTileMass
534 pdvtile => ptileplag%dv
538 IF ( global%myProcid == masterproc )
THEN
552 IF ( regions(ireg)%procid == global%myProcid .OR. &
553 global%myProcid==masterproc )
THEN
554 ALLOCATE( cvfile(ncvtile,ndimt),stat=errorflag )
555 global%error = errorflag
556 IF ( global%error /= err_none )
THEN
557 CALL
errorstop( global,err_allocate,__line__,
'cvFile' )
563 IF ( regions(ireg)%procid == global%myProcid )
THEN
567 cvfile(1,
n) = pcvtile(cv_tile_momnrm,
i)
568 cvfile(2,
n) = pcvtile(cv_tile_ener,
i)
570 cvfile(2+icont,
n) = pcvtile(pcvtilemass(icont),
i)
577 IF ( global%myProcid == masterproc )
THEN
579 IF ( regions(ireg)%procid /= masterproc )
THEN
580 CALL mpi_recv( cvfile,ncvtile*ndimt,mpi_rfreal, &
581 regions(ireg)%procid,ireg, &
582 global%mpiComm,
status,global%mpierr )
583 IF ( global%mpierr /= err_none )
THEN
584 CALL
errorstop( global,err_mpi_trouble,__line__ )
589 ncvtile,ndimt,cvfile )
593 IF ( regions(ireg)%procid == global%myProcid )
THEN
594 CALL mpi_send( cvfile,ncvtile*ndimt,mpi_rfreal,masterproc,ireg, &
595 global%mpiComm,global%mpierr )
596 IF ( global%mpierr /= err_none )
THEN
597 CALL
errorstop( global,err_mpi_trouble,__line__ )
605 IF (
ALLOCATED(cvfile) )
THEN
606 DEALLOCATE( cvfile,stat=errorflag )
607 global%error = errorflag
608 IF ( global%error /= err_none )
THEN
609 CALL
errorstop( global,err_deallocate,__line__,
'cvFile' )
615 IF ( regions(ireg)%procid == global%myProcid .OR. &
616 global%myProcid==masterproc )
THEN
617 ALLOCATE( dvfile(ndvtile,ndimt),stat=errorflag )
618 global%error = errorflag
619 IF ( global%error /= err_none )
THEN
620 CALL
errorstop( global,err_allocate,__line__,
'cvFile' )
626 IF ( regions(ireg)%procid == global%myProcid )
THEN
630 dvfile(1,
n) = pdvtile(dv_tile_countdown,
i)
631 dvfile(2,
n) = pdvtile(dv_tile_diam ,
i)
632 dvfile(3,
n) = pdvtile(dv_tile_spload ,
i)
638 IF ( global%myProcid == masterproc )
THEN
640 IF ( regions(ireg)%procid /= masterproc )
THEN
641 CALL mpi_recv( dvfile,ndvtile*ndimt,mpi_rfreal, &
642 regions(ireg)%procid,ireg, &
643 global%mpiComm,
status,global%mpierr )
644 IF ( global%mpierr /= err_none )
THEN
645 CALL
errorstop( global,err_mpi_trouble,__line__ )
650 ndvtile,ndimt,dvfile )
654 IF ( regions(ireg)%procid == global%myProcid )
THEN
655 CALL mpi_send( dvfile,ndvtile*ndimt,mpi_rfreal,masterproc,ireg, &
656 global%mpiComm,global%mpierr )
657 IF ( global%mpierr /= err_none )
THEN
658 CALL
errorstop( global,err_mpi_trouble,__line__ )
666 IF (
ALLOCATED(dvfile) )
THEN
667 DEALLOCATE( dvfile,stat=errorflag )
668 global%error = errorflag
669 IF ( global%error /= err_none )
THEN
670 CALL
errorstop( global,err_deallocate,__line__,
'dvFile' )
682 DEALLOCATE( ivar,stat=errorflag )
683 global%error = errorflag
684 IF (global%error /= err_none)
THEN
685 CALL
errorstop( global,err_deallocate,__line__,
'ivar' )
688 DEALLOCATE( rvar,stat=errorflag )
689 global%error = errorflag
690 IF (global%error /= err_none)
THEN
691 CALL
errorstop( global,err_deallocate,__line__,
'rvar' )
694 DEALLOCATE( ndimplag,stat=errorflag )
695 global%error = errorflag
696 IF (global%error /= err_none)
THEN
697 CALL
errorstop( global,err_deallocate,__line__,
'nDimPlag' )
702 IF (global%myProcid == masterproc)
THEN
703 CLOSE(if_solut,iostat=errorflag)
704 global%error = errorflag
705 IF (global%error /= err_none) &
706 CALL
errorstop( global,err_file_close,__line__,
'File: '//trim(fname) )
subroutine rflo_writedatafileint(global, fileId, form, nDim1, nDim2, ivar)
subroutine registerfunction(global, funName, fileName)
int status() const
Obtain the status of the attribute.
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE form
subroutine errorstop(global, errorCode, errorLine, addMessage)
subroutine plag_writesolution(regions)
subroutine rflo_writedatafilereal(global, fileId, form, nDim1, nDim2, var)
subroutine deregisterfunction(global)