Measurement of Earthquakes. New Mexico. Supercomputing Challenge. Final Report. April 3, Team #91. Miyamura High School

Similar documents
Swing - JLabel. Adding a text (and HTML) labels to a GUI

Swing - JButton. Adding buttons to the main window

Swing - JTextField. Adding a text field to the main window (with tooltips and all)

Graphical User Interfaces (GUIs)

MIT AITI Swing Event Model Lecture 17

Midterm assessment - MAKEUP Fall 2010

RAIK 183H Examination 2 Solution. November 11, 2013

Swing from A to Z Some Simple Components. Preface

Multiple Choice Questions: Identify the choice that best completes the statement or answers the question. (15 marks)

Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008

Packages: Putting Classes Together

Interfaces & Polymorphism part 2: Collections, Comparators, and More fun with Java graphics

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

JRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();

Example: CharCheck. That s It??! What do you imagine happens after main() finishes?

First Name: AITI 2004: Exam 2 July 19, 2004

Dr. Hikmat A. M. AbdelJaber

RAIK 183H Examination 2 Solution. November 10, 2014

Java Help Files. by Peter Lavin. May 22, 2004

The JFrame Class Frame Windows GRAPHICAL USER INTERFACES. Five steps to displaying a frame: 1) Construct an object of the JFrame class

CSIS 10A Assignment 7 SOLUTIONS

Systems Programming Graphical User Interfaces

Graphics User Defined Forms, Part I

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

H212 Introduction to Software Systems Honors

Building a GUI in Java with Swing. CITS1001 extension notes Rachel Cardell-Oliver

Introduction. Introduction

PART1: Choose the correct answer and write it on the answer sheet:

SINGLE EVENT HANDLING

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

Window Interfaces Using Swing Objects

MODEL UPDATES MANIPULATES USER

Swing. By Iqtidar Ali

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Graphical User Interface (Part-1) Supplementary Material for CPSC 233

CS415 Human Computer Interaction

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

DM503 Programming B. Peter Schneider-Kamp.

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

First Name: AITI 2004: Exam 2 July 19, 2004

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

CS Exam 1 Review Suggestions

CMP 326 Midterm Fall 2015

Original GUIs. IntroGUI 1

Queen s University Faculty of Arts and Science School of Computing CISC 124 Final Examination December 2004 Instructor: M. Lamb

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Window Interfaces Using Swing Objects

Introduction to the JAVA UI classes Advanced HCI IAT351

Week Chapter Assignment SD Technology Standards. 1,2, Review Knowledge Check JP3.1. Program 5.1. Program 5.1. Program 5.2. Program 5.2. Program 5.

CSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright

State Application Using MVC

G51PGP Programming Paradigms. Lecture 008 Inner classes, anonymous classes, Swing worker thread

COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) )

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline

SD Module-1 Advanced JAVA

Java - Applications. The following code sets up an application with a drop down menu, as yet the menu does not do anything.

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions

Chapter 6 Using Objects

SD Module-1 Advanced JAVA. Assignment No. 4

Swing: Building GUIs in Java

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003

Swing: Building GUIs in Java

Graphical User Interfaces. Comp 152

Queens College, CUNY Department of Computer Science. CS 212 Object-Oriented Programming in Java Practice Exam 2. CS 212 Exam 2 Study Guide

Graphical interfaces & event-driven programming

Proctors are unable to respond to queries about the interpretation of exam questions. Do your best to answer exam questions as written.

Swing Programming Example Number 2

GUI and its COmponent Textfield, Button & Label. By Iqtidar Ali

Chapter 6 Project: A New Model for Earthquakes

Chapter N/A: The Earthquake Cycle and Earthquake Size

AP CS Unit 11: Graphics and Events

Programming Language Concepts: Lecture 8

Introduction This assignment will ask that you write a simple graphical user interface (GUI).

KF5008 Program Design & Development. Lecture 1 Usability GUI Design and Implementation

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

1.00/1.001 Introduction to Computers and Engineering Problem Solving Final Examination - December 15, 2003

To gain experience using GUI components and listeners.

Effects of multi-scale velocity heterogeneities on wave-equation migration Yong Ma and Paul Sava, Center for Wave Phenomena, Colorado School of Mines

CSE331 Fall 2014, Final Examination December 9, 2014 Please do not turn the page until 2:30. Rules:

CS108, Stanford Handout #22. Thread 3 GUI

