Skip to content
Snippets Groups Projects
postprocessing.f90 22.6 KiB
Newer Older
  • Learn to ignore specific revisions
  • 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743
    !==============================================================================
    !==============================================================================
    !
    !     DoRuRe postprocessing    Feb. 29th, 2008
    !
    !==============================================================================
    !==============================================================================
    
    program postprocessing
    implicit none
    integer ns,ios,counter,nb,pgopen,istat,nmax,is
    double precision xxx,yyy1,yyy2,yyy3
    double precision, dimension(:,:), allocatable :: div_stats
    double precision, dimension(:,:), allocatable :: nonlin_stats
    double precision, dimension(:,:), allocatable :: solver_stats
    double precision, dimension(:,:), allocatable :: cloud_stats
    double precision, dimension(:,:), allocatable :: e2d_stats
    double precision, dimension(:,:), allocatable :: e3d_stats
    double precision, dimension(:,:), allocatable :: levels_stats
    double precision, dimension(:,:), allocatable :: levels_volumes_stats
    double precision, dimension(:,:), allocatable :: dt_stats
    double precision, dimension(:,:), allocatable :: vel_stats
    double precision, dimension(:,:), allocatable :: temp_stats
    double precision, dimension(:,:), allocatable :: p_stats
    double precision, dimension(:,:), allocatable :: q_stats
    double precision, dimension(:,:), allocatable :: octree_stats
    double precision, dimension(:,:), allocatable :: conv_stats
    double precision, dimension(:,:), allocatable :: surf_stats
    
    character(len=64) :: xlabel,ylabel,title
    character*2  :: cis
    
    nmax=1000
    
    istat=pgopen('DoRuRe.ps/PS')
    if (istat .le.0) stop 'pb snapshot pos'
    
    !===============================================================================
    !=====[surf_stats plot]=========================================================
    !===============================================================================
    do is=1,20
       allocate(surf_stats(5,nmax))
       call int_to_char(cis,2,is)
       open(826,file='surf_'//cis//'_stats.dat',status='old', ERR=99) 
       ios=0
       counter=1
       do while (ios==0)
          read(826,*,iostat=ios) surf_stats(1,counter),surf_stats(2,counter), &
                                 surf_stats(3,counter),surf_stats(4,counter), &
                                 surf_stats(5,counter)
          counter=counter+1
       end do
       close(826)
    
       nb=counter-2
       xlabel='istep+ref_count/100'
       ylabel=' '
    
       title ='surface '//cis//': number of triangles'
       call plot2D_1 (nb,surf_stats(1,1:nb),surf_stats(2,1:nb),xlabel,ylabel,title)
    
       title ='surface '//cis//': number of points'
       call plot2D_1 (nb,surf_stats(1,1:nb),surf_stats(3,1:nb),xlabel,ylabel,title)
    
       title ='surface '//cis//': number of added/removed points'
       call plot2D_1 (nb,surf_stats(1,1:nb),surf_stats(5,1:nb),xlabel,ylabel,title)
    
       title ='surface '//cis//': number of edges'
       call plot2D_1 (nb,surf_stats(1,1:nb),surf_stats(4,1:nb),xlabel,ylabel,title)
    99 exit
       deallocate(surf_stats)
    end do
    
    
    
    !===============================================================================
    !=====[nonlin plot]=============================================================
    !===============================================================================
    
    allocate(nonlin_stats(2,nmax))
    
    open (826,file='nonlin_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(826,*,iostat=ios) nonlin_stats(1,counter),nonlin_stats(2,counter)
       counter=counter+1
    end do
    close(826)
    
    nb=counter-2
    xlabel='istep+iter/100'
    ylabel=' '
    title ='number of nonlinear iterations'
    
    call plot2D_1 (nb,nonlin_stats(1,1:nb),nonlin_stats(2,1:nb),xlabel,ylabel,title)
    
    deallocate(nonlin_stats)
    
    
    
    
    
    !===============================================================================
    !=====[levels_volumes_stats plot]===============================================
    !===============================================================================
    
    allocate(levels_volumes_stats(9,nmax))
    open(unit=123,file='levels_volumes_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(123,*,iostat=ios) levels_volumes_stats(1,counter),levels_volumes_stats(2,counter), &
                              levels_volumes_stats(3,counter),levels_volumes_stats(4,counter), &
                              levels_volumes_stats(5,counter),levels_volumes_stats(6,counter), &
                              levels_volumes_stats(7,counter),levels_volumes_stats(8,counter), &
                              levels_volumes_stats(9,counter)
       counter=counter+1
    end do
    close(123)
    
    nb=counter-2
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=''
    
    title ='Total volume of level 4 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(2,1:nb),xlabel,ylabel,title)
    
    title ='Total volume of level 5 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(3,1:nb),xlabel,ylabel,title)
    
    title ='Total volume of level 6 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(4,1:nb),xlabel,ylabel,title)
    
    title ='Total volume of level 7 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(5,1:nb),xlabel,ylabel,title)
    
    title ='Total volume of level 8 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(6,1:nb),xlabel,ylabel,title)
    
    title ='Total volume of level 9 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(7,1:nb),xlabel,ylabel,title)
    
    title ='Total volume of level 10 leaves'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(8,1:nb),xlabel,ylabel,title)
    
    title ='Total volume under free surface'
    call plot2D_1 (nb,levels_volumes_stats(1,1:nb),levels_volumes_stats(9,1:nb),xlabel,ylabel,title)
    
    
    deallocate(levels_volumes_stats)
    
    !===============================================================================
    !=====[e2d plot]================================================================
    !===============================================================================
    
    allocate(e2d_stats(3,nmax))
    
    open (816,file='e2d_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) e2d_stats(1,counter),e2d_stats(2,counter),e2d_stats(3,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep+iter/100'
    ylabel='min/max'
    title ='Second invariant of deviatoric strain rate (e2d)'
    
    call plot2D_2 (nb,e2d_stats(1,1:nb),e2d_stats(2,1:nb),e2d_stats(3,1:nb),xlabel,ylabel,title)
    
    deallocate(e2d_stats)
    
    !===============================================================================
    !=====[e3d plot]================================================================
    !===============================================================================
    
    allocate(e3d_stats(3,nmax))
    
    open (816,file='e3d_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) e3d_stats(1,counter),e3d_stats(2,counter),e3d_stats(3,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep+iter/100'
    ylabel='min/max'
    title ='Third invariant of deviatoric strain rate (e3d)'
    
    call plot2D_2 (nb,e3d_stats(1,1:nb),e3d_stats(2,1:nb),e3d_stats(3,1:nb),xlabel,ylabel,title)
    
    deallocate(e3d_stats)
    
    
    !===============================================================================
    !=====[dt_stats plot]===========================================================
    !===============================================================================
    
    allocate(dt_stats(2,nmax))
    
    open (816,file='dt_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) dt_stats(1,counter),dt_stats(2,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep'
    ylabel=' '
    title ='time step dt'
    
    call plot2D_1 (nb,dt_stats(1,1:nb),dt_stats(2,1:nb),xlabel,ylabel,title)
    
    deallocate(dt_stats)
    
    !===============================================================================
    !=====[temp_stats plot]=========================================================
    !===============================================================================
    
    allocate(temp_stats(3,nmax))
    
    open (816,file='temp_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) temp_stats(1,counter),temp_stats(2,counter),temp_stats(3,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep'
    ylabel='min/max'
    title ='temperature statistics'
    
    call plot2D_2 (nb,temp_stats(1,1:nb),temp_stats(2,1:nb),temp_stats(3,1:nb),xlabel,ylabel,title)
    
    deallocate(temp_stats)
    
    !===============================================================================
    !=====[p_stats plot]============================================================
    !===============================================================================
    
    allocate(p_stats(3,nmax))
    
    open (816,file='p_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) p_stats(1,counter),p_stats(2,counter),p_stats(3,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel='min/max'
    title ='pressure statistics'
    
    call plot2D_2 (nb-1,p_stats(1,2:nb),p_stats(2,2:nb),p_stats(3,2:nb),xlabel,ylabel,title)
    
    deallocate(p_stats)
    
    !===============================================================================
    !=====[q_stats plot]============================================================
    !===============================================================================
    
    allocate(q_stats(3,nmax))
    
    open (816,file='q_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) q_stats(1,counter),q_stats(2,counter),q_stats(3,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel='min/max'
    title ='q statistics'
    
    call plot2D_2 (nb-1,q_stats(1,2:nb),q_stats(2,2:nb),q_stats(3,2:nb),xlabel,ylabel,title)
    
    deallocate(q_stats)
    
    !===============================================================================
    !=====[octree_stats plot]=======================================================
    !===============================================================================
    
    allocate(octree_stats(4,nmax))
    
    open (816,file='octree_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) octree_stats(1,counter),octree_stats(2,counter), &
                              octree_stats(3,counter),octree_stats(4,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    
    title ='number of leaves'
    call plot2D_1 (nb,octree_stats(1,1:nb),octree_stats(2,1:nb),xlabel,ylabel,title)
    
    title ='number of nodes'
    call plot2D_1 (nb,octree_stats(1,1:nb),octree_stats(3,1:nb),xlabel,ylabel,title)
    
    title ='number of bad faces'
    call plot2D_1 (nb,octree_stats(1,1:nb),octree_stats(4,1:nb),xlabel,ylabel,title)
    
    deallocate(octree_stats)
    
    !===============================================================================
    !=====[conv_stats plot]=======================================================
    !===============================================================================
    
    allocate(conv_stats(6,nmax))
    
    open (816,file='conv_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) conv_stats(1,counter),conv_stats(2,counter), &
                              conv_stats(3,counter),conv_stats(4,counter), &
                              conv_stats(5,counter),conv_stats(6,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    
    title ='velocity convergence (log values)'
    call plot2D_2 (nb,conv_stats(1,1:nb),log(conv_stats(2,1:nb)),log(conv_stats(3,1:nb)),xlabel,ylabel,title)
    
    title ='max(osolve%u(i)-ov%unode(i)) (log values)'
    call plot2D_1 (nb,conv_stats(1,1:nb),log(conv_stats(4,1:nb)),xlabel,ylabel,title)
    
    title ='max(osolve%v(i)-ov%vnode(i)) (log values)'
    call plot2D_1 (nb,conv_stats(1,1:nb),log(conv_stats(5,1:nb)),xlabel,ylabel,title)
    
    title ='max(osolve%w(i)-ov%wnode(i)) (log values)'
    call plot2D_1 (nb,conv_stats(1,1:nb),log(conv_stats(6,1:nb)),xlabel,ylabel,title)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    !===============================================================================
    !=====[vel_stats plot]==========================================================
    !===============================================================================
    
    allocate(vel_stats(7,nmax))
    
    open (816,file='vel_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(816,*,iostat=ios) vel_stats(1,counter),vel_stats(2,counter), &
                              vel_stats(3,counter),vel_stats(4,counter), &
                              vel_stats(5,counter),vel_stats(6,counter), &
                              vel_stats(7,counter)
       counter=counter+1
    end do
    close(816)
    
    nb=counter-2
    
    xlabel='istep'
    ylabel=' '
    title ='ov%u statistics'
    call plot2D_2 (nb,vel_stats(1,1:nb),vel_stats(2,1:nb),vel_stats(3,1:nb),xlabel,ylabel,title)
    
    xlabel='istep'
    ylabel=' '
    title ='ov%v statistics'
    call plot2D_2 (nb,vel_stats(1,1:nb),vel_stats(4,1:nb),vel_stats(5,1:nb),xlabel,ylabel,title)
    
    xlabel='istep'
    ylabel=' '
    title ='ov%w statistics'
    call plot2D_2 (nb,vel_stats(1,1:nb),vel_stats(6,1:nb),vel_stats(7,1:nb),xlabel,ylabel,title)
    
    deallocate(vel_stats)
    
    
    !===============================================================================
    !=====[div_stats plot]==========================================================
    !===============================================================================
    
    allocate(div_stats(4,nmax))
    
    open (815,file='div_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(815,*,iostat=ios) div_stats(1,counter),div_stats(2,counter),div_stats(3,counter),div_stats(4,counter) 
       counter=counter+1
    end do
    close(815)
    
    nb=counter-2
    xlabel='istep+iter/100'
    ylabel='min,avrg,max'
    title ='divergence statistics'
    
    call plot2D_3 (nb,div_stats(1,1:nb),div_stats(2,1:nb),div_stats(3,1:nb),div_stats(4,1:nb),xlabel,ylabel,title)
    
    deallocate(div_stats)
    
    !===============================================================================
    !=====[levels_stats plots]======================================================
    !===============================================================================
    
    allocate(levels_stats(8,nmax))
    
    open (806,file='levels_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(806,*,iostat=ios) levels_stats(1,counter),levels_stats(2,counter), &
                              levels_stats(3,counter),levels_stats(4,counter), & 
                              levels_stats(5,counter),levels_stats(6,counter), &
                              levels_stats(7,counter),levels_stats(8,counter) 
       counter=counter+1
    end do
    close(806)
    nb=counter-2
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 4'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(2,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 5'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(3,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 6'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(4,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 7'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(5,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 8'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(6,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 9'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(7,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of leaves of level 10'
    call plot2D_1 (nb,levels_stats(1,1:nb),levels_stats(8,1:nb),xlabel,ylabel,title)
    deallocate(levels_stats)
    
    
    
    
    
    !===============================================================================
    !=====[solver_stats plots]======================================================
    !===============================================================================
    allocate(solver_stats(8,nmax))
    open (806,file='solver_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(806,*,iostat=ios) solver_stats(1,counter),solver_stats(2,counter), &
                              solver_stats(3,counter),solver_stats(4,counter), & 
                              solver_stats(5,counter),solver_stats(6,counter), &
                              solver_stats(7,counter),solver_stats(8,counter) 
       counter=counter+1
    end do
    close(806)
    nb=counter-2
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='matrix size (id%n)'
    call plot2D_1 (nb,solver_stats(1,1:nb),solver_stats(2,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of non-zero terms (id%nz)'
    call plot2D_1 (nb,solver_stats(1,1:nb),solver_stats(3,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of GFLOP (id%rinfog(3))'
    call plot2D_1 (nb,solver_stats(1,1:nb),solver_stats(4,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='real workspace in Gb (id%infog(3))'
    call plot2D_1 (nb,solver_stats(1,1:nb),solver_stats(5,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='factorisation time (s)'
    call plot2D_1 (nb,solver_stats(1,1:nb),solver_stats(6,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='back substitution time (s)'
    call plot2D_1 (nb,solver_stats(1,1:nb),solver_stats(7,1:nb),xlabel,ylabel,title)
    
    xlabel='matrix size'
    ylabel='factorisation time'
    title ='factorisation time vs. matrix size'
    call plot2D_1 (nb,solver_stats(2,1:nb),solver_stats(6,1:nb),xlabel,ylabel,title)
    
    xlabel='number of leaves'
    ylabel='factorisation time'
    title ='factorisation time vs. number of leaves'
    call plot2D_1 (nb,solver_stats(8,1:nb),solver_stats(6,1:nb),xlabel,ylabel,title)
    
    deallocate(solver_stats)
    
    !===============================================================================
    !=====[cloud_stats plots]=======================================================
    !===============================================================================
    
    allocate(cloud_stats(13,nmax))
    open (812,file='cloud_stats.dat',status='old')
    ios=0
    counter=1
    do while (ios==0)
       read(812,*,iostat=ios) cloud_stats( 1,counter),cloud_stats( 2,counter), &
                              cloud_stats( 3,counter),cloud_stats( 4,counter), & 
                              cloud_stats( 5,counter),cloud_stats( 6,counter), &
                              cloud_stats( 7,counter),cloud_stats( 8,counter), & 
                              cloud_stats( 9,counter),cloud_stats(10,counter), &
                              cloud_stats(11,counter),cloud_stats(12,counter), & 
                              cloud_stats(13,counter)
       counter=counter+1
    end do
    close(812)
    nb=counter-2
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of points in the cloud'
    call plot2D_1 (nb,cloud_stats(1,1:nb),cloud_stats(2,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of removed points in the cloud'
    call plot2D_1 (nb,cloud_stats(1,1:nb),cloud_stats(3,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel=' '
    title ='number of added points in the cloud'
    call plot2D_1 (nb,cloud_stats(1,1:nb),cloud_stats(4,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel='min/avg/max'
    title ='strain on cloud statistics'
    call plot2D_3 (nb,cloud_stats(1,1:nb),cloud_stats(5,1:nb),cloud_stats(6,1:nb),cloud_stats(7,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel='min/avg/max'
    title ='temperature on cloud statistics'
    call plot2D_3 (nb,cloud_stats(1,1:nb),cloud_stats(8,1:nb),cloud_stats(9,1:nb),cloud_stats(10,1:nb),xlabel,ylabel,title)
    
    xlabel='istep+iter/100+iter_nl/10000'
    ylabel='min/avg/max'
    title ='pressure on cloud statistics'
    call plot2D_3 (nb,cloud_stats(1,1:nb),cloud_stats(11,1:nb),cloud_stats(12,1:nb),cloud_stats(13,1:nb),xlabel,ylabel,title)
    
    deallocate(cloud_stats)
    
    
    
    CALL PGIDEN
    CALL PGCLOS
    
    
    end program postprocessing
    
    
    !===============================================================================
    !===============================================================================
    !===============================================================================
    !===============================================================================
    !===============================================================================
    
    subroutine plot2D_3 (n,x,y1,y2,y3,xlabel,ylabel,title)
    implicit none
    integer n
    double precision x(n),y1(n),y2(n),y3(n)
    character*(*) xlabel,ylabel,title
    integer i
    real xmin,xmax,ymin,ymax
    
    if (n>0) then
    
    xmin=real(minval(x))
    xmax=real(maxval(x))
    if (xmax-xmin < 1.d-5) then
       xmin=0.5d0*xmin
       xmax=1.5d0*xmax
    end if
    
    ymin=real( minval( (/ minval(y1),minval(y2),minval(y3) /) ) )
    ymax=real( maxval( (/ maxval(y1),maxval(y2),maxval(y3) /) ) )
    if (abs(ymin)<1.d-9) ymin=-1.d-8
    if (abs(ymax)<1.d-9) ymax=+1.d-8
    !if (ymax-ymin < 1.d-5) then
       ymin=0.99d0*ymin
       ymax=1.01d0*ymax
    !end if
    
    CALL PGENV(xmin,xmax,ymin,ymax,0,1)
    CALL PGLAB(xlabel(1:len(xlabel)), ylabel(1:len(ylabel)),title(1:len(title)))
    CALL PGPT(n,real(x),real(y1),17)
    CALL PGPT(n,real(x),real(y2),16)
    CALL PGPT(n,real(x),real(y3),13)
    CALL PGLINE(n,real(x),real(y1))
    CALL PGLINE(n,real(x),real(y2))
    CALL PGLINE(n,real(x),real(y3))
    
    end if
    
    end subroutine plot2D_3
    
    !===============================================================================
    !===============================================================================
    
    subroutine plot2D_2 (n,x,y1,y2,xlabel,ylabel,title)
    implicit none
    integer n
    double precision x(n),y1(n),y2(n)
    character*(*) xlabel,ylabel,title
    integer i
    real xmin,xmax,ymin,ymax
    
    if (n>0) then
    
    xmin=real(minval(x))
    xmax=real(maxval(x))
    if (xmax-xmin < 1.d-5) then
       xmin=0.5d0*xmin
       xmax=1.5d0*xmax
    end if
    
    ymin=real(min( minval(y1),minval(y2) ))
    ymax=real(max( maxval(y1),maxval(y2) ))
    if (abs(ymin)<1.d-9) ymin=-1.d-8
    if (abs(ymax)<1.d-9) ymax=+1.d-8
    
    !if (ymax-ymin < 1.d-5) then
       ymin=0.99d0*ymin
       ymax=1.01d0*ymax
    !end if
    
    CALL PGENV(xmin,xmax,ymin,ymax,0,1)
    CALL PGLAB(xlabel(1:len(xlabel)), ylabel(1:len(ylabel)),title(1:len(title)))
    CALL PGPT(n,real(x),real(y1),17)
    CALL PGPT(n,real(x),real(y2),16)
    CALL PGLINE(n,real(x),real(y1))
    CALL PGLINE(n,real(x),real(y2))
    
    end if
    
    end subroutine plot2D_2
    
    !===============================================================================
    !===============================================================================
    
    subroutine plot2D_1 (n,x,y,xlabel,ylabel,title)
    implicit none
    integer n
    double precision x(n),y(n),ymin,ymax,xmin,xmax
    character*(*) xlabel,ylabel,title
    integer i
    
    if (n>0) then
    
    xmin=real(minval(x))
    xmax=real(maxval(x))
    if (xmax-xmin < 1.d-5) then
       xmin=0.5d0*xmin
       xmax=1.5d0*xmax
    end if
    
    ymin=minval(y)
    ymax=maxval(y)
    
    if (abs(ymin)<1.d-9) ymin=-1.d-8
    if (abs(ymax)<1.d-9) ymax=+1.d-8
    
    !if (ymax-ymin < 1.d-5) then
       ymin=0.99d0*ymin
       ymax=1.01d0*ymax
    !end if
    
    
    CALL PGENV(real(xmin),real(xmax),real(ymin),real(ymax),0,1)
    CALL PGLAB(xlabel(1:len(xlabel)), ylabel(1:len(ylabel)),title(1:len(title)))
    CALL PGPT(n,real(x),real(y),17)
    CALL PGLINE(n,real(x),real(y))
    
    end if
    
    end subroutine plot2D_1