Skip to contents

Compatibility route that reproduces, byte for byte once saved with saveRDS(), the site kmaxTable product of the fitKmaxProducts() function of newmark 1.7.1, so that the stored project tables can serve as comparison oracle. For every demand (each return period of TR and the MCE), geometry and material of the site, the realizations of every active model are inverted with solveKmax() and summarized, model by model and for each model family, with the pooled summary of summarizeKmax(). With one site, as in the current projects, this table is also the global kmaxTable of 1.7.1.

Usage

buildKmaxTable(draws, PGATable, shear, modelID, siteID, TR, NS, weights, DaH)

Arguments

draws

The DnDraws product of the site: IDg, IDm, ID, TR, ky, s, PGA.s, IDn, Dn, siteID and units.Dn, in this order, the realizations of one cell sharing one ky grid.

PGATable

The PGATable product of the site as read back from its CSV: IDg, IDm, ID, TR, PGA, Vs30, siteID and units.PGA, in this order, with TR numeric and NA on the MCE rows. It is named after the product because PGA names the numeric acceleration elsewhere.

shear

The shear table of buildShearTable(); its heights Hs fix the levels and its mean rows supply Ts and VS30.

modelID

Identifier of the hazard model, the ID of the return-period demands.

siteID

Identifier of the site.

TR

Positive return periods of the model demands, in years.

NS

Number of realizations of every curve.

weights

Positive weights named by the active displacement models.

DaH

Distinct positive admissible displacements in percent of the height.

Value

A data.table keyed by siteID, ID, TR, IDg, IDm, IDn, p and Da, with columns IDg, IDm, p ("mean" or the probability as "%.2f"), ID (modelID or "MCE"), TR (years, NA for the MCE), Da (cm), kmax (g), the mean or quantile of the yield coefficient that limits the displacement to Da over the pooled realizations of the model or family IDn under that demand, geometry and material, PGA (g), Kh (ratio), beyond (weighted share of the pool beyond the stored grid), Ts (s), Vs30 (m/s), IDn, siteID and the unit columns units.Da ("cm"), units.kmax and units.PGA ("g") and units.Kh ("ratio"). The caller's tables are not modified.

Semantics reproduced from newmark 1.7.1

Every geometry is inverted at the same levels, the union over all the heights of the shear table of \(D_a = D_{aH} H_s\) cm rounded to six significant digits, so a geometry's own levels are the rows whose Da equals signif(DaH * Hs, 6) for its height. Each model is summarized alone with weight 1; the families ensemble, rigid and flexible of the displacement models pool their active members with their weights normalized, and normalized once more by the summary. The levels are the mean and the probabilities 0.05, 0.10, 0.16, 0.50, 0.84, 0.90 and 0.95. The quantiles are those of Hmisc::wtd.quantile() as 1.7.1 called it: once the pool of one Da holds a tie (a saturated root of 0 or a root at the grid resolution), every pooled value is read back from its 15-significant-digit text before the quantile, while the mean uses the exact roots; summarizeKmax() has no such text step. PGA is the amplified peak ground acceleration of the cell as read back from the CSV of the PGA table, Kh = kmax / PGA is a dimensionless ratio (the exported fitKmaxScenario() of 1.7.1 returned 100 kmax / PGA, which its product replaced by the ratio), and Ts and Vs30 are the fundamental period of the shear beam and VS30 of the mean row of the geometry and material in the shear table. The inputs are checked as 1.7.1 checked them (schema, 30 distinct ky per curve spanning 0.01 g to max(PGA, 0.8) g, one sampled PGA per realization, NS realizations of every active model, coverage of the PGA table); the result is checked and keyed by siteID, ID, TR, IDg, IDm, IDn, p and Da, and a warning reports the rows that rely on roots beyond the stored grid and the largest such kmax.

Examples

# The inputs of the product test of newmark 1.7.1: one rock lognormal per
# period, its MCE quantiles and two geometry-material pairs,
# here with the heights Hs from which the levels of DaH are derived.
Rock <- data.table::data.table(ID = "TEST", siteID = "TST", TR = 100, Tn = c(0, 0.2, 1),
                               Sa = c(0.3, 0.45, 0.24), Vs30 = 760, Vref = 760)
Rock[, `:=`(SaF = Sa, AF = NA_real_, k = "oq", muLn = log(Sa) - 0.4^2 / 2, sigmaLn = 0.4,
            w = 1, fitErr = 0)]
#>        ID siteID    TR    Tn    Sa  Vs30  Vref   SaF    AF      k       muLn
#>    <char> <char> <num> <num> <num> <num> <num> <num> <num> <char>      <num>
#> 1:   TEST    TST   100   0.0  0.30   760   760  0.30    NA     oq -1.2839728
#> 2:   TEST    TST   100   0.2  0.45   760   760  0.45    NA     oq -0.8785077
#> 3:   TEST    TST   100   1.0  0.24   760   760  0.24    NA     oq -1.5071164
#>    sigmaLn     w fitErr
#>      <num> <num>  <num>
#> 1:     0.4     1      0
#> 2:     0.4     1      0
#> 3:     0.4     1      0
Levels <- c(0.05, 0.10, 0.16, 0.50, 0.84, 0.90, 0.95)
MCE <- Rock[, .(p = c(sprintf("%.2f", Levels), "mean"),
                Sa = c(exp(muLn + 0.4 * qnorm(Levels)), Sa)), by = Tn]