We are on the GUI fast track path

Parts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions.

Name: Checked: Learn about listeners, events, and simple animation for interactive graphical user interfaces.

The AWT Package, Placing Components in Containers, CardLayout. Preface. Introduction

Chapter 13 Lab Advanced GUI Applications

An array is a type of variable that is able to hold more than one piece of information under a single variable name.

DM537 Object-Oriented Programming. Peter Schneider-Kamp.

Midterm Test II Object Oriented Programming in Java Computer Science, University of Windsor Fall 2014 Time 2 hours. Answer all questions

SE1021 Exam 2. When returning your exam, place your note-sheet on top. Page 1: This cover. Page 2 (Multiple choice): 10pts

Java. GUI building with the AWT

GUI Forms and Events, Part II

Model-View-Controller (MVC) Structure Previous - Presentation-Model

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University

GUI Applications. Let s start with a simple Swing application in Java, and then we will look at the same application in Jython. See Listing 16-1.

JAVA NOTES GRAPHICAL USER INTERFACES

Graphical User Interface

Transcription:

Measurement of Earthquakes New Mexico Supercomputing Challenge Final Report April 3, 2012 Team #91 Miyamura High School Team Members: Tabitha Hallock Sridivya Komaravolu Kirtus Leyba Jeffrey Young Teacher: Andy Melenchek

Executive Summary The destructive power of earthquakes is a very important subject to understand. The media refers to earthquakes with a rating based off of scientific analysis. It is vital to understanding and to safety the there is a way to comprehend what is meant by all the different ratings and degrees of earthquake. Within our project we have gone in depth into studying the different ways that earthquakes are measured. In this project we used statistics and computer programming to develop a model that helps in the understanding the relationship between the two major ways to measure earthquakes. We study the importance of finding correlation between different scales. We have developed a computer program that models the problem we have set out to solve. This program is explained in detail and all the code is listed in the appendix.

Statement of Problem Earthquakes are disastrous natural events that occur everywhere on Earth. They are caused by a release of energy on or in the Earth s crust. The amount of energy released is recorded with a scale of dimensionless numbers. This scale is called the moment magnitude scale. Scientists use this scale to rate the power of an earthquake. The rating is found using a logarithmic equation. For centuries earthquakes have been a source of fear for humans everywhere. This fear is particularly found in major cities that are located along fault lines or the coast line. Cities along fault lines face minor earthquakes commonly. However, they also face the most intense earthquakes possible. When this happens, major destruction can result to structures. Coastal cities, regardless of their locations, face the threat of earthquake driven tsunamis. In the past decade major tsunamis that resulted from mid-ocean earthquakes had a huge impact on the media and earthquakes were again seen for their destructive power. It is because of these dangers that our team sees the importance of understanding the force involved in earthquakes. Particularly, our team wants to know the relation of an earthquake s magnitude to an earthquake s intensity. With knowledge of this relationship, or lack of a relationship, we can better understand the damage done by earthquakes. Important questions come up from this problem. What role do structures play in the damage done by an earthquake? What happens as you move away from the epicenter of an earthquake? Does terrain

make a difference? We hope to help in the understanding of these questions through our research and experimentation. Solving the Problem Earthquakes are measured on many different scales that measure many different things. The scale most commonly referenced, however, is the moment magnitude scale. This scale measures the amount of energy released by an earthquake and then represents it on a dimensionless scale. The value calculated by the moment magnitude scale is written as M w, or mechanical work. M w is a logarithmic function of M o, or the magnitude of the seismic moment. M o is recorded in either dyne-centimeters or in Newton meters. The seismic moment is calculated using a variety of variables including: shear modulus, area of rupture, and displacement caused by the seismic event. The full equation for finding the moment magnitude of an earthquake is: M w = 2 / 3 (log 10 M o ) 6.067 Another scale used to measure earthquakes is the Mercalli Intensity Scale. This scale is different from the moment magnitude scale because instead of measuring the energy released, it is a measurement of the effects and damage done by an earthquake. The modified Mercalli

