tsimulation.c: clean up simulation struct - granular - granular dynamics simula… | |
git clone git://src.adamsgaard.dk/granular | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 029670270ea16d58195e609b8f44e06d656aa44a | |
parent 88189a36b1fb2bef6d4627b3618a30886bf8f7c6 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 18 Mar 2021 10:07:09 +0100 | |
simulation.c: clean up simulation struct | |
Diffstat: | |
M simulation.c | 1 + | |
M simulation.h | 39 +++++++++++------------------… | |
2 files changed, 15 insertions(+), 25 deletions(-) | |
--- | |
diff --git a/simulation.c b/simulation.c | |
t@@ -0,0 +1 @@ | |
+#include "simulation.h" | |
diff --git a/simulation.h b/simulation.h | |
t@@ -1,8 +1,9 @@ | |
#ifndef GRANULAR_SIMULATION_ | |
#define GRANULAR_SIMULATION_ | |
+#include <stdio.h> | |
#include "granular.h" | |
-#include "arrays.h" | |
+#include "grain.h" | |
#define DEFAULT_SIMULATION_NAME "unnamed_simulation" | |
t@@ -17,39 +18,27 @@ struct simulation { | |
/* gravitational acceleration [m/s^2] */ | |
double gravacc[ND]; | |
- /* nodes along z */ | |
- int nz; | |
+ /* grain sorting grid */ | |
+ size_t nd[ND]; | |
+ double origo[ND]; | |
+ double L[ND]; | |
+ double x[ND]; | |
+ double dx; | |
- /* origo of axis [m] */ | |
- double origo_z; | |
- | |
- /* length of domain [m] */ | |
- double L_z; | |
- | |
- /* array of cell coordinates */ | |
- double *z; | |
- | |
- /* cell spacing [m] */ | |
- double dz; | |
- | |
- /* current time [s] */ | |
+ /* temporal state [s] */ | |
double t; | |
- | |
- /* end time [s] */ | |
double t_end; | |
- | |
- /* time step length [s] */ | |
double dt; | |
- | |
- /* interval between output files [s] */ | |
double file_dt; | |
+ size_t n_file; | |
- /* output file number */ | |
- int n_file; | |
- | |
+ /* grains */ | |
+ size_t n; | |
+ struct grain *grains; | |
}; | |
void init_sim(struct simulation *sim); | |
+void free_sim(struct simulation *sim); | |
void write_output_file(struct simulation *sim, const int normalize); | |
void print_output(struct simulation *sim, FILE *fp, const int normalize); |