tMove parameter_defaults.h into simulation.[ch] - cngf-pf - continuum model for… | |
git clone git://src.adamsgaard.dk/cngf-pf | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ee86ce5341929a56fed789f70797823d172f113a | |
parent 400068f8de728591976cfe3ae79d324009a1787e | |
Author: Anders Damsgaard <[email protected]> | |
Date: Thu, 16 Apr 2020 13:28:26 +0200 | |
Move parameter_defaults.h into simulation.[ch] | |
Diffstat: | |
M 1d_fd_simple_shear.c | 2 -- | |
M Makefile | 1 - | |
M max_depth_simple_shear.c | 1 - | |
D parameter_defaults.h | 116 ------------------------------ | |
M simulation.c | 108 +++++++++++++++++++++++++++++… | |
M simulation.h | 2 ++ | |
6 files changed, 109 insertions(+), 121 deletions(-) | |
--- | |
diff --git a/1d_fd_simple_shear.c b/1d_fd_simple_shear.c | |
t@@ -8,8 +8,6 @@ | |
#include "arg.h" | |
#include "fluid.h" | |
-#include "parameter_defaults.h" | |
- | |
/* relative tolerance criteria for granular fluidity solver */ | |
#define RTOL 1e-5 | |
#define MAX_ITER_1D_FD_SIMPLE_SHEAR 10000 | |
diff --git a/Makefile b/Makefile | |
t@@ -9,7 +9,6 @@ HDR = \ | |
arg.h\ | |
arrays.h\ | |
fluid.h\ | |
- parameter_defaults.h\ | |
simulation.h | |
BIN = \ | |
1d_fd_simple_shear\ | |
diff --git a/max_depth_simple_shear.c b/max_depth_simple_shear.c | |
t@@ -6,7 +6,6 @@ | |
#include <time.h> | |
#include "simulation.h" | |
-#include "parameter_defaults.h" | |
#include "arg.h" | |
#define EPS 1e-12 | |
diff --git a/parameter_defaults.h b/parameter_defaults.h | |
t@@ -1,116 +0,0 @@ | |
-#ifndef PARAMETER_DEFAULTS_H_ | |
-#define PARAMETER_DEFAULTS_H_ | |
- | |
-#include <math.h> | |
-#include <stdio.h> | |
-#include "arrays.h" | |
-#include "simulation.h" | |
- | |
-#define DEFAULT_SIMULATION_NAME "unnamed_simulation" | |
- | |
-/* Simulation settings */ | |
-void | |
-init_sim(struct simulation *sim) | |
-{ | |
- snprintf(sim->name, sizeof(sim->name), DEFAULT_SIMULATION_NAME); | |
- | |
- sim->G = 9.81; | |
- | |
- sim->P_wall = 120e3; | |
- sim->mu_wall = 0.45; | |
- sim->v_x_bot = 0.0; | |
- sim->v_x_fix = NAN; | |
- sim->v_x_limit = NAN; | |
- | |
- sim->nz = -1; /* cell size equals grain size if negative */ | |
- | |
- /* lower values of A mean that the velocity curve can have sharper cur… | |
- * e.g. at the transition from μ ≈ μ_s */ | |
- sim->A = 0.40; /* Loose fit to Damsgaard et al 2013 */ | |
- | |
- /* lower values of b mean larger shear velocity for a given stress rat… | |
- * above yield */ | |
- sim->b = 0.9377; /* Henann and Kamrin 2016 */ | |
- | |
- /* Henann and Kamrin 2016 */ | |
- /* sim->mu_s = 0.3819; */ | |
- /* sim->C = 0.0; */ | |
- | |
- /* Damsgaard et al 2013 */ | |
- sim->mu_s = tan(DEG2RAD(22.0)); | |
- sim->C = 0.0; | |
- sim->phi = initval(0.25, 1); | |
- sim->d = 0.04; /* Damsgaard et al 2013 */ | |
- | |
- sim->transient = 0; | |
- sim->phi_min = 0.25; | |
- sim->phi_max = 0.55; | |
- sim->dilatancy_angle = 1.0; | |
- | |
- /* Iverson et al 1997, 1998: Storglaciaren till */ | |
- /* sim->mu_s = tan(DEG2RAD(26.3)); */ | |
- /* sim->C = 5.0e3; */ | |
- /* sim->phi = initval(0.22, 1); */ | |
- /* sim->d = ??; */ | |
- | |
- /* Iverson et al 1997, 1998: Two Rivers till */ | |
- /* sim->mu_s = tan(DEG2RAD(17.8)); */ | |
- /* sim->C = 14.0e3; */ | |
- /* sim->phi = initval(0.37, 1); */ | |
- /* sim->d = ??; */ | |
- | |
- /* Tulaczyk et al 2000a: Upstream B till */ | |
- /* sim->mu_s = tan(DEG2RAD(23.9)); */ | |
- /* sim->C = 3.0e3; */ | |
- /* sim->phi = initval(0.35, 1); */ | |
- /* sim->d = ??; */ | |
- | |
- /* grain material density [kg/m^3] */ | |
- sim->rho_s = 2.6e3; /* Damsgaard et al 2013 */ | |
- | |
- /* spatial settings */ | |
- sim->origo_z = 0.0; | |
- sim->L_z = 1.0; | |
- | |
- /* temporal settings */ | |
- sim->t = 0.0; | |
- sim->dt = 2.0; | |
- sim->t_end = 1.0; | |
- sim->file_dt = 0.1; | |
- sim->n_file = 0; | |
- | |
- /* fluid settings */ | |
- sim->fluid = 0; | |
- | |
- sim->rho_f = 1e3; | |
- | |
- /* Water at 20 deg C, Goren et al 2011 */ | |
- /* sim->beta_f = 4.5e-10; */ | |
- /* sim->mu_f = 1.0-3; */ | |
- | |
- /* Water at 0 deg C */ | |
- sim->beta_f = 3.9e-10; /* doi:10.1063/1.1679903 */ | |
- sim->mu_f = 1.787e-3; /* Cuffey and Paterson 2010 */ | |
- | |
- /* Damsgaard et al 2015 */ | |
- sim->k = initval(1.9e-15, 1); | |
- | |
- /* Iverson et al 1994: Storglaciaren */ | |
- /* sim->k = initval(1.3e-14, 1); */ | |
- | |
- /* Engelhardt et al 1990: Upstream B */ | |
- /* sim->k = initval(2.0e-16, 1); */ | |
- | |
- /* Leeman et al 2016: Upstream B till */ | |
- /* sim->k = initval(4.9e-17, 1); */ | |
- | |
- /* no fluid-pressure variations */ | |
- sim->p_f_top = 0.0; | |
- sim->p_f_mod_ampl = 0.0; | |
- sim->p_f_mod_freq = 1.0; | |
- sim->p_f_mod_phase = 0.0; | |
- sim->p_f_mod_pulse_time = NAN; | |
- sim->p_f_mod_pulse_shape = 0; | |
-} | |
- | |
-#endif | |
diff --git a/simulation.c b/simulation.c | |
t@@ -5,6 +5,7 @@ | |
#include "simulation.h" | |
#include "fluid.h" | |
+ | |
/* #define SHOW_PARAMETERS */ | |
/* relative tolerance criteria for granular fluidity solver */ | |
t@@ -19,6 +20,112 @@ | |
#define RTOL_STRESS 1e-3 | |
#define MAX_ITER_STRESS 20000 | |
+ | |
+/* Simulation settings */ | |
+void | |
+init_sim(struct simulation *sim) | |
+{ | |
+ snprintf(sim->name, sizeof(sim->name), DEFAULT_SIMULATION_NAME); | |
+ | |
+ sim->G = 9.81; | |
+ | |
+ sim->P_wall = 120e3; | |
+ sim->mu_wall = 0.45; | |
+ sim->v_x_bot = 0.0; | |
+ sim->v_x_fix = NAN; | |
+ sim->v_x_limit = NAN; | |
+ | |
+ sim->nz = -1; /* cell size equals grain size if negative */ | |
+ | |
+ /* lower values of A mean that the velocity curve can have sharper cur… | |
+ * e.g. at the transition from μ ≈ μ_s */ | |
+ sim->A = 0.40; /* Loose fit to Damsgaard et al 2013 */ | |
+ | |
+ /* lower values of b mean larger shear velocity for a given stress rat… | |
+ * above yield */ | |
+ sim->b = 0.9377; /* Henann and Kamrin 2016 */ | |
+ | |
+ /* Henann and Kamrin 2016 */ | |
+ /* sim->mu_s = 0.3819; */ | |
+ /* sim->C = 0.0; */ | |
+ | |
+ /* Damsgaard et al 2013 */ | |
+ sim->mu_s = tan(DEG2RAD(22.0)); | |
+ sim->C = 0.0; | |
+ sim->phi = initval(0.25, 1); | |
+ sim->d = 0.04; /* Damsgaard et al 2013 */ | |
+ | |
+ sim->transient = 0; | |
+ sim->phi_min = 0.25; | |
+ sim->phi_max = 0.55; | |
+ sim->dilatancy_angle = 1.0; | |
+ | |
+ /* Iverson et al 1997, 1998: Storglaciaren till */ | |
+ /* sim->mu_s = tan(DEG2RAD(26.3)); */ | |
+ /* sim->C = 5.0e3; */ | |
+ /* sim->phi = initval(0.22, 1); */ | |
+ /* sim->d = ??; */ | |
+ | |
+ /* Iverson et al 1997, 1998: Two Rivers till */ | |
+ /* sim->mu_s = tan(DEG2RAD(17.8)); */ | |
+ /* sim->C = 14.0e3; */ | |
+ /* sim->phi = initval(0.37, 1); */ | |
+ /* sim->d = ??; */ | |
+ | |
+ /* Tulaczyk et al 2000a: Upstream B till */ | |
+ /* sim->mu_s = tan(DEG2RAD(23.9)); */ | |
+ /* sim->C = 3.0e3; */ | |
+ /* sim->phi = initval(0.35, 1); */ | |
+ /* sim->d = ??; */ | |
+ | |
+ /* grain material density [kg/m^3] */ | |
+ sim->rho_s = 2.6e3; /* Damsgaard et al 2013 */ | |
+ | |
+ /* spatial settings */ | |
+ sim->origo_z = 0.0; | |
+ sim->L_z = 1.0; | |
+ | |
+ /* temporal settings */ | |
+ sim->t = 0.0; | |
+ sim->dt = 2.0; | |
+ sim->t_end = 1.0; | |
+ sim->file_dt = 0.1; | |
+ sim->n_file = 0; | |
+ | |
+ /* fluid settings */ | |
+ sim->fluid = 0; | |
+ | |
+ sim->rho_f = 1e3; | |
+ | |
+ /* Water at 20 deg C, Goren et al 2011 */ | |
+ /* sim->beta_f = 4.5e-10; */ | |
+ /* sim->mu_f = 1.0-3; */ | |
+ | |
+ /* Water at 0 deg C */ | |
+ sim->beta_f = 3.9e-10; /* doi:10.1063/1.1679903 */ | |
+ sim->mu_f = 1.787e-3; /* Cuffey and Paterson 2010 */ | |
+ | |
+ /* Damsgaard et al 2015 */ | |
+ sim->k = initval(1.9e-15, 1); | |
+ | |
+ /* Iverson et al 1994: Storglaciaren */ | |
+ /* sim->k = initval(1.3e-14, 1); */ | |
+ | |
+ /* Engelhardt et al 1990: Upstream B */ | |
+ /* sim->k = initval(2.0e-16, 1); */ | |
+ | |
+ /* Leeman et al 2016: Upstream B till */ | |
+ /* sim->k = initval(4.9e-17, 1); */ | |
+ | |
+ /* no fluid-pressure variations */ | |
+ sim->p_f_top = 0.0; | |
+ sim->p_f_mod_ampl = 0.0; | |
+ sim->p_f_mod_freq = 1.0; | |
+ sim->p_f_mod_phase = 0.0; | |
+ sim->p_f_mod_pulse_time = NAN; | |
+ sim->p_f_mod_pulse_shape = 0; | |
+} | |
+ | |
void | |
prepare_arrays(struct simulation *sim) | |
{ | |
t@@ -738,4 +845,3 @@ coupled_shear_solver(struct simulation *sim, | |
return 0; | |
} | |
- | |
diff --git a/simulation.h b/simulation.h | |
t@@ -3,6 +3,7 @@ | |
#include "arrays.h" | |
+#define DEFAULT_SIMULATION_NAME "unnamed_simulation" | |
#define PI 3.14159265358979323846 | |
#define DEG2RAD(x) (x*PI/180.0) | |
t@@ -115,6 +116,7 @@ struct simulation { | |
double* tan_psi; /* tan(dilatancy_angle) [-] */ | |
}; | |
+void init_sim(struct simulation *sim); | |
void prepare_arrays(struct simulation *sim); | |
void free_arrays(struct simulation *sim); | |