MCE[, `:=`(ID = "MCE", siteID = "TST", Vs30 = 760, Vref = 760)]
#>        Tn      p        Sa     ID siteID  Vs30  Vref
#>     <num> <char>     <num> <char> <char> <num> <num>
#>  1:   0.0   0.05 0.1434291    MCE    TST   760   760
#>  2:   0.0   0.10 0.1658630    MCE    TST   760   760
#>  3:   0.0   0.16 0.1860470    MCE    TST   760   760
#>  4:   0.0   0.50 0.2769349    MCE    TST   760   760
#>  5:   0.0   0.84 0.4122235    MCE    TST   760   760
#>  6:   0.0   0.90 0.4623874    MCE    TST   760   760
#>  7:   0.0   0.95 0.5347097    MCE    TST   760   760
#>  8:   0.0   mean 0.3000000    MCE    TST   760   760
#>  9:   0.2   0.05 0.2151437    MCE    TST   760   760
#> 10:   0.2   0.10 0.2487944    MCE    TST   760   760
#> 11:   0.2   0.16 0.2790705    MCE    TST   760   760
#> 12:   0.2   0.50 0.4154024    MCE    TST   760   760
#> 13:   0.2   0.84 0.6183352    MCE    TST   760   760
#> 14:   0.2   0.90 0.6935811    MCE    TST   760   760
#> 15:   0.2   0.95 0.8020645    MCE    TST   760   760
#> 16:   0.2   mean 0.4500000    MCE    TST   760   760
#> 17:   1.0   0.05 0.1147433    MCE    TST   760   760
#> 18:   1.0   0.10 0.1326904    MCE    TST   760   760
#> 19:   1.0   0.16 0.1488376    MCE    TST   760   760
#> 20:   1.0   0.50 0.2215479    MCE    TST   760   760
#> 21:   1.0   0.84 0.3297788    MCE    TST   760   760
#> 22:   1.0   0.90 0.3699099    MCE    TST   760   760
#> 23:   1.0   0.95 0.4277677    MCE    TST   760   760
#> 24:   1.0   mean 0.2400000    MCE    TST   760   760
#>        Tn      p        Sa     ID siteID  Vs30  Vref
#>     <num> <char>     <num> <char> <char> <num> <num>
Shear <- data.table::data.table(IDg = c("G1", "G2"), IDm = c("U1", "U2"), Hs = c(10, 120),
                                VS30 = c(360, 560), Ts = 0.3, Vref = 760, level = "mean")
Weights <- c(AM88 = 1, BM19 = 1)
Site <- buildDnTables(Rock, MCE, Shear, modelID = "TEST", siteID = "TST", TR = 100, Vref = 760,
                      Mw = 7, NS = 2, weights = Weights, zTrunc = 3, workers = 1)
PGATable <- buildPGATable(Rock, MCE, Shear, modelID = "TEST", siteID = "TST", TR = 100)
Kmax <- buildKmaxTable(Site$DnDraws, PGATable = PGATable, shear = Shear, modelID = "TEST",
                       siteID = "TST", TR = 100, NS = 2, weights = Weights, DaH = c(0.05, 0.1))
Kmax[IDn == "ensemble" & p == "0.50"]
#> Key: <siteID, ID, TR, IDg, IDm, IDn, p, Da>
#>        IDg    IDm      p     ID    TR    Da       kmax       PGA        Kh
#>     <char> <char> <char> <char> <num> <num>      <num>     <num>     <num>
#>  1:     G1     U1   0.50    MCE    NA   0.5 0.41288009 0.3105343 1.3295798
#>  2:     G1     U1   0.50    MCE    NA   1.0 0.31371872 0.3105343 1.0102548
#>  3:     G1     U1   0.50    MCE    NA   6.0 0.13953221 0.3105343 0.4493295
#>  4:     G1     U1   0.50    MCE    NA  12.0 0.09442778 0.3105343 0.3040817
#>  5:     G2     U2   0.50    MCE    NA   0.5 0.32060938 0.3138623 1.0214971
#>  6:     G2     U2   0.50    MCE    NA   1.0 0.26008275 0.3138623 0.8286525
#>  7:     G2     U2   0.50    MCE    NA   6.0 0.13857553 0.3138623 0.4415170
#>  8:     G2     U2   0.50    MCE    NA  12.0 0.10865460 0.3138623 0.3461856
#>  9:     G1     U1   0.50   TEST   100   0.5 0.42861681 0.3101314 1.3820493
#> 10:     G1     U1   0.50   TEST   100   1.0 0.31534976 0.3101314 1.0168264
#> 11:     G1     U1   0.50   TEST   100   6.0 0.12873085 0.3101314 0.4150849
#> 12:     G1     U1   0.50   TEST   100  12.0 0.09162455 0.3101314 0.2954379
#> 13:     G2     U2   0.50   TEST   100   0.5 0.45283454 0.3136679 1.4436752
#> 14:     G2     U2   0.50   TEST   100   1.0 0.35933051 0.3136679 1.1455764
#> 15:     G2     U2   0.50   TEST   100   6.0 0.17025170 0.3136679 0.5427770
#> 16:     G2     U2   0.50   TEST   100  12.0 0.12238609 0.3136679 0.3901773
#>     beyond    Ts  Vs30      IDn siteID units.Da units.kmax units.PGA units.Kh
#>      <num> <num> <num>   <char> <char>   <char>     <char>    <char>   <char>
#>  1:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#>  2:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#>  3:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#>  4:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#>  5:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#>  6:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#>  7:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#>  8:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#>  9:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#> 10:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#> 11:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#> 12:      0   0.3   360 ensemble    TST       cm          g         g    ratio
#> 13:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#> 14:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#> 15:      0   0.3   560 ensemble    TST       cm          g         g    ratio
#> 16:      0   0.3   560 ensemble    TST       cm          g         g    ratio