MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
prtprpmodule Module Reference

Data Types

type  prtprptype
 Particle release point (PRP) package. More...
type  exgprtprptype
 Exchange PRP package. A variant of the normal PRP package that doesn't read from input files but instead receives particle transfers from coupled models while preserving the pattern where PRP packages own particles. Call it "Particle Registry Package"? More...

Functions/Subroutines

subroutine, public prp_create (packobj, id, ibcnum, inunit, iout, namemodel, pakname, fmi, input_mempath)
 Create a new particle release point package.
subroutine prp_da (this)
 Deallocate memory.
subroutine prp_set_pointers (this, ibound, izone)
 Set pointers to model variables.
subroutine prp_allocate_arrays (this, nodelist, auxvar)
 Allocate arrays.
subroutine prp_allocate_scalars (this)
 Allocate scalars.
subroutine prp_ar (this)
 Allocate and read period data.
subroutine exg_prp_allocate_scalars (this)
 Allocate scalars for exchange PRP.
subroutine exg_prp_allocate_arrays (this, nodelist, auxvar)
 Allocate arrays for exchange PRP.
subroutine exg_prp_ar (this)
 No-op AR method override for exchange PRP.
subroutine prp_ad (this)
 Advance a time step and release particles if scheduled.
subroutine prp_commit (this)
 Commit staged particle state to the "final" store.
subroutine exg_prp_ad (this)
 No-op AD method override for exchange PRP.
subroutine exg_prp_cq_simrate (this, hnew, flowja, imover)
 No-op flow calculation for exchange PRP.
subroutine exg_prp_bd (this, model_budget)
 No-op budget method for exchange PRP. Likewise about the STORAGE term accounting.
subroutine exg_prp_ot_model_flows (this, icbcfl, ibudfl, icbcun, imap)
 No-op flow output method for exchange PRP. No contribution to budget, no need to write output.
subroutine log_release (this)
 Log the release scheduled for this time step.
subroutine validate_release_point (this, ic, x, y, z)
 Verify that the release point is in the cell.
subroutine release (this, ip, trelease)
 Release a particle at the specified time.
subroutine initialize_particle (this, particle, ip, trelease)
subroutine prp_rp (this)
 Read and prepare period data for particle input.
subroutine exg_prp_rp (this)
 No-op RP method override for exchange PRP.
subroutine prp_cq_simrate (this, hnew, flowja, imover)
 Calculate flow between package and model.
subroutine define_listlabel (this)
logical function prp_obs_supported (this)
 Indicates whether observations are supported.
subroutine prp_df_obs (this)
 Store supported observations.
subroutine prp_options (this)
 Set options specific to PrtPrpType.
subroutine exg_prp_options (this)
 No-op options method override for exchange PRP. Just creates an empty release schedule.
subroutine prp_log_options (this, found, trackfile, trackcsvfile)
 Log options specific to PrtPrpType.
subroutine prp_dimensions (this)
 Set dimensions specific to PrtPrpType.
subroutine exg_prp_dimensions (this)
 Dimensions method override for exchange PRP. Just set all dimensions to zero and allocate arrays.
subroutine prp_packagedata (this)
 Load package data (release points).
subroutine prp_releasetimes (this)
 Load explicitly specified release times.
subroutine prp_load_default_release (this)
 Release once at t=0 if the input configures no releases.
subroutine prp_check_releases (this)
 Warn if the input configures releases but none will happen.
subroutine prp_load_releasetimefrequency (this)
 Load regularly spaced release times if configured.

Variables

character(len=lenftype) ftype = 'PRP'
character(len=16) text = ' PRP'
real(dp), parameter default_exit_solve_tolerance = DEM5

Function/Subroutine Documentation

◆ define_listlabel()

subroutine prtprpmodule::define_listlabel ( class(prtprptype), intent(inout) this)
private

Definition at line 808 of file prt-prp.f90.

809 class(PrtPrpType), intent(inout) :: this
810 ! not implemented, not used

◆ exg_prp_ad()

subroutine prtprpmodule::exg_prp_ad ( class(exgprtprptype) this)
private

Definition at line 504 of file prt-prp.f90.

505 class(ExgPrtPrpType) :: this

◆ exg_prp_allocate_arrays()

subroutine prtprpmodule::exg_prp_allocate_arrays ( class(exgprtprptype) this,
integer(i4b), dimension(:), optional, pointer, contiguous nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous auxvar )
private

BndExtType expects certain array variables to exist in the input context (CELLID, NODEULIST, BOUNDNAME, AUXVAR). This method manually creates zero-sized arrays before calling the parent's allocate_arrays.

Definition at line 402 of file prt-prp.f90.

405 class(ExgPrtPrpType) :: this
406 integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist
407 real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar
408 ! local
409 integer(I4B), dimension(:, :), pointer, contiguous :: cellid
410 integer(I4B), dimension(:), pointer, contiguous :: nodeulist
411 type(CharacterStringType), dimension(:), pointer, contiguous :: boundname
412 real(DP), dimension(:, :), pointer, contiguous :: auxvar_input
413
414 call mem_allocate(cellid, this%dis%ndim, 0, 'CELLID', this%input_mempath)
415 call mem_allocate(nodeulist, 0, 'NODEULIST', this%input_mempath)
416 call mem_allocate(boundname, lenboundname, 0, 'BOUNDNAME', &
417 this%input_mempath)
418 call mem_allocate(auxvar_input, 0, 0, 'AUXVAR', this%input_mempath)
419
420 call this%PrtPrpType%prp_allocate_arrays(nodelist, auxvar)
This class is used to store a single deferred-length character string. It was designed to work in an ...

◆ exg_prp_allocate_scalars()

subroutine prtprpmodule::exg_prp_allocate_scalars ( class(exgprtprptype) this)
private

The exchange PRP is a headless package (no input file) but BndExtType expects certain variables to exist in the input context (IPER, IONPER, HASPERIODBLOCKS) so we need to manually create them before calling the parent procedure.

Definition at line 376 of file prt-prp.f90.

378 class(ExgPrtPrpType) :: this
379 integer(I4B), pointer :: iper, ionper
380 logical(LGP), pointer :: hasperiodblocks
381
382 this%input_mempath = trim(this%memoryPath)//'-INPUT'
383
384 call mem_allocate(iper, 'IPER', this%input_mempath)
385 call mem_allocate(ionper, 'IONPER', this%input_mempath)
386 call mem_allocate(hasperiodblocks, 'HASPERIODBLOCKS', this%input_mempath)
387
388 ! set iper = 0. this forces BndExtType%bnd_rp to
389 ! return early, since iper will never match kper.
390 iper = 0
391 ionper = 0
392 hasperiodblocks = .false.
393
394 call this%PrtPrpType%prp_allocate_scalars()

◆ exg_prp_ar()

subroutine prtprpmodule::exg_prp_ar ( class(exgprtprptype), intent(inout) this)
private

Definition at line 424 of file prt-prp.f90.

425 class(ExgPrtPrpType), intent(inout) :: this

◆ exg_prp_bd()

subroutine prtprpmodule::exg_prp_bd ( class(exgprtprptype) this,
type(budgettype), intent(inout) model_budget )
private

Definition at line 521 of file prt-prp.f90.

522 use budgetmodule, only: budgettype
523 class(ExgPrtPrpType) :: this
524 type(BudgetType), intent(inout) :: model_budget
This module contains the BudgetModule.
Definition Budget.f90:20
Derived type for the Budget object.
Definition Budget.f90:40

◆ exg_prp_cq_simrate()

