[cig-commits] [commit] master: Update aftershock generation (0af215c)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Oct 8 17:04:39 PDT 2014


Repository : https://github.com/geodynamics/vc

On branch  : master
Link       : https://github.com/geodynamics/vc/compare/23464fca3efa2b6ad7ee0ce8f60c225b18b49741...e4325192ad1118379f46ba66899cb98143d09e04

>---------------------------------------------------------------

commit 0af215c94deabd55483c044fa411333710399682
Author: Eric Heien <emheien at ucdavis.edu>
Date:   Wed Sep 17 11:50:37 2014 -0700

    Update aftershock generation


>---------------------------------------------------------------

0af215c94deabd55483c044fa411333710399682
 src/core/VCEvent.h                 |  9 ++++++---
 src/simulation/BASSAftershocks.cpp | 20 +++++++++++---------
 src/simulation/BASSAftershocks.h   | 11 ++++++-----
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/core/VCEvent.h b/src/core/VCEvent.h
index 640145b..63d7de3 100644
--- a/src/core/VCEvent.h
+++ b/src/core/VCEvent.h
@@ -166,13 +166,13 @@ class VCEventAftershock : public VCGeneralEvent {
 };
 
 typedef std::vector<VCEventSweep> EventSweeps;
-typedef std::vector<VCEventAftershock> AftershockSet;
+typedef std::vector<VCEventAftershock> AftershockVector;
+typedef std::set<VCEventAftershock> AftershockSet;
 
 /*!
  A VCEvent is a rupture of one or more blocks on one or more faults in a VC model.
  This consists of origin information (trigger block, year) and information about
- how the event propagated through the system (event sweeps). It also contains
- the set of aftershocks associated with this event which may not be on any fault.
+ how the event propagated through the system (event sweeps).
  */
 class VCEvent {
     private:
@@ -194,7 +194,10 @@ class VCEvent {
         //! Sum of the EventSweeps slips, used to quickly calculate magnitude
         EventBlockMap   total_slip;
 
+        //! Initial and final sum of shear stress on all elements involved in the event
         double shear_stress_init, shear_stress_final;
+    
+        //! Initial and final sum of normal stress on all elements involved in the event
         double normal_stress_init, normal_stress_final;
 
     public:
diff --git a/src/simulation/BASSAftershocks.cpp b/src/simulation/BASSAftershocks.cpp
index e4c8a75..527d706 100644
--- a/src/simulation/BASSAftershocks.cpp
+++ b/src/simulation/BASSAftershocks.cpp
@@ -32,7 +32,7 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
     VCSimulation                *sim = static_cast<VCSimulation *>(_sim);
     unsigned int                genNum = 0, start, stop, count = 0;
     VCEventAftershock           initial_shock;
-    VCGeneralEventSet::iterator it;
+    AftershockVector::iterator  it;
     quakelib::Conversion        convert;
 
     // Get BASS parameters
@@ -45,7 +45,7 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
     _q = sim->getBASSDistanceDecay();
 
     first = true;
-    events_to_process = sim->getCurrentEvent().getAftershockPtr();
+    events_to_process.clear();
 
     // Generate initial seed shock based on the current event
     event_blocks.clear();
@@ -57,28 +57,30 @@ SimRequest BASSAftershocks::run(SimFramework *_sim) {
                                       0,        // No need to set x,y coords since they will be selected from entire fault
                                       0,
                                       0);
-    events_to_process->push_back(initial_shock);
+    events_to_process.push_back(initial_shock);
 
     start = 0;
-    stop  = events_to_process->size();
+    stop  = events_to_process.size();
 
     // Loop over N generations of aftershocks
     do {
         count = 0;
 
         for (unsigned int i=start; i<stop; ++i)
-            count += generateAftershocks(sim, events_to_process->at(i));
+            count += generateAftershocks(sim, events_to_process.at(i));
 
         start = stop;
-        stop  = events_to_process->size();
+        stop  = events_to_process.size();
     } while ( (++genNum < sim->getBASSMaxGenerations()) && (count > 0) );
 
     // Remove the initial seed event (main shock)
-    events_to_process->erase(events_to_process->begin(), events_to_process->begin()+1);
+    events_to_process.erase(events_to_process.begin());
 
     // Finally we sort the events into time order since the aftershocks in the
     // BASS model are usually not generated in ordered time sequence.
-    std::sort(events_to_process->begin(), events_to_process->end());
+    for (it=events_to_process.begin();it!=events_to_process.end();++it) {
+        sim->addAftershock(*it);
+    }
 
     return SIM_STOP_OK;
 }
@@ -136,7 +138,7 @@ unsigned int BASSAftershocks::generateAftershocks(VCSimulation *sim, VCEventAfte
         aftershock.y = seed_y + r*sin(theta);
 
         // Add the aftershock to our list
-        events_to_process->push_back(aftershock);
+        events_to_process.push_back(aftershock);
     }
 
     first = false;
diff --git a/src/simulation/BASSAftershocks.h b/src/simulation/BASSAftershocks.h
index 464754c..b2031bc 100644
--- a/src/simulation/BASSAftershocks.h
+++ b/src/simulation/BASSAftershocks.h
@@ -41,12 +41,13 @@ class BASSAftershocks : public SimPlugin {
         float _d;       //! Distance of aftershocks (meters)
         float _q;       //! Decay rate of aftershocks (distance)
 
-        // Member data
-        AftershockSet   *events_to_process;
-        BlockIDSet      event_blocks;
-        bool            first;
+        //! Vector of aftershocks that need to be processed
+        AftershockVector    events_to_process;
     
-        // Work horse function
+        BlockIDSet          event_blocks;
+        bool                first;
+
+        //! Work horse function
         unsigned int generateAftershocks(VCSimulation *sim, VCEventAftershock seed);
 
     public:



More information about the CIG-COMMITS mailing list