From 62c9955c37b2f9729d964093b129934ff8287cd4 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Fri, 26 Apr 2019 12:43:34 -0400 Subject: fixed measurement of avalanches to now be at constant external strain --- src/animate.cpp | 13 ++++++------- src/measurements.cpp | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/animate.cpp b/src/animate.cpp index be0beef..9ba335b 100644 --- a/src/animate.cpp +++ b/src/animate.cpp @@ -15,7 +15,7 @@ animate::animate(double Lx, double Ly, unsigned window_size, int argc, char *arg void animate::pre_fracture(const network &n) { lv = std::numeric_limits::lowest(); - avalanches = {{}}; + avalanches = {}; boost::remove_edge_if(trivial, G); glClearColor(1.0f, 1.0f, 1.0f, 1.0f ); @@ -49,8 +49,8 @@ void animate::pre_fracture(const network &n) { } void animate::bond_broken(const network& n, const current_info& cur, unsigned i) { - long double c = logl(cur.conductivity / fabs(cur.currents[i])) + n.thresholds[i]; - if (c > lv && avalanches.back().size() > 0) { + long double c = n.thresholds[i] - logl(fabs(cur.currents[i])); + if (c > lv) { lv = c; avalanches.push_back({i}); } else { @@ -94,19 +94,18 @@ void animate::post_fracture(network &n) { std::default_random_engine gen; std::uniform_real_distribution dis(0.0,1.0); - bool cycle_present = true; auto av_it = avalanches.rbegin(); - while (cycle_present) { + while (true) { for (unsigned e : *av_it) { boost::remove_edge(n.G.dual_edges[e].v[0], n.G.dual_edges[e].v[1], G); n.fuses[e] = false; } auto cracks = find_minimal_crack(G, n); - std::cout << cracks.size() << "\n"; + if (cracks.size() == 0) { - cycle_present = false; + break; } av_it++; diff --git a/src/measurements.cpp b/src/measurements.cpp index ffd814d..00643b3 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -172,7 +172,7 @@ void ma::pre_fracture(const network&) { } void ma::bond_broken(const network& net, const current_info& cur, unsigned i) { - long double c = logl(cur.conductivity / fabs(cur.currents[i])) + net.thresholds[i]; + long double c = n.thresholds[i] - logl(fabs(cur.currents[i])); if (c > lv) { if (avalanches.size() > 0) { sa[avalanches.back().size() - 1]++; -- cgit v1.2.3-54-g00ecf