Lab5_Seismic_Hazard_Analysis - Solution

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

93

Subject

Geography

Date

Apr 3, 2024

Type

pdf

Pages

14

Uploaded by SuperHumanHawkPerson1544

Report
Lab5_Seismic_Hazard_Analysis - Solution March 3, 2022 1 LAB 05 Seismic Hazard Analysis Full Name: replace text here SID: replace text here NOTE: Replace the “…” with your code/answer and make sure you insert code in cells where indicated. Save the file as a PDF file and name it “Lab4_FirstnameLastname”. Upload and submit your report via Gradescope by Thursday 7:00PM . Make sure to run all cells so that the output is visible for every cell before turning in the notebook. Please remember to label all axes with the quantity and units being plotted. ACADEMIC INTEGRITY Berkeley Campus Code of Student Conduct (http://sa.berkeley.edu/student-code-of-conduct): “The Chancellor may impose discipline for the commission or attempted commission (including aiding or abetting in the commission or attempted commission) of the following types of violations by students, as well as such other violations as may be specified in campus regulations: 102.01 Academic Dishonesty: All forms of academic misconduct including but not limited to cheating, fabrication, plagiarism, or facilitating academic dishonesty.” [1]: # Don't forget to run this before working on the lab problems import numpy as np import matplotlib.pyplot as plt from lab5_function import * 1.1 Please make sure to read the background for this lab before solving the problems. 1.2 Background In this lab, the random variable we will examine is a measure of earthquake acceleration on the ground, which is called Peak Ground Acceleration (PGA) . In an earthquake, damage to buildings and infrastructures is related more closely to ground motion, rather than the magnitude of the earthquake. For moderate earthquakes, PGA is the best determinate of damage; in severe earthquakes, damage is more often correlated with peak ground velocity . Earthquake energy is dispersed in waves from the epicenter , causing ground movement horizontally (in two directions) and vertically. 𝑃𝐺𝐴 indicates the acceleration (rate of change of speed) of these 1
movements, while peak ground velocity is the greatest speed (rate of movement) reached by the ground. These values vary in different earthquakes, and in differing sites within one earthquake event, depending on a number of factors. These include the length of the fault, earthquake mag- nitude, depth of the quake, distance from the epicenter, earthquake duration (length of the shake cycle), and geology of the ground (subsurface). Shallow-focused earthquakes generate stronger shaking (acceleration) than intermediate and deep quakes, since the energy is released closer to the surface. PGA can be expressed in the unit of the standard gravity 𝑔 (the acceleration due to Earth’s gravity , equivalent to g-force ) as either a decimal or percentage. The following is a figure, named “Two-percent probability of exceedance in 50 years map of peak ground acceleration”, showing the geographical PGA distribution. For example, the red (darkest) areas has 2% chance of having a PGA exceeding 0.8 𝑔 in 50 years, the orange areas has 2% chance of having a PGA greater than 0.4 𝑔 , etc. 1.3 About the Data As mentioned above, the random variable we are going to examine is the PGA of an earthquake. However, we will not provide you any data for this lab; instead, you will generate your own. Don’t be freaked out! We will provide most of the functions you will need in Python to “generate random earthquakes” and guide you through the questions. To simplify the problem, we will make a simplified model as follows. We have a rectangular area of 200 miles x 100 miles in California. A fault runs along the line defined by the points [0, 50] and [200, 50], as shown in the figure below. We will assume that an earthquake occurs and causes a rupture along this fault. As stated in the introduction, PGA is influenced by: 1) Length of the rupture : is fully characterized by the start point and end point of the rupture. We will randomly pick up 2 points along the fault. 2) Magnitude (M) : most earthquakes have a magnitude of less than 9.5 and we are mainly interested in the earthquake with magnitude of more than 5. Thus we will random pick a number between 5 and 9.5 as the magnitude of the earthquake. 3) The depth of the quake (H) : The depth of the earthquake can be randomly picked from 10km to 190km. 4) The distance from the epicenter (Rrup) : we consider this distance as the shortest distance between any point to the rupture. For example, the stars in the following figure are predefined “homes”. The distance between the home and the rupture is the shortest distance between the home and the rupture. Two examples are shown in the figure. 5) The geology of the ground : the type of site also affects PGA. Generally, the sites are classified into rock, shallow soil, and deep soil site. To simplify the problem, we will assume all of the sites are of type rock, which is more likely to be the case in California. 6) The type of the earthquake (Zt) : There are two types of earthquake origin. An in- traplate earthquake is an earthquake that occurs in the interior of a tectonic plate , whereas an interplate earthquake is one that occurs at a plate boundary. Intraplate earthquakes are relatively rare. Interplate earthquakes, which occur at plate boundaries, are more common. 2
We will indicate Zt = 0 for an interplate earthquake and Zt = 1 for an intraplate earthquake. For this factor, we will randomly pick from 0 and 1 for Zt, with a higher (0.9) probability of an interplate earthquake. The PGA can be determined using the following formula: 1.4 Problem 1 You are looking to buy a house, but you are also concerned that an earthquake may strike and de- stroy it. One of the candidate locations for your house is [50,50]. Generate 200 random earthquakes and examine the PGA at this location. You may use the function: randomPGA(home, number_samples) in the “lab5_function.py” file. The randomPGA function takes a location as the first argument, and number of samples you would like to generate as the second argument. The output is a list of PGAs for the randomly generated earthquakes. So the code you may use is: • a = randomPGA([50,50], 200) Please make sure you’ve run the cell above the “About the Data” header with the libraries and functions we will be using for this lab. The functions randomPGA and schoolPGA in the file “lab5_function.py” will be used for the following questions. You can open this file on your own to see how the functions work, but detailed description will be provided at the beginning of each question. NOTE : For this problem, please set your random seed to 93 . Please PRINT each output and make sure all figures are showing in your final report. 1a) Find the median and standard deviation of a. [2]: # print the median and stardard deviation of a np . random . seed( 93 ) a = randomPGA([ 50 , 50 ], 200 ) median_a = np . median(a) std_a = np . std(a) print ( 'median of a: ' , median_a) print ( 'std of a: ' , std_a) median of a: 0.3088081750447097 std of a: 0.22318724852607694 1b) Give the histogram of a with reasonable bin setting. [3]: # Plot the histogram of a plt . figure(figsize = ( 6 , 6 )) plt . hist(a, 15 , ec = 'black' , histtype = 'bar' ) plt . title( 'Histogram of 200 realizations of PGA at [50, 50]' ) plt . xlabel( 'PGA(g)' ) 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
[3]: Text(0.5, 0, 'PGA(g)') 1c) Give the boxplot of a. [4]: # Plot the boxplot of a plt . figure(figsize = ( 6 , 6 )) plt . boxplot(a) plt . title( 'Boxplot of 200 realizations of PGA at [50, 50]' ) plt . xlabel( 'PGA(g)' ) [4]: Text(0.5, 0, 'PGA(g)') 4
1d) Give the quartiles of a. Do these make sense given the boxplot of a? [5]: # print the quartiles of a quart_a = np . percentile(a, [ 25 , 50 , 75 ]) print ( 'Quartiles of a: ' , quart_a) Quartiles of a: [0.19815675 0.30880818 0.50007304] Comment for 1d: Yes, they all correspond to the boxplot I created. 1.5 PROBLEM 2 There is another candidate location, which is exactly in the corner of the rectangle, [100 0]. Generate 200 random earthquakes and examine the PGA at this location, and label this random variable b. NOTE: For this problem, please set your random seed to 36 . Please PRINT each output and make sure all figures are showing in your final report. 5
2a) Find the median and standard deviation of b. [6]: # print the median and standard deviation of b np . random . seed( 36 ) b = randomPGA([ 100 , 0 ], 200 ) median_b = np . median(b) std_b = np . std(b) print ( 'median of b: ' , median_b) print ( 'std of b: ' , std_b) median of b: 0.19917283266026156 std of b: 0.18884548268407145 2b) Give the histogram of b with reasonable bin setting. [7]: # plot the histogram of b plt . figure(figsize = ( 6 , 6 )) plt . hist(b, 15 , ec = 'black' , histtype = 'bar' ) plt . title( 'Histogram of 200 realizations of PGA at [100, 0]' ) plt . xlabel( 'PGA(g)' ) [7]: Text(0.5, 0, 'PGA(g)') 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
2c) Give the boxplot of b. [8]: # plot the boxplot of b plt . figure(figsize = ( 6 , 6 )) plt . boxplot(b) plt . title( 'Boxplot of 200 realizations of PGA at [100, 0]' ) plt . xlabel( 'PGA(g)' ) [8]: Text(0.5, 0, 'PGA(g)') 7
2d) Give the quartiles of b. Do these make sense given the boxplot of b? [9]: # print the quartiles of b quart_b = np . percentile(b, [ 25 , 50 , 75 ]) print ( 'Quartiles of b: ' , quart_b) Quartiles of b: [0.10737261 0.19917283 0.37994367] Comment for 2d: Yes, they all correspond to the boxplot I created. 1.6 PROBLEM 3 Which of the two locations would you pick for your house? Why? Please generate five estimates of “a” and “b” to help make your decision. You may generate more than five estimates of “a” and “b” if you wish as well. 8
Do you find a big difference in “a”s and “b”s? (Remember what you’ve learned in previous labs. They can be useful. For example, quartiles, min and max, central tendencies, spread, etc.) Hint: You may generate five estimates as how you did for Problem 1 and 2, but using five different random seeds. You can use any random seed you like when generating the five estimates. Side-by- side boxplots maybe helpful for making your decision. You can refer to Part 3 in the demo code for this lab. [10]: #Code for Problem 3 A = np . zeros(( 200 , 5 )) B = np . zeros(( 200 , 5 )) for i in range ( 5 ): np . random . seed(i) A[:, i] = randomPGA([ 50 , 50 ], 200 ) B[:, i] = randomPGA([ 100 , 0 ], 200 ) # mean mean_A = np . mean(np . mean(A, axis = 0 )) mean_B = np . mean(np . mean(B, axis = 0 )) print ( 'mean of location a: ' , mean_A) print ( 'mean of location b: ' , mean_B) # boxplots fig = plt . figure(figsize = ( 10 , 5 )) axs = [] axs . append(fig . add_subplot( 121 )) axs[ 0 ] . boxplot(A) plt . ylim([ 0 , 1.5 ]) axs[ 0 ] . set_title( 'Boxplots of 5 sets of 200 realizations of PGA at [50, 50]' ) axs[ 0 ] . set_xlabel( '# set of realizations' ) axs[ 0 ] . set_ylabel( 'PGA(g)' ) axs . append(fig . add_subplot( 122 )) axs[ 1 ] . boxplot(B) plt . ylim([ 0 , 1.5 ]) axs[ 1 ] . set_title( 'Boxplots of 5 sets of 200 realizations of PGA at [100, 0]' ) axs[ 1 ] . set_xlabel( '# set of realizations' ) axs[ 1 ] . set_ylabel( 'PGA(g)' ) plt . subplots_adjust(wspace =1 ,hspace =0.1 ) plt . show() mean of location a: 0.3586608711726732 mean of location b: 0.2850315336268222 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Comment for 3: Answers will vary. Students can comment on summary characteristics/outliers for choosing a/b. One example can be: b is preferred because the mean PGA is lower. 1.7 PROBLEM 4 There are five schools in this area, and their locations are: [0,0], [25,35], [50,110], [100,45], [200,15]. We would like to know that how many of these schools will experience a PGA of greater than 0.4 𝑔 when an earthquake happens in this area. You may use the code: schoolPGA(schools, threshold, number_samples) This function takes a list of locations as the first argument, the PGA threshold you choose as the second argument, and the number of samples/earthquakes you would like to generate as the third argument. The output of the function is a list. The length of the list is the same as the number of samples. Each element in the list denotes the number of schools that suffer a PGA greater than the threshold under the corresponding random earthquake. The code you may use for this problem: • pga_school_list=schoolPGA([[0,0], [25,35], [50,110], [100,45], [200,15]], 0.4, 1000) NOTE: For this problem, please set your random seed to 60 . Please PRINT each output and make sure your plots are showing in the final report. 4a) Examine the mean and variance of pga_school_list. Print your results. [11]: # print mean and variance of the pga_school_list np . random . seed( 60 ) pga_school_list = schoolPGA([[ 0 , 0 ], [ 25 , 35 ], [ 50 , 110 ], [ 100 , 45 ], [ 200 , 15 ]], 0. 4 , 1000 ) mean_pgas = np . mean(pga_school_list) 10
var_pgas = np . var(pga_school_list) print ( 'mean of pga_school_list: ' , mean_pgas) print ( 'variance of pga_school_list' , var_pgas) mean of pga_school_list: 1.347 variance of pga_school_list 2.306591 4b) Give the histogram of pga_school_list. [12]: # plot the histogram plt . figure(figsize = ( 6 , 6 )) plt . hist(pga_school_list,bins =5 , ec = 'black' ) plt . title( 'Histogram of # of schools experiencing PGA>0.4g out of 1000 realizations' ) plt . xlabel( '# of schools' ) plt . ylabel( 'Counts' ) [12]: Text(0, 0.5, 'Counts') 11
[13]: [14]: 4c) What’s the probability that all the 5 schools suffer a PGA greater than 0 .4 𝑔 ? Print your result. Hint: Remember how we calculated probabilities in previous labs. You can refer to the demo code for lab 3. # Caculate the probability and print it sum_pgas_5 = sum (pga_school_list == 5 ) / len (pga_school_list) print ( 'Probability for 4c): ' , sum_pgas_5) Probability for 4c): 0.039 4d) What’s the probability that less than 4 schools suffer a PGA greater than 0.4 𝑔 ? # Calculate the probability and print it sum_pgas_4 = sum (pga_school_list < 4 ) / len (pga_school_list) print ( 'Probability for 4d): ' , sum_pgas_4) Probability for 4d): 0.873 1.7.1 PROBLEM 5: 5a) A school will collapse if it experiences a PGA of greater than 0.4 𝑔 . Do you think the probability of at least three schools not collapsing (i.e. experience a PGA of less than 0.4 𝑔 ) is suffciently high? What will happen to this probability as we vary the structural resistance of the schools, such that they are able to resist higher or lower PGAs? Run the code for at least 6 different P GA t hresholds i n a r easonable r ange [ 0.01019 - 1.0197] . Set the random seed to any value you like. Provide a bar plot of probabilities correspond- ing to different thresholds (using the bar function) See the figure below for reasonable values of PGA (note the units!) Source: FIGURE 7. Peak acceleration as a function of magnitude and distance from the fault, as given by the ground-motion prediction equation of Abrahamson and Silva (1997) https://www.sciencedirect.com/topics/earth-and-planetary-sciences/peak-acceleration Hint: You can refer to Part 4 in the demo code for this lab.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
plt . ylabel( 'Probability of at least 3 schools not collapsing' ) plt . show() 13 [15]: # Run different PGA thresholds and provide the bar plot of probabilities. pgas = np.zeros((1000, 6)) for i in range(5): pgas[:, i] = schoolPGA([[ 0 , 0 ],[ 15 , 35 ],[ 50 , 100 ],[ 100 , 30 ],[ 200 , 15 ]], 0.2+ i / 10 , 1000 ) plt . figure(figsize = ( 6 , 6 )) sum_pgas = sum (pgas < 3 ) / len (pgas) plt . bar([i /10 for i in range ( 2 , 8 )], height = sum_pgas, width = 0.05 , ec = 'black' ) plt . title( 'Histogram of the probability of at least 3 schools not collapsing at different threshold PGA' ) plt . xlabel( 'threshold PGA(g)' ) 12
we’ll stop at threshold PGA 0.7g. As mentioned earlier, there are for sure other ways to approach this problem, and each approach is as diffcult to justify as the others. 1.8 SUMITE YOUR WORK (DOWNLOAD AS PDF) 1. Make sure to run all cells in the notebook after you complete. You can do this by going to Cell > Run All. This makes sure that all your visuals and answers show up in the report you submit. 2. In jupyter notebook, go to “File > Download as > PDF via LaTex(.pdf)” to generate a PDF file. Name the PDF file as “Lab2_FirstnameLastname”. This should work if you are using the link we provided for the assignment. 3. If you are not using the link we provided for the assignment and have trouble generating the PDF file from your local jupyter notebook, • Option 1: use datahub.berkeley.edu . Log in with your CalNet credentials. Upload the ipynb file with your outputs and results to jupyterhub. Then follow above instruction (step 2). • Option 2: go to “File > Download as > Markdown(.md)” to generate a markdown file. Then, go to https://typora.io/ and download the Typora (markdown editor). Open the markdown file with Typora and go to “File > Export > PDF” to generate a PDF file (step 2). 5. Name it “Lab4_FirstnameLastname”. Upload and submit the PDF file via Gradescope. [ ]: 14 5b) We all know that it costs more to build a structure that is stronger and more resistant to earthquakes. Suppose that it costs $10 million to improve each school’s PGA resistance by 0.1g. As an elected government offcial, what threshold PGA would you choose? What tradeoffs did you make in coming to your decision? Comment for Problem 5: We can use different threshold PGA. Here I’m using PGAs from 0.2g to 0.7g at 0.1g increment. The probabilities of at least 3 schools not collapsing are plotting against the different threshold PGAs.The probabilities are 0.421, 0.624, 0.767, 0.887, 0.939, and 0.968 respectively. This is a simple example of risk-based decision making. The trade offs are the engineering costs and the risk of schoolcollapsing. There is no single correct answer, for it is diffcult, if not impossible, to quantify in terms of U.S. dollars the valueof casualty in an event of collapse. However, there are several ways to approach this problem. First, one could think of it in the context of marginal benefit. We can think of it as paying 10 million to “buy” probability. If the current threshold is 0.2, we gain an increase of about 0.2 in probability in return of the 10 million. On the other hand, the same 10 million can only “buy” less than 0.03 probability if the current threshold is 0.6. One could setup a terminal marginalbenefit, below which the expense is considered “not worthy”. For example if we want to at least improve the probability by 0.1 after spending 10 million, we would 10 stop at threshold PGA 0.5g. Another way to think of this is to setup an acceptable risk. If, for example, we can tolerate a 5% risk, then the enhancement of structural resistance should continue until the probability is larger than 0.95. In this particular case