summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2018-12-06 11:42:26 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2018-12-06 11:42:26 -0500
commit869df8ab1856fa36eaca09c15582c2fb1335a64c (patch)
tree7a29c1f98c96e8c461e43be10052158cb9699c64
parent4f4cf365eae07e04298459bf8f9e27ad0cfcc834 (diff)
downloadfuse_networks-869df8ab1856fa36eaca09c15582c2fb1335a64c.tar.gz
fuse_networks-869df8ab1856fa36eaca09c15582c2fb1335a64c.tar.bz2
fuse_networks-869df8ab1856fa36eaca09c15582c2fb1335a64c.zip
now write fracture data to bondfile, and avalanche statistics now computed using long doubles
-rw-r--r--src/measurements.cpp11
-rw-r--r--src/measurements.hpp4
2 files changed, 13 insertions, 2 deletions
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<unsigned int> 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<std::list<unsigned int>> avalanches;