From ea1fabde9c6522209bf88b722b64a4bce1248cec Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 2 Oct 2019 11:27:19 -0400 Subject: fixed square lattice fracture --- src/measurements.cpp | 26 +++++++++++++++----------- src/measurements.hpp | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/measurements.cpp b/src/measurements.cpp index 1a937be..8b1c9d6 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -170,12 +170,14 @@ ma::ma(unsigned n, double a, double beta, double weight) model_string = "fracture_" + std::to_string(n) + "_" + std::to_string(a) + "_INF_" + std::to_string(weight) + "_"; } + Mx = 2 * sqrt(n) * a; + My = 2 * sqrt(n) / a; } ma::ma(unsigned Lx, unsigned Ly, double beta, double weight) : sn(Lx * Ly / 2), ss(Lx * Ly / 2), sm(Lx * Ly / 2), sl(Lx * Ly / 2), sb(Lx * Ly / 2 + 1), - sd(Lx * Ly), sa(Lx * Ly), sA(Lx * Ly), si(10000), sI(10000), cn(Lx * Ly), cs(Lx * Ly), - cm(Lx * Ly), cl(Lx * Ly), cb(Lx * Ly), ca(Lx * Ly), cA(Lx * Ly), cp(Lx * Ly), cq(Lx * Ly) { + sd(Lx * Ly), sa(Lx * Ly), sA(Lx * Ly), si(10000), sI(10000), cn((Lx / 2 + 1) * (Ly / 2 + 1)), cs((Lx / 2 + 1) * (Ly / 2 + 1)), + cm((Lx / 2 + 1) * (Ly / 2 + 1)), cl((Lx / 2 + 1) * (Ly / 2 + 1)), cb((Lx / 2 + 1) * (Ly / 2 + 1)), ca((Lx / 2 + 1) * (Ly / 2 + 1)), cA((Lx / 2 + 1) * (Ly / 2 + 1)), cp((Lx / 2 + 1) * (Ly / 2 + 1)), cq((Lx / 2 + 1) * (Ly / 2 + 1)) { if (beta != 0.0) { model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_" + std::to_string(weight) + "_"; @@ -183,6 +185,8 @@ ma::ma(unsigned Lx, unsigned Ly, double beta, double weight) model_string = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_INF_" + std::to_string(weight) + "_"; } + Mx = Lx; + My = Ly; } ma::~ma() { @@ -243,7 +247,7 @@ void ma::post_fracture(network& n) { for (unsigned e : crack.second) { cl_cs.push_back(n.G.dual_edges[e].r); } - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cl.size()), 2 * sqrt(cl.size()), cl, cl_cs, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cl, cl_cs, crack.first); std::vector> components(n.G.dual_vertices.size()); @@ -258,17 +262,17 @@ void ma::post_fracture(network& n) { if (components[i].size() > 0) { if (i != crack_component) { sm[components[i].size() - 1]++; - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cm.size()), 2 * sqrt(cm.size()), cm, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cm, components[i], crack.first); - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cp.size()), 2 * sqrt(cp.size()), cp, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cp, components[i], {0, 1}); } else { ss[components[i].size() - 1]++; - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cs.size()), 2 * sqrt(cs.size()), cs, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cs, components[i], crack.first); } sn[components[i].size() - 1]++; - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cn.size()), 2 * sqrt(cn.size()), cn, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cn, components[i], crack.first); } } @@ -294,7 +298,7 @@ void ma::post_fracture(network& n) { } sb[bb_size]++; - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cb.size()), 2 * sqrt(cb.size()), cb, cb_co, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cb, cb_co, crack.first); auto av_it = avalanches.rbegin(); @@ -306,9 +310,9 @@ void ma::post_fracture(network& n) { for (unsigned e : (*av_it)) { ca_co.push_back(n.G.edges[e].r); } - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(ca.size()), 2 * sqrt(ca.size()), ca, ca_co, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, ca, ca_co, crack.first); - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cq.size()), 2 * sqrt(cq.size()), cq, ca_co, {0, 1}); + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cq, ca_co, {0, 1}); av_it++; } @@ -317,7 +321,7 @@ void ma::post_fracture(network& n) { for (unsigned e : avalanches.back()) { cA_co.push_back(n.G.edges[e].r); } - autocorrelation2(n.G.L.x, n.G.L.y, 2 * sqrt(cA.size()), 2 * sqrt(cA.size()), cA, cA_co, + autocorrelation2(n.G.L.x, n.G.L.y, Mx, My, cA, cA_co, crack.first); sd[num - 1]++; diff --git a/src/measurements.hpp b/src/measurements.hpp index 4fbd9fc..135f312 100644 --- a/src/measurements.hpp +++ b/src/measurements.hpp @@ -17,6 +17,8 @@ class ma : public hooks { // - interface for turning on and off specific measurements // private: + unsigned Mx; + unsigned My; unsigned num; // measurement storage -- cgit v1.2.3-54-g00ecf