diff --git a/isotables/isotopapp/templates/diffusion.html b/isotables/isotopapp/templates/diffusion.html new file mode 100644 index 0000000..c2d9b49 --- /dev/null +++ b/isotables/isotopapp/templates/diffusion.html @@ -0,0 +1,29 @@ +{% extends 'base.html' %} +{% block content %} + +
+

Diffusion coefficient

+

{{ standard_name|safe }}

+ + + + + + + + + + + + + + + + + + +
+ Holz et al. Phys. Chem. Chem. Phys., 2000, 2, 4740-4742 +
T/KT/°CD/m²s⁻¹
{{ temperature_kelvin|stringformat:".2f" }}{{ temperature_celsius|stringformat:".2f" }}{{ diffusion_constant|stringformat:".3e" }}
+
+{% endblock %} \ No newline at end of file diff --git a/isotables/isotopapp/templates/result.html b/isotables/isotopapp/templates/result.html index 4e747cf..3c37c22 100644 --- a/isotables/isotopapp/templates/result.html +++ b/isotables/isotopapp/templates/result.html @@ -1,5 +1,4 @@ {% extends 'base.html' %} - {% block content %}
diff --git a/isotables/isotopapp/templates/sfg.html b/isotables/isotopapp/templates/sfg.html index 1eaf21c..3984f96 100644 --- a/isotables/isotopapp/templates/sfg.html +++ b/isotables/isotopapp/templates/sfg.html @@ -1,6 +1,7 @@ {% extends 'base.html' %} {% block content %}
+

SFG Position Calculator

@@ -49,15 +50,27 @@
-
-
- -
+
+
+ +
+
+
+
+ +
+
diff --git a/isotables/isotopapp/urls.py b/isotables/isotopapp/urls.py index 586744b..4fe6a36 100644 --- a/isotables/isotopapp/urls.py +++ b/isotables/isotopapp/urls.py @@ -5,6 +5,7 @@ urlpatterns = [ path('result/', views.result, name='result'), path('sfg', views.sfg, name='sfg'), path('position/', views.position, name='position'), + path('diffusion/', views.diffusion, name='diffusion'), ] diff --git a/isotables/isotopapp/views.py b/isotables/isotopapp/views.py index 74f36e1..62a2a73 100644 --- a/isotables/isotopapp/views.py +++ b/isotables/isotopapp/views.py @@ -280,3 +280,38 @@ def position(request): "div_table": div_table}) +def diff(c1, c2, temp_Kelvin): + return 1e-9*np.exp(c1+c2*1000/temp_Kelvin) + +def diffusion(request): + standard = request.GET.get("standard") + temperature = float(request.GET.get("temperature")) + if standard == "h2o": + diffusion_constant = 1.635e-8*(temperature/215.05-1)**2.063 + standard_name = "H2O" + elif standard == "tetradecane": + diffusion_constant = diff(5.6286, -1.8726, temperature) + standard_name = "Tetradecane" + elif standard == "cyclohexane": + diffusion_constant = diff(5.8765, -1.6477, temperature) + standard_name = "Cyclohexane" + elif standard == "dioxane": + diffusion_constant = diff(5.7064, -1.6754, temperature) + standard_name = "Dioxane" + elif standard == "dodecane": + diffusion_constant = diff(5.3193 , -1.6483, temperature) + standard_name = "Dodecane" + elif standard == "dmso": + diffusion_constant = diff(5.6991 , -1.7927, temperature) + standard_name = "DMSO" + elif standard == "pentanol": + diffusion_constant = diff(8.4847, -2.9018, temperature) + standard_name = "Pentanol" + + + + + return render(request, 'diffusion.html', {'standard_name': standard_name, + 'temperature_kelvin': temperature, + 'temperature_celsius': temperature-273.15, + 'diffusion_constant': diffusion_constant})