subroutine prtprpmodule::exg_prp_cq_simrate ( class(exgprtprptype) this,
real(dp), dimension(:), intent(in) hnew,
real(dp), dimension(:), intent(inout) flowja,
integer(i4b), intent(in) imover )
private

Exchange PRP particles are transferred from other models and already active, so their mass is already accounted for in the STORAGE term.

Definition at line 512 of file prt-prp.f90.

513 class(ExgPrtPrpType) :: this
514 real(DP), dimension(:), intent(in) :: hnew
515 real(DP), dimension(:), intent(inout) :: flowja
516 integer(I4B), intent(in) :: imover

◆ exg_prp_dimensions()

subroutine prtprpmodule::exg_prp_dimensions ( class(exgprtprptype), intent(inout) this)
private

Definition at line 1062 of file prt-prp.f90.

1063 class(ExgPrtPrpType), intent(inout) :: this
1064
1065 this%nreleasepoints = 0
1066 this%nreleasetimes = 0
1067 this%maxbound = 0
1068 this%nbound = 0
1069
1070 call this%prp_allocate_arrays()

◆ exg_prp_options()

subroutine prtprpmodule::exg_prp_options ( class(exgprtprptype), intent(inout) this)
private

Definition at line 987 of file prt-prp.f90.

988 class(ExgPrtPrpType), intent(inout) :: this
989 this%schedule => create_release_schedule(tolerance=this%rttol)
Here is the call graph for this function:

◆ exg_prp_ot_model_flows()

subroutine prtprpmodule::exg_prp_ot_model_flows ( class(exgprtprptype) this,
integer(i4b), intent(in) icbcfl,
integer(i4b), intent(in) ibudfl,
integer(i4b), intent(in) icbcun,
integer(i4b), dimension(:), intent(in), optional imap )
private

Definition at line 529 of file prt-prp.f90.

530 class(ExgPrtPrpType) :: this
531 integer(I4B), intent(in) :: icbcfl
532 integer(I4B), intent(in) :: ibudfl
533 integer(I4B), intent(in) :: icbcun
534 integer(I4B), dimension(:), optional, intent(in) :: imap

◆ exg_prp_rp()

subroutine prtprpmodule::exg_prp_rp ( class(exgprtprptype), intent(inout) this)
private

Definition at line 769 of file prt-prp.f90.

770 class(ExgPrtPrpType), intent(inout) :: this

◆ initialize_particle()

subroutine prtprpmodule::initialize_particle ( class(prtprptype), intent(inout) this,
type(particletype), intent(inout), pointer particle,
integer(i4b), intent(in) ip,
real(dp), intent(in) trelease )
private
Parameters
[in,out]thisthis instance
[in,out]particlethe particle
[in]ipparticle index
[in]treleaserelease time

Definition at line 624 of file prt-prp.f90.

626 class(PrtPrpType), intent(inout) :: this !< this instance
627 type(ParticleType), pointer, intent(inout) :: particle !< the particle
628 integer(I4B), intent(in) :: ip !< particle index
629 real(DP), intent(in) :: trelease !< release time
630 ! local
631 logical(LGP) :: draped
632 integer(I4B) :: irow, icol, ilay, icpl
633 integer(I4B) :: ic, icu, ic_old
634 real(DP) :: x, y, z
635 ! formats
636 character(len=*), parameter :: fmticterr = &
637 "('Error in ',a,': Flow model interface does not contain ICELLTYPE. &
638 &ICELLTYPE is required for PRT to distinguish convertible cells &
639 &from confined cells if LOCAL_Z release coordinates are provided. &
640 &Make sure a GWFGRID entry is configured in the PRT FMI package.')"
641
642 ic = this%rptnode(ip)
643
644 call create_particle(particle)
645
646 if (size(this%boundname) /= 0) then
647 particle%name = this%boundname(ip)
648 else
649 particle%name = ''
650 end if
651
652 particle%irpt = ip
653 particle%istopweaksink = this%istopweaksink
654 particle%istopzone = this%istopzone
655 particle%idrymeth = this%idrymeth
656 particle%istatus = 0 ! status 0 until tracking starts
657
658 ! If the cell is inactive, either drape the particle
659 ! to the top-most active cell beneath it if drape is
660 ! enabled, or else terminate permanently unreleased.
661 draped = .false.
662 if (this%ibound(ic) == 0) then
663 ic_old = ic
664 if (this%drape) then
665 call this%dis%highest_active(ic, this%ibound)
666 draped = ic /= ic_old
667 if (.not. draped .and. this%ibound(ic) == 0) then
668 ! negative unreleased status signals to the
669 ! tracking method that we haven't yet saved
670 ! a termination record, it needs to do so.
671 particle%istatus = -1 * term_unreleased
672 end if
673 else
674 particle%istatus = -1 * term_unreleased
675 end if
676 end if
677
678 icu = this%dis%get_nodeuser(ic)
679 particle%icu = icu
680 select type (dis => this%dis)
681 type is (distype)
682 call get_ijk(icu, dis%nrow, dis%ncol, dis%nlay, irow, icol, ilay)
683 type is (disvtype)
684 call get_jk(icu, dis%ncpl, dis%nlay, icpl, ilay)
685 end select
686 particle%ilay = ilay
687 particle%izone = this%rptzone(ic)
688
689 ! if the particle was draped to this cell, set the z coord to
690 ! the effective top of the cell. if it was not draped, and is
691 ! a local z coord, calculate the corresponding model z coord.
692 if (draped) then
693 z = this%fmi%dis%bot(ic) + &
694 this%fmi%gwfsat(ic) * &
695 (this%fmi%dis%top(ic) - this%fmi%dis%bot(ic))
696 else if (this%localz) then
697 z = this%fmi%dis%bot(ic) + &
698 this%rptz(ip) * &
699 this%fmi%gwfsat(ic) * &
700 (this%fmi%dis%top(ic) - this%fmi%dis%bot(ic))
701 else
702 z = this%rptz(ip)
703 end if
704
705 x = this%rptx(ip)
706 y = this%rpty(ip)
707
708 if (this%ichkmeth > 0) &
709 call this%validate_release_point(ic, x, y, z)
710
711 particle%x = x
712 particle%y = y
713 particle%z = z
714 particle%trelease = trelease
715
716 ! Set stop time to earlier of STOPTIME and STOPTRAVELTIME
717 if (this%stoptraveltime == huge(1d0)) then
718 particle%tstop = this%stoptime
719 else
720 particle%tstop = particle%trelease + this%stoptraveltime
721 if (this%stoptime < particle%tstop) particle%tstop = this%stoptime
722 end if
723
724 particle%ttrack = particle%trelease
725 particle%itrdomain(level_model) = 0
726 particle%iboundary(level_model) = 0
727 particle%itrdomain(level_feature) = ic
728 particle%iboundary(level_feature) = 0
729 particle%itrdomain(level_subfeature) = 0
730 particle%iboundary(level_subfeature) = 0
731 particle%frctrn = this%frctrn
732 particle%iexmeth = this%iexmeth
733 particle%extend = this%extend
734 particle%icycwin = this%icycwin
735 particle%extol = this%extol
@ term_unreleased
terminated permanently unreleased
Definition Particle.f90:38
subroutine create_particle(particle)
Create a new particle.
Definition Particle.f90:166
Here is the call graph for this function:

◆ log_release()

subroutine prtprpmodule::log_release ( class(prtprptype), intent(inout) this)
private
Parameters
[in,out]thisprp

Definition at line 538 of file prt-prp.f90.

539 class(PrtPrpType), intent(inout) :: this !< prp
540 if (this%iprpak > 0) then
541 write (this%iout, "(1x,/1x,a,1x,i0)") &
542 'PARTICLE RELEASE FOR PRP', this%ibcnum
543 call this%schedule%log(this%iout)
544 end if