intensity scale, the version commonly accepted by geologists and seismologists, ranges from a degree of I to XII. The degrees are based off of whether an earthquake can be felt, how it is felt, and what damage is a result of the earthquake. Because of the variables involved in the Mercalli intensity scale and its purpose, the scale can be recorded differently by different people, and any single earthquake can have many recorded intensities. For example, a person who is located very far from the epicenter of an earthquake might rate it very low on the scale. A person very near to the epicenter would probably record a much higher value for the intensity. These facts themselves show the difficulties that might arise from trying to form a relation between an earthquake s intensity and an earthquake s moment magnitude. One of these difficulties, the fact that each event can have multiple intensities, is mostly erased by simply choosing a single constant intensity to use in a comparison. We decided on using the average reported intensity as provided by the United States Geological Survey (USGS). This also helps to fix the distance problem. The majority of people who report earthquake intensities will be near the epicenter. Thus, the average intensity is a good representation of the intensity at the center location of an earthquake. We created a table of many earthquakes comparing their moment magnitudes and the average reported Mercalli intensity. We were able to plot this data on a scatter plot and calculate an equation to represent the relation that we observed. We used the moment magnitude as the domain so that we could attempt to derive the intensity from an input of a magnitude. The equation that we found to represent this relation was: f(mm) = 0.0255mmi 2 + 0.7466mmi + 0.0583

where mmi = modified Mercalli Intensity and mm = moment magnitude Modified Mercalli Intensity Compared to Moment Magnitude Moment Magnitude Modified Mercalli Intensity 1.4 1 1.7 1 2 1 2 2 2 2 2.1 1 2.1 2 2.4 3 2.6 2 2.7 3 3.2 3 3.4 2 4 3 4 6 4.3 2 4.5 2 4.6 5 4.6 4 4.6 3 4.6 3 4.7 4 4.7 5 4.7 4 4.8 5 4.9 3 5 7 5.1 6 5.1 5 5.2 6 5.2 5 5.4 4 5.5 2 5.7 4 5.8 5 5.9 7 6 5 7.1 7

At this point we had a relationship that we could work with and we planned to utilize a computer resource to help implement this relationship. We chose to create a program using the Java Programming Language that could help to model this equation. Our team wanted the program to be user friendly, so that it could be used by anyone. This became one of the major goals of the development of the program. In order to achieve this goal, we knew that our program would need a working Graphic User Interface (GUI). This meant the addition of buttons and controls that would allow the user to easily get the desired result from our program. In order to create this program with a GUI we utilized many built in Java classes from the Java Foundation Classes (JFC). We used Swing, a toolkit for creating portable, cross platform GUIs. We also used imported layouts to allow for the adjustability of the program. These steps allow for the user to successfully operate the program with ease. Below is some of the code that we used to create this easy to use GUI.

