Ejemplo n.º 1
0
        private GroundMotion getGmHere(GroundMotion gm)
        {
            setCoeffIndex(period);

            // terms used by both mean and stdDev
            double saRef      = CalcSAref();
            double soilNonLin = CalcSoilNonLin();

            double mu  = GetMeanForThisT(soilNonLin, saRef);
            double std = GetStdForThisT(soilNonLin, saRef);

            gm.SetLogMean(mu);
            gm.SetLogStd(std);

            return(gm);
        }
Ejemplo n.º 2
0
        public GroundMotion GetGroundMotion(GroundMotion newGm)
        {
            // range checks. Make sure we want to do this (for computational reasons)
            // check period range

            // check distance range

            // check Vs30 range

            // check M range?

            // Check if key (period) is directly available from GMPE
            period = HazardCalculation.ThisScenario.saPeriodParam;
            if (indexFromPerHashMap.ContainsKey(period))
            {
                // Get median directly from GMPE
                newGm = getGmHere(newGm);
            }
            // If key (period) is not directly available from GMPE, interpolate
            // using median of next highest and lowest periods that are directly available
            else
            {
                // created ordered list of keys (ascending order)
                var perList = indexFromPerHashMap.Keys.ToList();
                perList.Sort(); // ascending is default

                // find two indicies for keys (periods) just above and below period
                if (period < perList.First())
                {
                    // desired period is not in range of GMPE
                    return(newGm);
                }
                else if (period > perList.Last())
                {
                    // desired period is not in range of GMPE
                    return(newGm);
                }
                else
                {
                    int ind = 0;
                    while ((perList[ind] < period) && (ind < perList.Count()))
                    {
                        ind++;
                    }

                    // create log period and log mean vectors for interpolation
                    double[]     logPerVect = { Math.Log(perList[ind - 1]), Math.Log(perList[ind]) };
                    double[]     muVect     = { 0, 0 };
                    double[]     sigVect    = { 0, 0 };
                    GroundMotion gm         = new GroundMotion();

                    period     = perList[ind - 1];
                    gm         = getGmHere(gm);
                    muVect[0]  = gm.GetLogMean();
                    sigVect[0] = gm.GetLogStd();

                    // zero-out gm
                    newGm.SetLogMean(0.0);
                    newGm.SetLogStd(0.0);

                    period     = perList[ind];
                    gm         = getGmHere(gm);
                    muVect[1]  = gm.GetLogMean();
                    sigVect[1] = gm.GetLogStd();

                    //interpolate in log-log space
                    double mu  = HelperMethods.InterpFromVector(logPerVect, muVect, Math.Log(period));
                    double sig = HelperMethods.InterpFromVector(logPerVect, sigVect, Math.Log(period));

                    newGm.SetLogMean(mu);
                    newGm.SetLogStd(sig);
                }
            }

            return(newGm);
        }