◆ prp_ad()

subroutine prtprpmodule::prp_ad ( class(prtprptype) this)
private

Definition at line 429 of file prt-prp.f90.

430 use tdismodule, only: kstp, kper
431 class(PrtPrpType) :: this
432 integer(I4B) :: ip, it, np
433
434 ! Notes
435 ! -----
436 ! Each release point can be thought of as
437 ! a gumball machine with infinite supply:
438 ! a point can release an arbitrary number
439 ! of particles, but only one at any time.
440 ! Coincident release times are merged to
441 ! a single time by the release scheduler.
442
443 ! Reset mass accumulators for this time step.
444 do ip = 1, this%nreleasepoints
445 this%rptm(ip) = dzero
446 end do
447
448 ! Advance the release schedule. At the start of each period (kstp==1),
449 ! apply period block configuration if available and not yet applied.
450 ! This handles both new configuration and fill-forward periods.
451 ! For subsequent time steps, just advance without arguments to
452 ! advance the time selection object to the current time step.
453 if (kstp == 1 .and. &
454 kper /= this%applied_kper .and. &
455 allocated(this%period_block_lines)) then
456 call this%schedule%advance(lines=this%period_block_lines)
457 this%applied_kper = kper
458 else
459 call this%schedule%advance()
460 end if
461
462 ! Reset staging from the committed state for this solve attempt,
463 ! sized for the particles to be released, which we know from the
464 ! schedule. Resize once to the final size, so an ATS retry, which
465 ! gets here again with the same size, doesn't reallocate and
466 ! invalidate pointers to the store. Always reset, regardless of
467 ! flow source, so changes to the committed store through the API
468 ! take effect.
469 np = this%particles%num_stored()
470 if (this%schedule%any()) &
471 np = np + this%nreleasepoints * this%schedule%count()
472 call this%particles_staging%resize(np, &
473 trim(this%memoryPath)//'-STAGING')
474 call this%particles_staging%copy_from(this%particles)
475 this%nparticles = this%particles%num_stored()
476
477 ! Check if any releases will be made this time step.
478 if (.not. this%schedule%any()) return
479
480 ! Log the schedule to the list file.
481 call this%log_release()
482
483 ! Release a particle from each point for each release time in
484 ! the current step. Release times that won't be used (negative,
485 ! or after the end of the simulation without EXTEND_TRACKING)
486 ! were dropped at load time, so every scheduled time is used.
487 do ip = 1, this%nreleasepoints
488 do it = 1, this%schedule%count()
489 call this%release(ip, this%schedule%times(it))
490 end do
491 end do
integer(i4b), pointer, public kstp
current time step number
Definition tdis.f90:27
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26

◆ prp_allocate_arrays()

subroutine prtprpmodule::prp_allocate_arrays ( class(prtprptype) this,
integer(i4b), dimension(:), optional, pointer, contiguous nodelist,
real(dp), dimension(:, :), optional, pointer, contiguous auxvar )
private

Definition at line 258 of file prt-prp.f90.

