From ecb93a1b77f4c3e2189f83d46ea69d3531d2b161 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Tue, 11 Dec 2018 10:07:04 +0000
Subject: [PATCH] Add the mean molecular weight of neutral and ionised gas to
 the hydro properties.

---
 src/hydro_properties.c | 6 ++++++
 src/hydro_properties.h | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/src/hydro_properties.c b/src/hydro_properties.c
index 2b1cd42055..85f88d418b 100644
--- a/src/hydro_properties.c
+++ b/src/hydro_properties.c
@@ -119,6 +119,12 @@ void hydro_props_init(struct hydro_props *p,
   p->hydrogen_mass_fraction = parser_get_opt_param_double(
       params, "SPH:H_mass_fraction", default_H_fraction);
 
+  /* Mean molecular mass for neutral gas */
+  p->mu_neutral = 4. / (1. + 3. * p->hydrogen_mass_fraction);
+
+  /* Mean molecular mass for fully ionised gas */
+  p->mu_ionised = 4. / (8. - 5. * (1. - p->hydrogen_mass_fraction));
+
   /* Read the artificial viscosity parameters from the file, if they exist */
   p->viscosity.alpha = parser_get_opt_param_float(
       params, "SPH:viscosity_alpha", hydro_props_default_viscosity_alpha);
diff --git a/src/hydro_properties.h b/src/hydro_properties.h
index b45b93192e..5ee6a22d2c 100644
--- a/src/hydro_properties.h
+++ b/src/hydro_properties.h
@@ -84,6 +84,12 @@ struct hydro_props {
   /*! Temperature of the neutral to ionized transition of Hydrogen */
   float hydrogen_ionization_temperature;
 
+  /*! Mean molecular weight below hydrogen ionization temperature */
+  float mu_neutral;
+
+  /*! Mean molecular weight above hydrogen ionization temperature */
+  float mu_ionised;
+
   /*! Artificial viscosity parameters */
   struct {
     /*! For the fixed, simple case. Also used to set the initial AV
-- 
GitLab