Skip to contents

Compatibility route that reproduces, byte for byte once saved with saveRDS(), the global kmaxTable product that the kmax step of newmark 1.7.1 assembles with its getKmaxTable() from the site kmaxTable products of buildKmaxTable(), so that the stored project tables can serve as comparison oracle. With one site, as in the current projects, the global table equals the table of that site.

Usage

assembleKmaxTables(tables, shear, modelID, TR, weights, DaH)

Arguments

tables

Named list of site kmaxTable products, one per site identifier.

shear, modelID, weights, DaH

As for buildKmaxTable().

TR

Distinct positive return periods of the model demands, in years. A repeated period stops the call at the row count of the site tables, whereas buildKmaxTable() drops the repeat.

Value

A data.table of the rows of every site, keyed by siteID, ID, TR, IDg, IDm, IDn, p and Da, with the columns of buildKmaxTable(). The caller's tables are not modified.

Semantics reproduced from newmark 1.7.1

Every site table is checked as buildKmaxTable() checks its own, except against its PGA table: the global assembly does not read the per-site PGA tables, which buildKmaxTable() validates, with each site table against its own, when it builds that table. A site table is checked against the mean rows of the shear table, the demands of modelID at TR and of the MCE, the models of weights and every family with an active member, the eight levels of p and the levels \(D_a = D_{aH} H_s\) cm rounded to six significant digits over every height of the shear table. The tables are stacked in the order of tables and keyed by siteID, ID, TR, IDg, IDm, IDn, p and Da, and a warning labelled global reports the rows that rely on roots beyond the stored grid and the largest such kmax. The number of realizations is not an argument, and of weights only the names are used: the table records neither the number of realizations nor the numerical weights that generated it, so a stored table cannot be checked against them.

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))
Global <- assembleKmaxTables(list(TST = Kmax), shear = Shear, modelID = "TEST", TR = 100,
                             weights = Weights, DaH = c(0.05, 0.1))
# With one site, the global table equals the table of that site.
identical(Global, Kmax)
#> [1] TRUE