Skip to contents

Compatibility route that reproduces, value for value, the PGATable product that the dn step of newmark 1.7.1 writes for one site, so that the stored products serve as comparison oracle while the calculations migrate. For every return period of TR and for the MCE, and for every geometry-material pair of the shear table, it evaluates the mean site PGA at the pair's VS30 with the ST20 factor and the numerical controls of that product.

Usage

buildPGATable(rock, MCE, shear, modelID, siteID, TR)

Arguments

rock

The UHSRock table of the site: columns ID, siteID, TR (years), Tn (s), k, muLn, sigmaLn, w, Vs30 and Vref (m/s).

MCE

The MCE table: columns ID, siteID, Tn (s), p, Sa (g), Vs30 and Vref (m/s), without TR.

shear

The shear table, see buildShearTable(): columns IDg, IDm, VS30 (m/s), Vref (760 m/s) and level.

modelID

One identifier of the probabilistic demand model (ID of rock).

siteID

One site identifier.

TR

Positive return periods in years; the return periods of rock for the model and site must be exactly these.

Value

A data.table with IDg, IDm, ID (modelID or "MCE"), TR (years, NA for the MCE), PGA (g, the mean site PGA, unrounded), Vs30 (m/s), siteID and units.PGA ("g"), one row per demand and pair, keyed as the product.

Semantics reproduced from newmark 1.7.1

The pairs are the level == "mean" rows of shear, whose VS30 is the site velocity; the rock condition is 760 m/s. A return period's rock demand is the analytic mixture of rock for modelID and siteID at that period, and its PGA is the mean \(\sum w e^{\mu + \sigma^2/2}\) of the rows at \(|T_n| \le 10^{-10}\) of the site mixture of refineSiteMixture() with the levels 0.05, 0.10, 0.16, 0.50, 0.84, 0.90 and 0.95, the orders 16, 32, 64, 128 and 256 and the tolerance \(2 \times 10^{-3}\). The MCE demand is the quantile spectrum of MCE (ID == "MCE") for the site, and its PGA is the "mean" site ordinate at \(|T_n| \le 10^{-10}\) of refineSiteSpectrum() with the orders 32, 64, 128 and 256 and the same tolerance. Pairs with equal VS30 share one evaluation, which is deterministic. The table is keyed by siteID, ID, TR, IDg and IDm, as the product was written; data.table::fwrite(x, na = "NA") gives its CSV file.

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.
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")
buildPGATable(Rock, MCE, Shear, modelID = "TEST", siteID = "TST", TR = 100)
#> Key: <siteID, ID, TR, IDg, IDm>
#>       IDg    IDm     ID    TR       PGA  Vs30 siteID units.PGA
#>    <char> <char> <char> <num>     <num> <num> <char>    <char>
#> 1:     G1     U1    MCE    NA 0.3105343   360    TST         g
#> 2:     G2     U2    MCE    NA 0.3138623   560    TST         g
#> 3:     G1     U1   TEST   100 0.3101314   360    TST         g
#> 4:     G2     U2   TEST   100 0.3136679   560    TST         g