357
362
363 class(ListReaderType) :: this
364
365 integer(I4B) :: mxlist, ldim, naux
366 integer(I4B) :: ii, jj, idum, nod, istat, increment
367 real(DP) :: r
368 integer(I4B), dimension(:), allocatable :: cellid
369 character(len=LINELENGTH) :: fname
370
371 character(len=*), parameter :: fmtmxlsterronly = &
372 "('Error reading list. The number of records encountered exceeds &
373 &the maximum number of records. Number of records found is ',I0,&
374 &' but MAXBOUND is ', I0, '. Try increasing MAXBOUND for this list. &
375 &Error occurred reading the following line: ', a, 5x, '>>> ', a)"
376
377
378 mxlist = size(this%rlist, 2)
379 ldim = size(this%rlist, 1)
380 naux = size(this%auxvar, 1)
381 this%ntxtrlist = 0
382 this%ntxtauxvar = 0
383
384
385 allocate (cellid(this%ndim))
386
387 ii = 1
388 readloop: do
389
390
391 if (ii /= 1) &
392 call this%line_reader%rdcom(this%inlist, 0, this%line, this%ierr)
393
394
395
396 if (this%nlist < 0) then
397 this%lloc = 1
398 call urword(this%line, this%lloc, this%istart, this%istop, 1, idum, r, &
399 this%iout, this%inlist)
400 if (this%line(this%istart:this%istop) == 'END' .or. this%ierr < 0) then
401
402
403 if (this%ierr == 0) then
404 call this%line_reader%bkspc(this%inlist)
405 end if
406 this%nlist = ii - 1
407 exit readloop
408 end if
409 end if
410
411
412 if (ii > mxlist) then
413 inquire (unit=this%inlist, name=fname)
414 write (errmsg, fmtmxlsterronly) &
415 ii, mxlist, new_line("A"), trim(this%line)
416 call store_error(errmsg)
417 call store_error_unit(this%inlist)
418 end if
419
420
421 this%lloc = 1
422
423
424 call urword(this%line, this%lloc, this%istart, this%istop, 2, &
425 cellid(1), r, this%iout, this%inlist)
426 if (this%ndim > 1) then
427 call urword(this%line, this%lloc, this%istart, this%istop, 2, &
428 cellid(2), r, this%iout, this%inlist)
429 end if
430 if (this%ndim > 2) then
431 call urword(this%line, this%lloc, this%istart, this%istop, 2, &
432 cellid(3), r, this%iout, this%inlist)
433 end if
434
435
436 call check_cellid(ii, cellid, this%mshape, this%ndim)
437
438
439 if (this%ndim == 3) then
440 nod = get_node(cellid(1), cellid(2), cellid(3), &
441 this%mshape(1), this%mshape(2), this%mshape(3))
442 elseif (this%ndim == 2) then
443 nod = get_node(cellid(1), 1, cellid(2), &
444 this%mshape(1), 1, this%mshape(2))
445 else
446 nod = cellid(1)
447 end if
448
449
450 this%nodelist(ii) = nod
451
452
453 do jj = 1, ldim
454 call urword(this%line, this%lloc, this%istart, this%istop, 0, idum, &
455 r, this%iout, this%inlist)
456 read (this%line(this%istart:this%istop), *, iostat=istat) r
457
458
459
460 if (istat == 0) then
461 this%rlist(jj, ii) = r
462 else
463 this%rlist(jj, ii) =
dzero
464 this%ntxtrlist = this%ntxtrlist + 1
465 if (this%ntxtrlist > size(this%txtrlist)) then
466 increment = int(size(this%txtrlist) * 0.2)
467 increment = max(100, increment)
471 end if
472 this%txtrlist(this%ntxtrlist) = this%line(this%istart:this%istop)
473 this%idxtxtrow(this%ntxtrlist) = ii
474 this%idxtxtcol(this%ntxtrlist) = jj
475 end if
476
477 end do
478
479
480 do jj = 1, naux
481 call urword(this%line, this%lloc, this%istart, this%istop, 0, idum, &
482 r, this%iout, this%inlist)
483 read (this%line(this%istart:this%istop), *, iostat=istat) r
484
485
486
487 if (istat == 0) then
488 this%auxvar(jj, ii) = r
489 else
490 this%auxvar(jj, ii) =
dzero
491 this%ntxtauxvar = this%ntxtauxvar + 1
492 if (this%ntxtauxvar > size(this%txtauxvar)) then
493 increment = int(size(this%txtauxvar) * 0.2)
494 increment = max(100, increment)
498 end if
499 this%txtauxvar(this%ntxtauxvar) = this%line(this%istart:this%istop)
500 this%idxtxtauxrow(this%ntxtauxvar) = ii
501 this%idxtxtauxcol(this%ntxtauxvar) = jj
502 if (len_trim(this%txtauxvar(this%ntxtauxvar)) == 0) then
503 write (errmsg, '(a,i0,a)') 'Auxiliary data or time series name &
504 &expected but not found in period &
505 &block "',
kper,
'".'
506 call store_error(errmsg)
507 call store_error_unit(this%inlist)
508 end if
509 end if
510
511 end do
512
513
514 if (this%inamedbound > 0) then
515 call urword(this%line, this%lloc, this%istart, this%istop, 1, idum, r, &
516 this%iout, this%inlist)
517 this%boundname(ii) = this%line(this%istart:this%istop)
518 end if
519
520
521 if (this%nlist > 0) then
522 if (ii == this%nlist) exit readloop
523 end if
524
525
526 ii = ii + 1
527
528 end do readloop
529
530
531 if (count_errors() > 0) then
532 call store_error_unit(this%inlist)
533 end if
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenboundname
maximum length of a bound name
real(dp), parameter dzero
real constant zero
integer(i4b), pointer, public kper
current stress period number