Skip to contents

Compatibility route that reproduces, value for value, the global DnTable and DnPlotTable that the dn step of newmark 1.7.1 assembles from the site DnTable products of buildDnTables(), for comparison with the installed library.

Usage

assembleDnTables(tables, shear, weights, modelID, TR, Vref)

Arguments

tables

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

shear, weights, modelID, TR, Vref

As for buildDnTables().

Value

A list with the keyed data.tables DnTable (all sites) and DnPlotTable (siteID, ID, TR, IDg, IDn, p, ky in g and Dn in cm, keyed by the first seven). The site tables are not modified.

Semantics reproduced from newmark 1.7.1

Every site table is checked against the product contract and the shear table, the tables are stacked and keyed by siteID, ID, TR, IDg, IDm, IDn, p and ky. The plot table averages the material curves of each site, demand, geometry, model and level on a common grid: rows with \(D_n \le 10^{-4}\) cm are dropped; the grid has \(N = \max(2, \mathrm{round}(\mathrm{median}_m\, n_m))\) points log-spaced between the smallest and largest remaining \(k_y\), where \(n_m\) counts the distinct \(k_y\) of material \(m\); each material curve is interpolated linearly in \((\ln k_y, \ln D_n)\) without extrapolation (stats::approx, rule = 1, ties averaged), the finite values are averaged arithmetically over materials, and the points at or below \(10^{-4}\) cm are dropped again. It is a display product: the average over materials has no probabilistic meaning of its own.

Examples

# \donttest{
# The inputs of the product test of newmark 1.7.1: one rock lognormal per
# period, its MCE quantiles and two geometry-material pairs.
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"), VS30 = c(360, 560),
                                Ts = 0.3, Vref = 760, level = "mean")
Site <- buildDnTables(Rock, MCE, Shear, modelID = "TEST", siteID = "TST", TR = 100, Vref = 760,
                      Mw = 7, NS = 2, weights = c(AM88 = 1, BM19 = 1), zTrunc = 3, workers = 1)
Global <- assembleDnTables(list(TST = Site$DnTable), shear = Shear, weights = c(AM88 = 1, BM19 = 1),
                           modelID = "TEST", TR = 100, Vref = 760)
Global$DnPlotTable
#> Key: <siteID, ID, TR, IDg, IDn, p, ky>
#>       siteID     ID    TR    IDg    IDn      p         ky          Dn
#>       <char> <char> <num> <char> <char> <char>      <num>       <num>
#>    1:    TST    MCE    NA     G1   AM88   0.05 0.01000000 144.6810003
#>    2:    TST    MCE    NA     G1   AM88   0.05 0.01163118 120.9120918
#>    3:    TST    MCE    NA     G1   AM88   0.05 0.01352844 100.7940549
#>    4:    TST    MCE    NA     G1   AM88   0.05 0.01573517  83.7743825
#>    5:    TST    MCE    NA     G1   AM88   0.05 0.01830186  69.3847807
#>   ---                                                                
#> 4418:    TST   TEST   100     G2  rigid   mean 0.15178479   7.1966751
#> 4419:    TST   TEST   100     G2  rigid   mean 0.17654363   4.0598772
#> 4420:    TST   TEST   100     G2  rigid   mean 0.20534109   1.9380549
#> 4421:    TST   TEST   100     G2  rigid   mean 0.23883592   0.6764098
#> 4422:    TST   TEST   100     G2  rigid   mean 0.27779437   0.1071752
# }