tadd preliminary granular.c - granular - granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/granular
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit de5b411b0d19c619085a9895f352df8005eece08
(DIR) parent e9d0900081d592028d4f522e50d22ddd51209c73
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 18 Mar 2021 00:18:43 +0100
add preliminary granular.c
Diffstat:
A granular.c | 50 +++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/granular.c b/granular.c
t@@ -0,0 +1,50 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <err.h>
+
+#include "grain.h"
+
+#include "arg.h"
+
+/* relative tolerance criteria for the solvers */
+#define RTOL 1e-5
+#define MAX_ITER_1D_FD_SIMPLE_SHEAR 100000
+
+/* uncomment to print time spent per time step to stdout */
+/* #define BENCHMARK_PERFORMANCE */
+
+char *argv0;
+
+static void
+usage(void)
+{
+ errx(1, "usage: %s "
+ "[name]\n", argv0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ /* struct simulation sim; */
+
+#ifdef __OpenBSD__
+ if (pledge("stdio wpath cpath", NULL) == -1)
+ err(2, "pledge failed");
+#endif
+
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND;
+
+ /*if (argc == 1 && argv[0])
+ snprintf(sim.name, sizeof(sim.name), "%s", argv[0]);
+ else */if (argc > 1)
+ usage();
+
+ return 0;
+}