259 ! dummy
260 class(PrtPrpType) :: this
261 integer(I4B), dimension(:), pointer, contiguous, optional :: nodelist
262 real(DP), dimension(:, :), pointer, contiguous, optional :: auxvar
263 ! local
264 integer(I4B) :: nps
265
266 call this%BndExtType%allocate_arrays()
267
268 ! Allocate particle stores
269 call create_particle_store( &
270 this%particles, 0, &
271 this%memoryPath)
272 call create_particle_store( &
273 this%particles_staging, 0, &
274 trim(this%memoryPath)//'-STAGING')
275
276 ! Allocate arrays
277 call mem_allocate(this%rptx, this%nreleasepoints, 'RPTX', this%memoryPath)
278 call mem_allocate(this%rpty, this%nreleasepoints, 'RPTY', this%memoryPath)
279 call mem_allocate(this%rptz, this%nreleasepoints, 'RPTZ', this%memoryPath)
280 call mem_allocate(this%rptm, this%nreleasepoints, 'RPTMASS', &
281 this%memoryPath)
282 call mem_allocate(this%rptnode, this%nreleasepoints, 'RPTNODER', &
283 this%memoryPath)
284 call mem_allocate(this%rptname, lenboundname, this%nreleasepoints, &
285 'RPTNAME', this%memoryPath)
286
287 ! Initialize arrays
288 do nps = 1, this%nreleasepoints
289 this%rptm(nps) = dzero
290 end do
Here is the call graph for this function:

◆ prp_allocate_scalars()

subroutine prtprpmodule::prp_allocate_scalars ( class(prtprptype) this)
private

Definition at line 294 of file prt-prp.f90.

295 class(PrtPrpType) :: this
296
297 ! Allocate parent's scalars
298 call this%BndExtType%allocate_scalars()
299
300 ! Allocate scalars for this type
301 call mem_allocate(this%localz, 'LOCALZ', this%memoryPath)
302 call mem_allocate(this%extend, 'EXTEND', this%memoryPath)
303 call mem_allocate(this%offset, 'OFFSET', this%memoryPath)
304 call mem_allocate(this%stoptime, 'STOPTIME', this%memoryPath)
305 call mem_allocate(this%stoptraveltime, 'STOPTRAVELTIME', this%memoryPath)
306 call mem_allocate(this%istopweaksink, 'ISTOPWEAKSINK', this%memoryPath)
307 call mem_allocate(this%istopzone, 'ISTOPZONE', this%memoryPath)
308 call mem_allocate(this%drape, 'DRAPE', this%memoryPath)
309 call mem_allocate(this%idrymeth, 'IDRYMETH', this%memoryPath)
310 call mem_allocate(this%nreleasepoints, 'NRELEASEPOINTS', this%memoryPath)
311 call mem_allocate(this%nreleasetimes, 'NRELEASETIMES', this%memoryPath)
312 call mem_allocate(this%nparticles, 'NPARTICLES', this%memoryPath)
313 call mem_allocate(this%itrkout, 'ITRKOUT', this%memoryPath)
314 call mem_allocate(this%itrkhdr, 'ITRKHDR', this%memoryPath)
315 call mem_allocate(this%itrkcsv, 'ITRKCSV', this%memoryPath)
316 call mem_allocate(this%irlstls, 'IRLSTLS', this%memoryPath)
317 call mem_allocate(this%frctrn, 'FRCTRN', this%memoryPath)
318 call mem_allocate(this%iexmeth, 'IEXMETH', this%memoryPath)
319 call mem_allocate(this%ichkmeth, 'ICHKMETH', this%memoryPath)
320 call mem_allocate(this%icycwin, 'ICYCWIN', this%memoryPath)
321 call mem_allocate(this%extol, 'EXTOL', this%memoryPath)
322 call mem_allocate(this%rttol, 'RTTOL', this%memoryPath)
323 call mem_allocate(this%rtfreq, 'RTFREQ', this%memoryPath)
324
325 ! Set values
326 this%localz = .false.
327 this%extend = .false.
328 this%offset = dzero
329 this%stoptime = huge(1d0)
330 this%stoptraveltime = huge(1d0)
331 this%istopweaksink = 0
332 this%istopzone = 0
333 this%drape = .false.
334 this%idrymeth = 0
335 this%nreleasepoints = 0
336 this%nreleasetimes = 0
337 this%nparticles = 0
338 this%itrkout = 0
339 this%itrkhdr = 0
340 this%itrkcsv = 0
341 this%irlstls = 0
342 this%frctrn = .false.
343 this%iexmeth = 0
344 this%ichkmeth = 1
345 this%icycwin = 0
346 this%extol = default_exit_solve_tolerance
347 this%rttol = dsame * dep9
348 this%rtfreq = dzero
349 this%applied_kper = 0
350

◆ prp_ar()

subroutine prtprpmodule::prp_ar ( class(prtprptype), intent(inout) this)
private

Definition at line 354 of file prt-prp.f90.

355 class(PrtPrpType), intent(inout) :: this
356 integer(I4B) :: n
357
358 call this%obs%obs_ar()
359
360 if (this%inamedbound /= 0) then
361 do n = 1, this%nreleasepoints
362 this%boundname(n) = this%rptname(n)
363 end do
364 end if
365 do n = 1, this%nreleasepoints
366 this%nodelist(n) = this%rptnode(n)
367 end do

◆ prp_check_releases()

subroutine prtprpmodule::prp_check_releases ( class(prtprptype), intent(inout) this)
private

Call after release times, the release time frequency and the default are loaded. Then an empty time selection means no time-based releases, and IONPER still holds the first period block's number, or nper + 1 if there is no block to load.

Definition at line 1322 of file prt-prp.f90.

1323 ! modules
1324 use tdismodule, only: nper
1326 ! dummy
1327 class(PrtPrpType), intent(inout) :: this
1328 ! local
1329 integer(I4B), pointer :: ionper
1330 logical(LGP), pointer :: hasperiodblocks
1331 character(len=:), allocatable :: causes
1332
1333 call mem_setptr(ionper, 'IONPER', this%input_mempath)
1334 call mem_setptr(hasperiodblocks, 'HASPERIODBLOCKS', this%input_mempath)
1335
1336 ! releases at times: kept explicit times, frequency, or default
1337 if (allocated(this%schedule%time_select%times)) then
1338 if (size(this%schedule%time_select%times) > 0) return
1339 end if
1340
1341 ! releases from a period block within the run
1342 if (hasperiodblocks .and. ionper <= nper) return
1343
1344 ! name the causes. one applies, or the default would have released.
1345 causes = ''
1346 if (hasperiodblocks) &
1347 causes = 'all PERIOD blocks are numbered above NPER'
1348 if (this%nreleasetimes > 0) then
1349 if (len(causes) > 0) causes = causes//' and '
1350 causes = causes//'all release times are negative or fall after &
1351 &the end of the simulation'
1352 end if
1353 write (warnmsg, '(a)') 'No particles will be released from package '// &
1354 trim(this%packName)//': '//causes//'.'
1355 call store_warning(warnmsg)
integer(i4b), pointer, public nper
number of stress period
Definition tdis.f90:24
Here is the call graph for this function:

◆ prp_commit()

subroutine prtprpmodule::prp_commit ( class(prtprptype) this)
private

Definition at line 495 of file prt-prp.f90.

496 class(PrtPrpType) :: this
497 call this%particles%resize( &
498 this%particles_staging%num_stored(), &
499 this%memoryPath)
500 call this%particles%copy_from(this%particles_staging)

◆ prp_cq_simrate()

subroutine prtprpmodule::prp_cq_simrate ( class(prtprptype) this,
real(dp), dimension(:), intent(in) hnew,
real(dp), dimension(:), intent(inout) flowja,
integer(i4b), intent(in) imover )
private
Parameters
[in,out]flowjaflow between package and model
[in]imoverflag indicating if the mover package is active

Definition at line 774 of file prt-prp.f90.

775 ! modules
776 use tdismodule, only: delt
777 ! dummy variables
778 class(PrtPrpType) :: this
779 real(DP), dimension(:), intent(in) :: hnew
780 real(DP), dimension(:), intent(inout) :: flowja !< flow between package and model
781 integer(I4B), intent(in) :: imover !< flag indicating if the mover package is active
782 ! local variables
783 integer(I4B) :: i
784 integer(I4B) :: node
785 integer(I4B) :: idiag
786 real(DP) :: rrate
787
788 ! If no boundaries, skip flow calculations.
789 if (this%nbound <= 0) return
790
791 ! Loop through each boundary calculating flow.
792 do i = 1, this%nbound
793 node = this%nodelist(i)
794 rrate = dzero
795 ! If cell is no-flow or constant-head, then ignore it.
796 if (node > 0) then
797 ! Calculate the flow rate into the cell.
798 idiag = this%dis%con%ia(node)
799 rrate = this%rptm(i) * (done / delt) ! reciprocal of tstp length
800 flowja(idiag) = flowja(idiag) + rrate
801 end if
802
803 ! Save simulated value to simvals array.
804 this%simvals(i) = rrate
805 end do
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32

◆ prp_create()

subroutine, public prtprpmodule::prp_create ( class(bndtype), pointer packobj,
integer(i4b), intent(in) id,
integer(i4b), intent(in) ibcnum,
integer(i4b), intent(in) inunit,
integer(i4b), intent(in) iout,
character(len=*), intent(in) namemodel,
character(len=*), intent(in) pakname,
type(prtfmitype), pointer fmi,
character(len=*), intent(in), optional input_mempath )

Creates either a standard PRP (reads from input file) or an exchange PRP (programmatically populated). The type is determined by whether input_mempath is provided: if present, standard; if absent, exchange.

Definition at line 129 of file prt-prp.f90.

131 ! dummy
132 class(BndType), pointer :: packobj
133 integer(I4B), intent(in) :: id
134 integer(I4B), intent(in) :: ibcnum
135 integer(I4B), intent(in) :: inunit
136 integer(I4B), intent(in) :: iout
137 character(len=*), intent(in) :: namemodel
138 character(len=*), intent(in) :: pakname
139 character(len=*), intent(in), optional :: input_mempath
140 type(PrtFmiType), pointer :: fmi
141 ! local
142 type(PrtPrpType), pointer :: prpobj
143 type(ExgPrtPrpType), pointer :: exgprpobj
144 ! formats
145 character(len=*), parameter :: fmtheader = &
146 "(1x, /1x, 'PRP PARTICLE RELEASE POINT PACKAGE', &
147 &' INPUT READ FROM MEMPATH: ', a, /)"
148 character(len=*), parameter :: fmtexgheader = &
149 "(1x, /1x, 'PRP-EXG EXCHANGE PARTICLE RELEASE POINT PACKAGE', &
150 &' (PROGRAMMATIC INPUT)', /)"
151
152 if (present(input_mempath)) then
153 ! standard PRP
154 allocate (prpobj)
155 packobj => prpobj
156
157 call packobj%set_names(ibcnum, namemodel, pakname, ftype, input_mempath)
158 prpobj%text = text
159
160 call prpobj%prp_allocate_scalars()
161 call packobj%pack_initialize()
162
163 packobj%inunit = inunit
164 packobj%iout = iout
165 packobj%id = id
166 packobj%ibcnum = ibcnum
167 packobj%ncolbnd = 4
168 packobj%iscloc = 1
169 prpobj%fmi => fmi
170
171 if (inunit > 0) write (iout, fmtheader) input_mempath
172 else
173 ! exchange PRP
174 allocate (exgprpobj)
175 packobj => exgprpobj
176
177 call packobj%set_names(ibcnum, namemodel, pakname, ftype)
178 exgprpobj%text = text
179
180 call exgprpobj%prp_allocate_scalars()
181 call packobj%pack_initialize()
182
183 packobj%inunit = inunit
184 packobj%iout = iout
185 packobj%id = id
186 packobj%ibcnum = ibcnum
187 packobj%ncolbnd = 4
188 packobj%iscloc = 1
189 exgprpobj%fmi => fmi
190
191 if (iout > 0) write (iout, fmtexgheader)
192 end if

◆ prp_da()

subroutine prtprpmodule::prp_da ( class(prtprptype) this)
private

