write.PBJpackage: Writes Modflow-USG Polyline Boundary Junction Package

Description Usage Arguments Details Examples

View source: R/write.PBJpackage.R

Description

Writes Modflow-USG Polyline Boundary Junction Package

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
write.PBJpackage(
  swdf,
  filename,
  nSPs,
  IPBJCB,
  pbjmode = "DRAIN",
  condtype = "UNITCOND",
  SPwarnings = T,
  allowconst = T
)

Arguments

swdf

DataFrame/Geometry of node barycentric coordinates as returned by calc_stream_voronoi_weights with conductances and elevation columns required for segment start/ends (e.g. 'seg2.elev' & 'seg1.elev'; 'seg1.cond[sp]' and'seg2.cond[sp]') Conductance columns are used regardless of condtype (e.g. Leakance Coefficients for stress periods should be passed through Conductance columns). Stress period numbers should suffix all time varying column numbers, unless constant. See details for more info.

filename

character, name/location of output file

nSPs

integer, number of stress periods in simulation

IPBJCB

integer, CBB flow flag. See details (or PBJ package manual) for more info

pbjmode

character, PBJ package mode. See details (or PBJ package manual) for more info. One of "HEADSPEC", "DRAIN", or "EXTSTAGE". Default: 'DRAIN'

condtype

character, conductance type to be used. See details (or PBJ package manual) for more info One of "CONDUCTANCE", "UNITCOND", or "LEAKCOEF". Default: 'UNITCOND'.

SPwarnings

T/F (optional) turn on (True) or off (False) warnings about reused or missing SP data

allowconst

T/F (optional) allow SP arrays to be written using the CONSTANT flag (default: True)

seg_sort

T/F (optional) whether swdf should be sorted by segment prior to output (default: True)

Details

Attention is required in the naming of the time-varying columns in relation to stress periods. Conductance, head, and stage columns must be passed with specific stress period numbers after their name (e.g. 'seg1.head2'). Missing stress periods (e.g. 'seg1.stage4' followed by 'seg1.stage6') are assumed to specify the previous stress period value should be reused.

Conductances (leakance coefficents, etc), specified heads, and externals stages are all defined at both the segment start and end (like elevations) using the prefixes 'seg1' and 'seg2'. For instance, conductances (leakance, etc) should be specified by the columns 'seg1.cond[sp]' and'seg2.cond[sp]'; specified heads using the columns 'seg1.head[sp]' and'seg2.head[sp]'; and stages using the columns 'seg1.stage[sp]' and 'seg2.stage[sp]'.

NAs in any time-variant column will be treated that segment is not active in the stress period. Consistency with other SP parameters is NOT be checked. When using the external head-dependent boundary option (EXTSTAGE) this means you'll want to make sure Stage and Conductance are inactive (NAs) for the same stress periods.

If IPBJCB is > 0, cell-by-cell flow terms will be written to this unit number when “SAVE BUDGET” or a non-zero value for ICBCFL is specified in the output control If IPBJCB = 0, cell-by-cell flow terms are not written If IPBJCB < 0, segment leakance for each segment will be written to the listing file when “SAVE BUDGET” or a non-zero value for ICBCFL is specified in the output control

Mode specifies if the segments should act as a:

Condtype (conductance type) specifies if the stress period segment conductances are input as:

The conductance type is ignored (not needed) if the mode is set to head-specified.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
write.PBJpackage
#-- Read in shapefiles
str <- read_sf(system.file("extdata", "MehlandHill2010_stream.shp", package = "pbjr"))
tri <- read_sf(system.file("extdata", "720_triangles.shp", package = "pbjr"))
vor <- read_sf(system.file("extdata", "720_voronoi.shp", package = "pbjr"))
str <- line_explode(str)

#-- Calculate barycentric weight DF
swdf <- calc_stream_voronoi_weights(stream = str, voronoi = vor, triangles = tri)

#-- Calculate distances
swdf <- stream_elev_from_slope(swdf = swdf, slope = 0.0015, initial_elev = 50)

#-- Calculate conductances
swdf$seg1.cond1 <- calc_conductance_modflow(swdf, k_streambed = 1,
                                            str_width = 1, thickness = 0.5)
swdf$seg2.cond1 <- calc_conductance_modflow(swdf, k_streambed = 1,
                                            str_width = 1, thickness = 0.5)
#-- Write package file
write.PBJpackage(swdf, filename = paste0(tempdir(),'/model720.pbj'), nSPs=2, IPBJCB=50)

scantle/pbjr documentation built on Dec. 22, 2021, 10:19 p.m.