summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-04-26 12:43:34 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-04-26 12:43:34 -0400
commit62c9955c37b2f9729d964093b129934ff8287cd4 (patch)
tree158e54350a7e1671382dc5d80b4bc0acf0acde3c
parent1cc17734cf7e872ea67782284d70004d6d02c473 (diff)
downloadfuse_networks-62c9955c37b2f9729d964093b129934ff8287cd4.tar.gz
fuse_networks-62c9955c37b2f9729d964093b129934ff8287cd4.tar.bz2
fuse_networks-62c9955c37b2f9729d964093b129934ff8287cd4.zip
fixed measurement of avalanches to now be at constant external strain
-rw-r--r--src/animate.cpp13
-rw-r--r--src/measurements.cpp2
2 files changed, 7 insertions, 8 deletions
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<long double>::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<double> 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]++;