Definition at line 196 of file prt-prp.f90.

197 class(PrtPrpType) :: this
198
199 ! Deallocate parent
200 call this%BndExtType%bnd_da()
201
202 ! Deallocate scalars
203 call mem_deallocate(this%localz)
204 call mem_deallocate(this%extend)
205 call mem_deallocate(this%offset)
206 call mem_deallocate(this%stoptime)
207 call mem_deallocate(this%stoptraveltime)
208 call mem_deallocate(this%istopweaksink)
209 call mem_deallocate(this%istopzone)
210 call mem_deallocate(this%drape)
211 call mem_deallocate(this%idrymeth)
212 call mem_deallocate(this%nreleasepoints)
213 call mem_deallocate(this%nreleasetimes)
214 call mem_deallocate(this%nparticles)
215 call mem_deallocate(this%itrkout)
216 call mem_deallocate(this%itrkhdr)
217 call mem_deallocate(this%itrkcsv)
218 call mem_deallocate(this%irlstls)
219 call mem_deallocate(this%frctrn)
220 call mem_deallocate(this%iexmeth)
221 call mem_deallocate(this%ichkmeth)
222 call mem_deallocate(this%icycwin)
223 call mem_deallocate(this%extol)
224 call mem_deallocate(this%rttol)
225 call mem_deallocate(this%rtfreq)
226
227 ! Deallocate arrays
228 call mem_deallocate(this%rptx)
229 call mem_deallocate(this%rpty)
230 call mem_deallocate(this%rptz)
231 call mem_deallocate(this%rptnode)
232 call mem_deallocate(this%rptm)
233 call mem_deallocate(this%rptname, 'RPTNAME', this%memoryPath)
234
235 ! Deallocate period block storage
236 if (allocated(this%period_block_lines)) deallocate (this%period_block_lines)
237
238 ! Deallocate objects
239 call this%particles%destroy(this%memoryPath)
240 call this%particles_staging%destroy(trim(this%memoryPath)//'-STAGING')
241 call this%schedule%destroy()
242 deallocate (this%particles)
243 deallocate (this%particles_staging)
244 deallocate (this%schedule)

◆ prp_df_obs()

subroutine prtprpmodule::prp_df_obs ( class(prtprptype) this)
private

Definition at line 820 of file prt-prp.f90.

821 ! dummy
822 class(PrtPrpType) :: this
823 ! local
824 integer(I4B) :: indx
825 call this%obs%StoreObsType('prp', .true., indx)
826 this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
827
828 ! Store obs type and assign procedure pointer
829 ! for to-mvr observation type.
830 call this%obs%StoreObsType('to-mvr', .true., indx)
831 this%obs%obsData(indx)%ProcessIdPtr => defaultobsidprocessor
Here is the call graph for this function:

◆ prp_dimensions()

subroutine prtprpmodule::prp_dimensions ( class(prtprptype), intent(inout) this)
private

Definition at line 1029 of file prt-prp.f90.

1030 ! modules
1033 ! dummy variables
1034 class(PrtPrpType), intent(inout) :: this
1035 ! local variables
1036 type(PrtPrpParamFoundType) :: found
1037
1038 call mem_set_value(this%nreleasepoints, 'NRELEASEPTS', this%input_mempath, &
1039 found%nreleasepts)
1040 call mem_set_value(this%nreleasetimes, 'NRELEASETIMES', this%input_mempath, &
1041 found%nreleasetimes)
1042
1043 write (this%iout, '(1x,a)') 'PROCESSING PARTICLE INPUT DIMENSIONS'
1044 write (this%iout, '(4x,a,i0)') 'NRELEASEPTS = ', this%nreleasepoints
1045 write (this%iout, '(4x,a,i0)') 'NRELEASETIMES = ', this%nreleasetimes
1046 write (this%iout, '(1x,a)') 'END OF PARTICLE INPUT DIMENSIONS'
1047
1048 ! set maxbound and nbound to nreleasepts
1049 this%maxbound = this%nreleasepoints
1050 this%nbound = this%nreleasepoints
1051
1052 call this%prp_allocate_arrays()
1053 call this%prp_packagedata()
1054 call this%prp_releasetimes()
1055 call this%prp_load_releasetimefrequency()
1056 call this%prp_load_default_release()
1057 call this%prp_check_releases()

◆ prp_load_default_release()

subroutine prtprpmodule::prp_load_default_release ( class(prtprptype), intent(inout) this)
private

The default depends on the input only: no explicit release times, no release time frequency, and no period blocks. It doesn't depend on the schedule, which only holds the times that will be used, so explicit times that are all dropped don't trigger the default.

The exchange PRP doesn't get this default, on purpose: it carries particles between models and never calls prp_dimensions.

Definition at line 1294 of file prt-prp.f90.

1295 ! modules
1297 ! dummy
1298 class(PrtPrpType), intent(inout) :: this
1299 ! local
1300 logical(LGP), pointer :: hasperiodblocks
1301
1302 ! a period block counts whatever its number, so blocks numbered
1303 ! above nper (never loaded) also suppress the default.
1304 call mem_setptr(hasperiodblocks, 'HASPERIODBLOCKS', this%input_mempath)
1305 if (this%nreleasetimes > 0) return
1306 if (this%rtfreq > dzero) return
1307 if (hasperiodblocks) return
1308
1309 ! Add t=0 to the time selection rather than the time step
1310 ! selection, because the latter would fill forward, releasing
1311 ! at the start of every period.
1312 call this%schedule%time_select%extend([dzero])

◆ prp_load_releasetimefrequency()

subroutine prtprpmodule::prp_load_releasetimefrequency ( class(prtprptype), intent(inout) this)
private

Definition at line 1359 of file prt-prp.f90.

1360 ! modules
1361 use tdismodule, only: totalsimtime
1362 ! dummy
1363 class(PrtPrpType), intent(inout) :: this
1364 ! local
1365 real(DP), allocatable :: times(:)
1366
1367 ! check if a release time frequency is configured
1368 if (this%rtfreq <= dzero) return
1369
1370 ! create array of regularly-spaced release times
1371 times = arange( &
1372 start=dzero, &
1373 stop=totalsimtime, &
1374 step=this%rtfreq)
1375
1376 ! register times with release schedule
1377 call this%schedule%time_select%extend(times)
1378
1379 ! make sure times strictly increase
1380 if (.not. this%schedule%time_select%increasing()) then
1381 errmsg = "Release times must strictly increase"
1382 call store_error(errmsg)
1383 call store_error_filename(this%input_fname)
1384 end if
1385
1386 ! deallocate
1387 deallocate (times)
1388
real(dp), pointer, public totalsimtime
time at end of simulation
Definition tdis.f90:40
Here is the call graph for this function:

◆ prp_log_options()

subroutine prtprpmodule::prp_log_options ( class(prtprptype), intent(inout) this,
type(prtprpparamfoundtype), intent(in) found,
character(len=*), intent(in) trackfile,
character(len=*), intent(in) trackcsvfile )
private

Definition at line 993 of file prt-prp.f90.

994 ! -- modules
996 ! -- dummy variables
997 class(PrtPrpType), intent(inout) :: this
998 type(PrtPrpParamFoundType), intent(in) :: found
999 character(len=*), intent(in) :: trackfile
1000 character(len=*), intent(in) :: trackcsvfile
1001 ! -- local variables
1002 ! formats
1003 character(len=*), parameter :: fmttrkbin = &
1004 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO BINARY FILE: ', a, /4x, &
1005 &'OPENED ON UNIT: ', I0)"
1006 character(len=*), parameter :: fmttrkcsv = &
1007 "(4x, 'PARTICLE TRACKS WILL BE SAVED TO CSV FILE: ', a, /4x, &
1008 &'OPENED ON UNIT: ', I0)"
1009
1010 write (this%iout, '(1x,a)') 'PROCESSING PARTICLE INPUT DIMENSIONS'
1011
1012 if (found%frctrn) then
1013 write (this%iout, '(4x,a)') &
1014 'IF DISV, TRACKING WILL USE THE TERNARY METHOD REGARDLESS OF CELL TYPE'
1015 end if
1016
1017 if (found%trackfile) then
1018 write (this%iout, fmttrkbin) trim(adjustl(trackfile)), this%itrkout
1019 end if
1020
1021 if (found%trackcsvfile) then
1022 write (this%iout, fmttrkcsv) trim(adjustl(trackcsvfile)), this%itrkcsv
1023 end if
1024
1025 write (this%iout, '(1x,a)') 'END OF PARTICLE INPUT DIMENSIONS'

