From 869df8ab1856fa36eaca09c15582c2fb1335a64c Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Thu, 6 Dec 2018 11:42:26 -0500 Subject: now write fracture data to bondfile, and avalanche statistics now computed using long doubles --- src/measurements.cpp | 11 ++++++++++- src/measurements.hpp | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/measurements.cpp b/src/measurements.cpp index e32f07f..5dc6a64 100644 --- a/src/measurements.cpp +++ b/src/measurements.cpp @@ -253,6 +253,10 @@ ma::ma(unsigned int Lx, unsigned int Ly, double beta) : Lx(Lx), Ly(Ly), beta(bet forward_plan = fftw_plan_dft_r2c_2d(Ly, Lx, fftw_forward_in, fftw_forward_out, 0); reverse_plan = fftw_plan_dft_c2r_2d(Ly, Lx, fftw_reverse_in, fftw_reverse_out, 0); + + std::string filename = "fracture_" + std::to_string(Lx) + "_" + std::to_string(Ly) + "_" + std::to_string(beta) + "_broken.dat"; + + bondfile.open(filename, std::ifstream::app); } ma::~ma() { @@ -277,6 +281,8 @@ ma::~ma() { update_field_file("Caa", Caa, Na, Lx, Ly, beta); update_field_file("Cll", Cll, N, Lx, Ly, beta); update_field_file("Cee", Cee, N, Lx, Ly, beta); + + bondfile.close(); } void ma::pre_fracture(const network &) { @@ -286,7 +292,7 @@ void ma::pre_fracture(const network &) { } void ma::bond_broken(const network& net, const current_info& cur, unsigned int i) { - double c = cur.conductivity / fabs(cur.currents[i]) * net.thresholds[i]; + long double c = cur.conductivity / fabs(cur.currents[i]) * net.thresholds[i]; if (c > lv && avalanches.back().size() > 0) { sa[avalanches.back().size() - 1]++; Na++; @@ -306,9 +312,12 @@ void ma::bond_broken(const network& net, const current_info& cur, unsigned int i } boost::add_edge(net.G.dual_edges[i][0], net.G.dual_edges[i][1], {i}, G); + + bondfile << i << " " << c << std::scientific << " "; } void ma::post_fracture(network &n) { + bondfile << "\n"; std::vector component(boost::num_vertices(G)); unsigned int num = boost::connected_components(G, &component[0]); diff --git a/src/measurements.hpp b/src/measurements.hpp index 703dccd..2bc5bae 100644 --- a/src/measurements.hpp +++ b/src/measurements.hpp @@ -62,8 +62,10 @@ class ma : public hooks { uint64_t Nc; uint64_t Na; + std::ofstream bondfile; + public: - double lv; + long double lv; std::list> avalanches; -- cgit v1.2.3-54-g00ecf