Ejemplo n.º 3
0
        private GroundMotion getGmHere(GroundMotion gm)
        {
            // ****** Mean ground motion and standard deviation model ******

            // get index coefficients for current period
            setCoeffIndex(period);

            // Base Model (magnitude and distance dependence for strike-slip eq)

            // Magnitude dependent taper -- Equation 4
            double c4mag = (mag > 5) ? C4 : (mag > 4) ? C4 - (C4 - 1.0) * (5.0 - mag) : 1.0;

            // -- Equation 3
            double R = Math.Sqrt(rRup * rRup + c4mag * c4mag);

            // -- Equation 2
            double MaxMwSq = (8.5 - mag) * (8.5 - mag);
            double MwM1    = mag - M1[iper];

            double f1 = getf1(MwM1, MaxMwSq, R);

            double f4 = getf4();

            double f6 = getf6();

            // Style-of-Faulting Model -- Equations 5 & 6
            // Note: REVERSE doesn not need to be implemented as f7 always resolves
            // to 0 as a11==0; we skip f7 here
            double f78 = (style == FaultStyle.NORMAL) ? (mag > 5.0) ? a12[iper] : (mag >= 4.0) ? a12[iper] * (mag - 4.0) : 0.0
                : 0.0;

            // Soil Depth Model -- Equation 17
            double f10 = calcSoilTerm();

            // Site Response Model
            double f5    = 0.0;
            double v1    = getV1(iper);             // -- Equation 9
            double vs30s = (vs30 < v1) ? vs30 : v1; // -- Equation 8

            // Site term -- Equation 7
            double saRock = 0.0; // calc Sa1180 (rock reference) if necessary
            double c_Vlin = Vlin[iper];
            double c_b    = b[iper];
            double c_c    = c[iper];

            if (vs30 < c_Vlin)
            {
                // soil term (f10) for Sa1180 is zero per R. Kamai's code where Z1 < 0 for Sa1180 loop
                double vs30s_rk = (VS_RK < v1) ? VS_RK : v1;
                // use this f5 form for Sa1180 Vlin is always < 1180
                double f5_rk = (a10[iper] + c_b * N) * Math.Log(vs30s_rk / c_Vlin);
                saRock = Math.Exp(f1 + f78 + f5_rk + f4 + f6);
                f5     = a10[iper] * Math.Log(vs30s / c_Vlin) - c_b * Math.Log(saRock + c_c) + c_b *
                         Math.Log(saRock + c_c * Math.Pow(vs30s / c_Vlin, N));
            }
            else
            {
                f5 = (a10[iper] + c_b * N) * Math.Log(vs30s / c_Vlin);
            }

            // total model (no aftershock f11) -- Equation 1
            double mu = f1 + f78 + f5 + f4 + f6 + f10;

            // Intra-event term -- Equation 24
            double phiAsq;

            if (isInferred)
            {
                phiAsq = getPhiA(s1e[iper], s2e[iper]); //mag,
            }
            else
            {
                phiAsq = getPhiA(s1m[iper], s2m[iper]); //mag,
            }
            phiAsq *= phiAsq;

            // Inter-event term -- Equation 25
            double tauB = getTauA();

            // Intra-event term with site amp variability removed -- Equation 27
            double phiBsq = phiAsq - PHI_AMP_SQ;

            // Parital deriv. of ln(soil amp) w.r.t. ln(SA1180) -- Equation 30
            // saRock subject to same vs30 < Vlin test as in mean model
            double dAmp_p1 = get_dAmp(saRock) + 1.0;

            // phi squared, with non-linear effects -- Equation 28
            double phiSq = phiBsq * dAmp_p1 * dAmp_p1 + PHI_AMP_SQ;

            // tau squared, with non-linear effects -- Equation 29
            double tau = tauB * dAmp_p1;

            // total std dev
            double sig = Math.Sqrt(phiSq + tau * tau);

            gm.SetLogMean(mu);
            gm.SetLogStd(sig);
            return(gm);
        }
Ejemplo n.º 4
0
        public GroundMotion GetGroundMotion(GroundMotion newGm)
        {
            double mu, sig;

            // Check if key (period) is directly available from GMPE
            period = HazardCalculation.ThisScenario.saPeriodParam;
            if (indexFromPerHashMap.ContainsKey(period))
            {
                // Get median directly from GMPE
                mu  = getMeanHere();
                sig = getStdDevHere();
            }
            // If key (period) is not directly available from GMPE, interpolate
            // using median of next highest and lowest periods that are directly available
            else
            {
                // created ordered list of keys (ascending order)
                var perList = indexFromPerHashMap.Keys.ToList();
                perList.Sort(); // ascending is default

                // find two indicies for keys (periods) just above and below period
                if (period < perList.First())
                {
                    // desired period is not in range of GMPE
                    return(newGm);
                }
                else if (period > perList.Last())
                {
                    // desired period is not in range of GMPE
                    return(newGm);
                }
                else
                {
                    int ind = 0;
                    while ((perList[ind] < period) && (ind < perList.Count()))
                    {
                        ind++;
                    }

                    // create log period and log mean vectors for interpolation
                    double[] logPerVect = { Math.Log(perList[ind - 1]), Math.Log(perList[ind]) };
                    double[] muVect     = { 0, 0 };
                    double[] sigVect    = { 0, 0 };

                    period     = perList[ind - 1];
                    muVect[0]  = getMeanHere();
                    sigVect[0] = getStdDevHere();

                    period     = perList[ind];
                    muVect[1]  = getMeanHere();
                    sigVect[1] = getStdDevHere();

                    period = HazardCalculation.ThisScenario.saPeriodParam;

                    //interpolate in log-log space
                    mu  = HelperMethods.InterpFromVector(logPerVect, muVect, Math.Log(period));
                    sig = HelperMethods.InterpFromVector(logPerVect, sigVect, Math.Log(period));
                }
            }
            newGm.SetLogMean(mu);
            newGm.SetLogStd(sig);

            return(newGm);
        }