1d_fd_simple_shear

Continuum model for granular flows with pore-pressure dynamics
git clone git://src.adamsgaard.dk/1d_fd_simple_shear
Log | Files | Refs | README | LICENSE

commit 4d51b11991631dd7cb45ee6395c5288268bab329
parent e700e8e26323a391f374c70d5c659dd8f2420a1c
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sat,  6 Jul 2019 11:09:08 +0200

Only write intermediate output files to disk if a simulation name is specified

Diffstat:
Mmain.c | 7++++---
Mparameter_defaults.h | 4+++-
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/main.c b/main.c @@ -2,6 +2,7 @@ #include <stdlib.h> #include <math.h> #include <getopt.h> +#include <string.h> #include "simulation.h" #include "fluid.h" @@ -17,7 +18,7 @@ usage(void) struct simulation sim = init_sim(); printf("%s: %s [OPTIONS] [NAME]\n" "runs a simulation and outputs state in files prefixed with NAME.\n" - "If NAME is not specified, the default value '%s' is used.\n" + "If NAME is not specified, intermediate output are not written.\n" "\nOptional arguments:\n" " -v, --version show version information\n" " -h, --help show this message\n" @@ -49,7 +50,6 @@ usage(void) " -T, --time-end VAL simulation end time [s] (default %g)\n" " -I, --file-interval VAL interval between output files [s] (default %g)\n", __func__, PROGNAME, - sim.name, sim.G, sim.P_wall, sim.mu_wall, @@ -288,7 +288,8 @@ main(int argc, char* argv[]) filetimeclock += sim.dt; iter++; - if (filetimeclock >= sim.file_dt || iter == 0) { + if ((filetimeclock >= sim.file_dt || iter == 0) && + strcmp(sim.name, DEFAULT_SIMULATION_NAME) != 0) { write_output_file(&sim, norm); filetimeclock = 0.0; } diff --git a/parameter_defaults.h b/parameter_defaults.h @@ -6,12 +6,14 @@ #include "arrays.h" #include "simulation.h" +#define DEFAULT_SIMULATION_NAME "unnamed_simulation" + /* Simulation settings */ struct simulation init_sim(void) { struct simulation sim; - sprintf(sim.name, "unnamed"); + sprintf(sim.name, DEFAULT_SIMULATION_NAME); sim.G = 9.81;