summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fracture.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/fracture.c b/src/fracture.c
index 6ad2f26..168e519 100644
--- a/src/fracture.c
+++ b/src/fracture.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
double beta, inf, cutoff, crack_len;
bool save_data, save_cluster_dist, use_voltage_boundaries, use_dual, save_network,
save_crit_stress, save_energy, save_conductivity,
- save_damage, save_threshold;
+ save_damage, save_threshold, save_current_load;
bound_t boundary;
lattice_t lattice;
@@ -42,6 +42,7 @@ int main(int argc, char *argv[]) {
save_conductivity = false;
save_energy = false;
save_threshold = false;
+ save_current_load = false;
uint8_t bound_i;
@@ -145,6 +146,9 @@ int main(int argc, char *argv[]) {
case 'T':
save_threshold = true;
break;
+ case 'C':
+ save_current_load = true;
+ break;
default: /* '?' */
exit(EXIT_FAILURE);
}
@@ -240,6 +244,11 @@ int main(int argc, char *argv[]) {
thresholds = (long double *)malloc(N * sizeof(long double));
}
+ long double *loads;
+ if (save_current_load) {
+ loads = (long double *)malloc(N * sizeof(long double));
+ }
+
// start cholmod
cholmod_common c;
@@ -357,6 +366,9 @@ int main(int argc, char *argv[]) {
thresholds[i] = net->thres[data->break_list[max_pos]];
}
+ if (save_current_load) {
+ loads[i] = data->extern_field[max_pos] / net->thres[data->break_list[max_pos]];
+ }
if (save_data) {
for (uint_t j = 0; j < data->num_broken; j++) {
@@ -454,6 +466,16 @@ int main(int argc, char *argv[]) {
free(thresholds);
}
+ if (save_current_load) {
+ char *load_filename = (char *)malloc(filename_len * sizeof(char));
+ snprintf(load_filename, filename_len, "load_%c_%c_%c_%c_%d_%g_%g.dat", lattice_c, dual_c, boundc, boundc2, L, beta, crack_len);
+ FILE *load_file = fopen(load_filename, "ab");
+ fwrite(loads, sizeof(long double), N, load_file);
+ fclose(load_file);
+ free(load_filename);
+ free(loads);
+ }
+
if (save_damage) {
FILE *hdam_file = fopen(d_filename, "wb");
fwrite(damage, sizeof(uint32_t), max_edges, hdam_file);