◆ prp_obs_supported()

logical function prtprpmodule::prp_obs_supported ( class(prtprptype) this)
private

Definition at line 814 of file prt-prp.f90.

815 class(PrtPrpType) :: this
816 prp_obs_supported = .true.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prp_options()

subroutine prtprpmodule::prp_options ( class(prtprptype), intent(inout) this)
private

Definition at line 835 of file prt-prp.f90.

836 ! -- modules
839 use openspecmodule, only: access, form
842 ! -- dummy variables
843 class(PrtPrpType), intent(inout) :: this
844 ! -- local variables
845 character(len=LENVARNAME), dimension(3) :: drytrack_method = &
846 &[character(len=LENVARNAME) :: 'DROP', 'STOP', 'STAY']
847 character(len=lenvarname), dimension(2) :: coorcheck_method = &
848 &[character(len=LENVARNAME) :: 'NONE', 'EAGER']
849 character(len=LINELENGTH) :: trackfile, trackcsvfile, fname
850 type(PrtPrpParamFoundType) :: found
851 character(len=*), parameter :: fmtextolwrn = &
852 "('WARNING: EXIT_SOLVE_TOLERANCE is set to ',g10.3,' &
853 &which is much greater than the default value of ',g10.3,'. &
854 &The tolerance that strikes the best balance between accuracy &
855 &and runtime is problem-dependent. Since the variable being &
856 &solved varies from 0 to 1, tolerance values much less than 1 &
857 &typically give the best results.')"
858
859 ! source base class options
860 call this%BndExtType%source_options()
861
862 ! update defaults from input context
863 call mem_set_value(this%stoptime, 'STOPTIME', this%input_mempath, &
864 found%stoptime)
865 call mem_set_value(this%stoptraveltime, 'STOPTRAVELTIME', &
866 this%input_mempath, found%stoptraveltime)
867 call mem_set_value(this%istopweaksink, 'ISTOPWEAKSINK', this%input_mempath, &
868 found%istopweaksink)
869 call mem_set_value(this%istopzone, 'ISTOPZONE', this%input_mempath, &
870 found%istopzone)
871 call mem_set_value(this%drape, 'DRAPE', this%input_mempath, &
872 found%drape)
873 call mem_set_value(this%idrymeth, 'IDRYMETH', this%input_mempath, &
874 drytrack_method, found%idrymeth)
875 call mem_set_value(trackfile, 'TRACKFILE', this%input_mempath, &
876 found%trackfile)
877 call mem_set_value(trackcsvfile, 'TRACKCSVFILE', this%input_mempath, &
878 found%trackcsvfile)
879 call mem_set_value(this%localz, 'LOCALZ', this%input_mempath, &
880 found%localz)
881 call mem_set_value(this%extend, 'EXTEND', this%input_mempath, &
882 found%extend)
883 call mem_set_value(this%extol, 'EXTOL', this%input_mempath, &
884 found%extol)
885 call mem_set_value(this%rttol, 'RTTOL', this%input_mempath, &
886 found%rttol)
887 call mem_set_value(this%rtfreq, 'RTFREQ', this%input_mempath, &
888 found%rtfreq)
889 call mem_set_value(this%frctrn, 'FRCTRN', this%input_mempath, &
890 found%frctrn)
891 call mem_set_value(this%iexmeth, 'IEXMETH', this%input_mempath, &
892 found%iexmeth)
893 call mem_set_value(this%ichkmeth, 'ICHKMETH', this%input_mempath, &
894 coorcheck_method, found%ichkmeth)
895 call mem_set_value(this%icycwin, 'ICYCWIN', this%input_mempath, found%icycwin)
896
897 ! update internal state and validate input
898 if (found%idrymeth) then
899 if (this%idrymeth == 0) then
900 write (errmsg, '(a)') 'Unsupported dry tracking method. &
901 &DRY_TRACKING_METHOD must be "DROP", "STOP", or "STAY"'
902 call store_error(errmsg)
903 else
904 ! adjust for method zero indexing
905 this%idrymeth = this%idrymeth - 1
906 end if
907 end if
908
909 if (found%extol) then
910 if (this%extol <= dzero) &
911 call store_error('EXIT_SOLVE_TOLERANCE MUST BE POSITIVE')
912 if (this%extol > dem2) then
913 write (warnmsg, fmt=fmtextolwrn) &
914 this%extol, default_exit_solve_tolerance
915 call store_warning(warnmsg)
916 end if
917 end if
918
919 if (found%rttol) then
920 if (this%rttol <= dzero) &
921 call store_error('RELEASE_TIME_TOLERANCE MUST BE POSITIVE')
922 end if
923
924 if (found%rtfreq) then
925 if (this%rtfreq <= dzero) &
926 call store_error('RELEASE_TIME_FREQUENCY MUST BE POSITIVE')
927 end if
928
929 if (found%iexmeth) then
930 if (.not. (this%iexmeth /= 1 .or. this%iexmeth /= 2)) &
931 call store_error('DEV_EXIT_SOLVE_METHOD MUST BE &
932 &1 (BRENT) OR 2 (CHANDRUPATLA)')
933 end if
934
935 if (found%ichkmeth) then
936 if (this%ichkmeth == 0) then
937 write (errmsg, '(a)') 'Unsupported coordinate check method. &
938 &COORDINATE_CHECK_METHOD must be "NONE" or "EAGER"'
939 call store_error(errmsg)
940 else
941 ! adjust for method zero based indexing
942 this%ichkmeth = this%ichkmeth - 1
943 end if
944 end if
945
946 if (found%icycwin) then
947 if (this%icycwin < 0) &
948 call store_error('CYCLE_DETECTION_WINDOW MUST BE NON-NEGATIVE')
949 end if
950
951 ! fileout options
952 if (found%trackfile) then
953 this%itrkout = getunit()
954 call openfile(this%itrkout, this%iout, trackfile, 'DATA(BINARY)', &
955 form, access, filstat_opt='REPLACE', &
956 mode_opt=mnormal)
957 ! open and write ascii header spec file
958 this%itrkhdr = getunit()
959 fname = trim(trackfile)//'.hdr'
960 call openfile(this%itrkhdr, this%iout, fname, 'CSV', &
961 filstat_opt='REPLACE', mode_opt=mnormal)
962 write (this%itrkhdr, '(a,/,a)') trackheader, trackdtypes
963 end if
964
965 if (found%trackcsvfile) then
966 this%itrkcsv = getunit()
967 call openfile(this%itrkcsv, this%iout, trackcsvfile, 'CSV', &
968 filstat_opt='REPLACE')
969 write (this%itrkcsv, '(a)') trackheader
970 end if
971
972 ! terminate if any errors were detected
973 if (count_errors() > 0) then
974 call store_error_filename(this%input_fname)
975 end if
976
977 ! log found options
978 call this%prp_log_options(found, trackfile, trackcsvfile)
979
980 ! Create release schedule now that we know
981 ! the coincident release time tolerance
982 this%schedule => create_release_schedule(tolerance=this%rttol)
This module contains simulation constants.
Definition Constants.f90:9
@ mnormal
normal output mode
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition Constants.f90:17
real(dp), parameter dzero
real constant zero
Definition Constants.f90:65
real(dp), parameter dem2
real constant 1e-2
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
character(len=20) access
Definition OpenSpec.f90:7
character(len=20) form
Definition OpenSpec.f90:7
Here is the call graph for this function:

◆ prp_packagedata()

subroutine prtprpmodule::prp_packagedata ( class(prtprptype), intent(inout) this)
private

Definition at line 1074 of file prt-prp.f90.

1077 use geomutilmodule, only: get_node
1079 ! dummy
1080 class(PrtPrpType), intent(inout) :: this
1081 ! local
1082 integer(I4B), dimension(:), pointer, contiguous :: irptno
1083 integer(I4B), dimension(:, :), pointer, contiguous :: cellids
1084 real(DP), dimension(:), pointer, contiguous :: xrpts, yrpts, zrpts
1085 type(CharacterStringType), dimension(:), pointer, &
1086 contiguous :: boundnames
1087 character(len=LENBOUNDNAME) :: bndName, bndNameTemp
1088 character(len=9) :: cno
1089 character(len=20) :: cellidstr
1090 integer(I4B), dimension(:), allocatable :: nboundchk
1091 integer(I4B), dimension(:), pointer :: cellid
1092 integer(I4B) :: n, noder, nodeu, rptno
1093
1094 ! set input context pointers
1095 call mem_setptr(irptno, 'IRPTNO', this%input_mempath)
1096 call mem_setptr(cellids, 'CELLID', this%input_mempath)
1097 call mem_setptr(xrpts, 'XRPT', this%input_mempath)
1098 call mem_setptr(yrpts, 'YRPT', this%input_mempath)
1099 call mem_setptr(zrpts, 'ZRPT', this%input_mempath)
1100 call mem_setptr(boundnames, 'BOUNDNAME', this%input_mempath)
1101
1102 ! allocate and initialize temporary variables
1103 allocate (nboundchk(this%nreleasepoints))
1104 do n = 1, this%nreleasepoints
1105 nboundchk(n) = 0
1106 end do
1107
1108 write (this%iout, '(/1x,a)') 'PROCESSING '//trim(adjustl(this%packName)) &
1109 //' PACKAGEDATA'
1110
1111 do n = 1, size(irptno)
1112
1113 rptno = irptno(n)
1114
1115 if (rptno < 1 .or. rptno > this%nreleasepoints) then
1116 write (errmsg, '(a,i0,a,i0,a)') &
1117 'Expected ', this%nreleasepoints, ' release points. &
1118 &Points must be numbered from 1 to ', this%nreleasepoints, '.'
1119 call store_error(errmsg)
1120 cycle
1121 end if
1122
1123 ! increment nboundchk
1124 nboundchk(rptno) = nboundchk(rptno) + 1
1125
1126 ! set cellid
1127 cellid => cellids(:, n)
1128
1129 ! set node user
1130 if (this%dis%ndim == 1) then
1131 nodeu = cellid(1)
1132 elseif (this%dis%ndim == 2) then
1133 nodeu = get_node(cellid(1), 1, cellid(2), &
1134 this%dis%mshape(1), 1, &
1135 this%dis%mshape(2))
1136 else
1137 nodeu = get_node(cellid(1), cellid(2), cellid(3), &
1138 this%dis%mshape(1), &
1139 this%dis%mshape(2), &
1140 this%dis%mshape(3))
1141 end if
1142
1143 ! set noder
1144 noder = this%dis%get_nodenumber(nodeu, 1)
1145 if (noder <= 0) then
1146 call this%dis%nodeu_to_string(nodeu, cellidstr)
1147 write (errmsg, '(a)') &
1148 'Particle release point configured for nonexistent cell: '// &
1149 trim(adjustl(cellidstr))//'. This cell has IDOMAIN <= 0 and '&
1150 &'therefore does not exist in the model grid.'
1151 call store_error(errmsg)
1152 cycle
1153 else
1154 this%rptnode(rptno) = noder
1155 end if
1156
1157 if (this%localz .and. (zrpts(n) < 0 .or. zrpts(n) > 1)) then
1158 call store_error('Local z coordinate must fall in the interval [0, 1]')
1159 cycle
1160 end if
1161
1162 ! set coordinates
1163 this%rptx(rptno) = xrpts(n)
1164 this%rpty(rptno) = yrpts(n)
1165 this%rptz(rptno) = zrpts(n)
1166
1167 ! set default boundname
1168 write (cno, '(i9.9)') rptno
1169 bndname = 'PRP'//cno
1170
1171 ! read boundnames from file, if provided
1172 if (this%inamedbound /= 0) then
1173 bndnametemp = boundnames(n)
1174 if (bndnametemp /= '') bndname = bndnametemp
1175 else
1176 bndname = ''
1177 end if
1178
1179 ! set boundname
1180 this%rptname(rptno) = bndname
1181 end do
1182
1183 write (this%iout, '(1x,a)') &
1184 'END OF '//trim(adjustl(this%packName))//' PACKAGEDATA'
1185
1186 ! check for duplicate or missing particle release points
1187 do n = 1, this%nreleasepoints
1188 if (nboundchk(n) == 0) then
1189 write (errmsg, '(a,a,1x,i0,a)') 'No data specified for particle ', &
1190 'release point', n, '.'
1191 call store_error(errmsg)
1192 else if (nboundchk(n) > 1) then
1193 write (errmsg, '(a,1x,i0,1x,a,1x,i0,1x,a)') &
1194 'Data for particle release point', n, 'specified', nboundchk(n), &
1195 'times.'
1196 call store_error(errmsg)
1197 end if
1198 end do
1199
1200 ! terminate if any errors were detected
1201 if (count_errors() > 0) then
1202 call store_error_filename(this%input_fname)
1203 end if
1204
1205 ! cleanup
1206 deallocate (nboundchk)
1207
1208 call memorystore_release('IRPTNO', this%input_mempath)
1209 call memorystore_release('CELLID', this%input_mempath)
1210 call memorystore_release('XRPT', this%input_mempath)
1211 call memorystore_release('YRPT', this%input_mempath)
1212 call memorystore_release('ZRPT', this%input_mempath)
1213 call memorystore_release('BOUNDNAME', this%input_mempath)
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
Definition GeomUtil.f90:92
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
Here is the call graph for this function:

◆ prp_releasetimes()

subroutine prtprpmodule::prp_releasetimes ( class(prtprptype), intent(inout) this)
private

Definition at line 1217 of file prt-prp.f90.

1218 use tdismodule, only: totalsimtime
1220 ! dummy
1221 class(PrtPrpType), intent(inout) :: this
1222 ! local
1223 real(DP), dimension(:), pointer, contiguous :: time
1224 integer(I4B) :: n, isize
1225 real(DP) :: t
1226 real(DP), allocatable :: times(:)
1227
1228 if (this%nreleasetimes <= 0) return
1229
1230 ! check if input array was read
1231 call get_isize('TIME', this%input_mempath, isize)
1232
1233 if (isize <= 0) then
1234 errmsg = "RELEASTIMES block expected when &
1235 &NRELEASETIMES dimension is non-zero."
1236 call store_error(errmsg)
1237 call store_error_filename(this%input_fname)
1238 end if
1239
1240 ! set input context pointer
1241 call mem_setptr(time, 'TIME', this%input_mempath)
1242
1243 ! make sure times strictly increase, as given
1244 do n = 2, size(time)
1245 if (time(n) <= time(n - 1)) then
1246 errmsg = "RELEASTIMES block entries must strictly increase."
1247 call store_error(errmsg)
1248 call store_error_filename(this%input_fname)
1249 exit
1250 end if
1251 end do
1252
1253 ! Keep only release times that will be used. Drop negative times,
1254 ! and, unless EXTEND_TRACKING is on, times after the end of the
1255 ! simulation. Deciding here rather than at each time step keeps
1256 ! the schedule to the releases that actually happen. Options are
1257 ! read before dimensions, so EXTEND_TRACKING is known here.
1258 allocate (times(0))
1259 do n = 1, size(time)
1260 t = time(n)
1261 if (t < dzero) then
1262 write (warnmsg, '(a,g0,a)') &
1263 'Skipping negative release time (t=', t, ').'
1264 call store_warning(warnmsg)
1265 cycle
1266 else if (t > totalsimtime .and. .not. this%extend) then
1267 write (warnmsg, '(a,g0,a)') &
1268 'Skipping release time falling after the end of the &
1269 &simulation (t=', t, '). Enable EXTEND_TRACKING to &
1270 &release particles after the simulation end time.'
1271 call store_warning(warnmsg)
1272 cycle
1273 end if
1274 times = [times, t]
1275 end do
1276
1277 ! register times with the release schedule
1278 call this%schedule%time_select%extend(times)
1279
1280 ! deallocate
1281 deallocate (times)
subroutine, public get_isize(name, mem_path, isize)
Get the number of elements for this variable.
Here is the call graph for this function:

◆ prp_rp()

subroutine prtprpmodule::prp_rp ( class(prtprptype), intent(inout) this)
private

Definition at line 739 of file prt-prp.f90.

740 ! modules
741 use tdismodule, only: kper
744 ! dummy variables
745 class(PrtPrpType), intent(inout) :: this
746 ! local variables
747 type(CharacterStringType), dimension(:), contiguous, &
748 pointer :: settings
749 integer(I4B), pointer :: iper, nlist
750 integer(I4B) :: n
751
752 ! return if no period block was loaded for this period
753 call mem_setptr(iper, 'IPER', this%input_mempath)
754 if (iper /= kper) return
755
756 ! set input context pointers
757 call mem_setptr(nlist, 'NBOUND', this%input_mempath)
758 call mem_setptr(settings, 'SETTING', this%input_mempath)
759
760 ! Store period block configuration for fill-forward.
761 if (allocated(this%period_block_lines)) deallocate (this%period_block_lines)
762 allocate (this%period_block_lines(nlist))
763 do n = 1, nlist
764 this%period_block_lines(n) = settings(n)
765 end do

◆ prp_set_pointers()

subroutine prtprpmodule::prp_set_pointers ( class(prtprptype) this,
integer(i4b), dimension(:), pointer, contiguous ibound,
integer(i4b), dimension(:), pointer, contiguous izone )
private

Definition at line 248 of file prt-prp.f90.

249 class(PrtPrpType) :: this
250 integer(I4B), dimension(:), pointer, contiguous :: ibound
251 integer(I4B), dimension(:), pointer, contiguous :: izone
252
253 this%ibound => ibound
254 this%rptzone => izone

◆ release()

subroutine prtprpmodule::release ( class(prtprptype), intent(inout) this,
integer(i4b), intent(in) ip,
real(dp), intent(in) trelease )
private

Releasing a particle entails validating the particle's coordinates and settings, transforming its coordinates if needed, initializing the particle's initial tracking time to the given release time, storing the particle in the particle store (from which the PRT model will later retrieve it, apply the tracking method, and check it in again), and accumulating the particle's mass (the total mass released from each release point is calculated for budget reporting).

Parameters
[in,out]thisthis instance
[in]ipparticle index
[in]treleaserelease time

Definition at line 606 of file prt-prp.f90.

607 ! dummy
608 class(PrtPrpType), intent(inout) :: this !< this instance
609 integer(I4B), intent(in) :: ip !< particle index
610 real(DP), intent(in) :: trelease !< release time
611 ! local
612 integer(I4B) :: np
613 type(ParticleType), pointer :: particle
614
615 call this%initialize_particle(particle, ip, trelease)
616 np = this%nparticles + 1
617 this%nparticles = np
618 call this%particles_staging%put(particle, np)
619 deallocate (particle)
620 this%rptm(ip) = this%rptm(ip) + done ! TODO configurable mass
621

◆ validate_release_point()

subroutine prtprpmodule::validate_release_point ( class(prtprptype), intent(inout) this,
integer(i4b), intent(in) ic,
real(dp), intent(in) x,
real(dp), intent(in) y,
real(dp), intent(in) z )
private

Terminate with an error if the release point lies outside the given cell, or if the point is above or below the grid top or bottom, respectively.

Parameters
[in,out]thisthis instance
[in]iccell index
[in]zrelease point

Definition at line 553 of file prt-prp.f90.

554 class(PrtPrpType), intent(inout) :: this !< this instance
555 integer(I4B), intent(in) :: ic !< cell index
556 real(DP), intent(in) :: x, y, z !< release point
557 ! local
558 real(DP), allocatable :: polyverts(:, :)
559 real(DP) :: cellsize, tol
560
561 call this%fmi%dis%get_polyverts(ic, polyverts)
562 ! Check that the point is within the cell. The point-in-polygon
563 ! check is exact by default, which is unreliable when coords are
564 ! are rotated or very large relative to the cell's size: release
565 ! points on or very close to the cell edge could be rejected as
566 ! outside the cell. Give the check a tolerance scaled to the
567 ! cell extent to reduce sensitivity to coordinate inexactness.
568 cellsize = max(maxval(polyverts(1, :)) - minval(polyverts(1, :)), &
569 maxval(polyverts(2, :)) - minval(polyverts(2, :)))
570 tol = cellsize * cellsize * dem7
571 if (.not. point_in_polygon(x, y, polyverts, tol)) then
572 write (errmsg, '(a,g0,a,g0,a,i0)') &
573 'Error: release point (x=', x, ', y=', y, ') is not in cell ', &
574 this%dis%get_nodeuser(ic)
575 call store_error(errmsg, terminate=.false.)
576 call store_error_filename(this%input_fname)
577 end if
578 if (z > maxval(this%dis%top)) then
579 write (errmsg, '(a,g0,a,g0,a,i0)') &
580 'Error: release point (z=', z, ') is above grid top ', &
581 maxval(this%dis%top)
582 call store_error(errmsg, terminate=.false.)
583 call store_error_filename(this%input_fname)
584 else if (z < minval(this%dis%bot)) then
585 write (errmsg, '(a,g0,a,g0,a,i0)') &
586 'Error: release point (z=', z, ') is below grid bottom ', &
587 minval(this%dis%bot)
588 call store_error(errmsg, terminate=.false.)
589 call store_error_filename(this%input_fname)
590 end if
591 deallocate (polyverts)
Here is the call graph for this function:

Variable Documentation

◆ default_exit_solve_tolerance

real(dp), parameter prtprpmodule::default_exit_solve_tolerance = DEM5
private

Definition at line 36 of file prt-prp.f90.

◆ ftype

character(len=lenftype) prtprpmodule::ftype = 'PRP'
private

Definition at line 34 of file prt-prp.f90.

◆ text

character(len=16) prtprpmodule::text = ' PRP'
private

Definition at line 35 of file prt-prp.f90.