import javax.swing.*; public class Primary { public static void main(string[] args){ //// creating the window //// gui window = new gui(); //// setting the window properties //// window.setdefaultcloseoperation(jframe.exit_on_close); window.setsize(400,600); window.setvisible(true); import java.awt.*; import java.awt.event.*; import javax.swing.*; public class gui extends JFrame{ //// declaring components //// private JButton startbutton; private JTextField momentmagnitudefield; private JComboBox timerfield; {More shown in Appendix: Code The functionality of our program is based off of the object-oriented nature of Java programming. There are three classes in the final program. The first class, Primary, sets up the window using an object of the second class, gui. The final class, CreateFile, is used to create and save text files with the data that is calculated within the program. Our finished program utilized the equation we found earlier to calculate intensity based off of an input of a magnitude. This allows a user to predict roughly what damage could be done by an earthquake, or how severely it could be felt. Based off of those results, they could determine many useful things.

Results of our Study We have successfully shown a relationship between the intensity of an earthquake and the magnitude of the energy that it releases. We learned about the ways that earthquakes are measured. There is the Moment Magnitude Scale and the Modified Mercalli Intensity scale. The scales tell different things. The Moment magnitude measures the energy of an earthquake while the Mercalli measures the observed effects of the earthquake. We created a Java program that allows you to quickly use the relationship between these two scales. We discovered through our research that there are many factors involved in determining the intensity of an earthquake. These include the distance from which the intensity is recorded to the epicenter of the earthquake, the terrain of the area that is affected by the earthquake, the types of structures in the area, and the person who reports the intensity. From this project we have had the original achievements of developing a computer program and understanding the correlation of the damage done by an earthquake and the technical interpretation of its physical properties. Conclusion From this project, we conclude that there is a relation between magnitude and intensity. This is not a perfect relationship, as many factors can show a lack of correlation between the sets of data. However, this relationship is still apparent and important. Understanding what the different numbers on the different scales mean is vital to understanding exactly what happened to an area that is affected by an earthquake. Using this knowledge helps to create a broad understanding of what happens within an earthquake.

Acknowledgements We would like to acknowledge the two teachers that support the supercomputing challenge teams at our school; Mr. Melenchek and Mr. Ng. We would also like to acknowledge Bucky for his Java tutorials on youtube (http://www.youtube.com/thenewboston).

Glossary Area of rupture: Occurs along the geologic fault where the earthquake occurs. Recorded in cm 2 Dimensionless number: A number not associated with a dimension; does not measure a specific quantity but instead represents size as relative to what is being assessed. Dyne-centimeters: 10 micro newtons per centimeter. Epicenter: The point that all seismic waves emit from in an earthquake. Graphic User Interface: In computer science, the part of a computer program where the user can see and interact with visual parts. Intensity: A broad term describing the effect of energy. Java Foundation Classes: A graphical framework made up of many classes and packages that was created to allow for ease in creating GUIs with java. Java Programming Language: A programming language developed by James Gosling. Magnitude: A scalar quantity; the scalar portion of a vector. Mercalli Intensity Scale: A scale used to measure the intensity of earthquakes moment magnitude scale: A scale used to measure the energy output of earthquales.

Newton meters: A unit of torque resulting from applying 1 Newton of force to a 1 meter long arm. Shear modulus: The ratio of shear stress to shear strain. Swing: In Java programming, the classes from the JFC that include many GUI components. United States Geological Survey: Scientific agency of the US government dealing with the geology of the nation and the world.

Appendix: Code import javax.swing.*; public class Primary { public static void main(string[] args){ //// creating the window //// gui window = new gui(); //// setting the window properties //// window.setdefaultcloseoperation(jframe.exit_on_close); window.setsize(400,600); window.setvisible(true); import java.awt.*; import java.awt.event.*; import javax.swing.*; public class gui extends JFrame{ //// declaring components //// private JButton startbutton; private JTextField momentmagnitudefield; private JComboBox timerfield; //// creating the arrays for the timer field//// private String[] elementsfortimerfield = {"Choose the number of times to run the program","1","10","20","30","40","50","100",; //// setting variable to decide final run time //// private int chosenruntime; //// constructor for the window //// public gui(){ super("moment Magnitude to Mercalli"); //// sets the layout to flow layout //// setlayout(new FlowLayout()); //// creating some of the components //// startbutton = new JButton("Start"); momentmagnitudefield = new JTextField("Enter the recorded moment magnitude"); timerfield = new JComboBox(elementsForTimerField); //// making the text field able to be edited //// momentmagnitudefield.seteditable(true); //// adding components //// add(startbutton); add(timerfield);

add(momentmagnitudefield); //// listening to the start button //// startbutton.addactionlistener( //// anonymous class thing //// new ActionListener(){ public void actionperformed(actionevent event){ ///// trying and catching //// try{ CreateFile g = new CreateFile(); double i = Double.parseDouble(momentMagnitudeField.getText()); System.out.println(i); int x = (int) Math.round((0.0551*(i*i)) + (0.5553*i) + 0.4474); System.out.println(x); g.openfile(); for(int counter = chosenruntime;counter >= 1;counter = counter - 1){ g.adddata(double.parsedouble(momentmagnitudefield.gettext()),x); g.closefile(); catch(exception error){ JOptionPane.showMessageDialog(null, "Error! You either did not choose the number of times to run the program, \nor you did not input a positive value greater than zero for the moment magnitude." + "\n" + error); ); //// item listener for the timer field //// timerfield.additemlistener( new ItemListener(){ public void itemstatechanged(itemevent event){ //// switch statement to se chosen run time //// switch (timerfield.getselectedindex()){ case 0: chosenruntime = 0; case 1: chosenruntime = 1; case 2: chosenruntime = 10; case 3: chosenruntime = 20; case 4: chosenruntime = 30; case 5: chosenruntime = 40;

); case 6: chosenruntime = 50; case 7: chosenruntime = 100; import java.io.*; import java.lang.*; import java.util.*; import javax.swing.joptionpane; public class CreateFile { private Formatter formvar; public void openfile(){ try{ formvar = new Formatter("Statistics.txt"); System.out.println("File created"); catch(exception e){ JOptionPane.showMessageDialog(null, "There was an error with file creation!"); public void adddata(double mm, int mmi){ formvar.format("%i%i", mm, mmi); public void closefile(){ formvar.close();