added column width rad/T
added diffusion constants
This commit is contained in:
parent
5e1d704cdd
commit
f7e4115fb8
29
isotables/isotopapp/templates/diffusion.html
Normal file
29
isotables/isotopapp/templates/diffusion.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
|
||||
<div class="container">
|
||||
<h1>Diffusion coefficient</h1>
|
||||
<h2> {{ standard_name|safe }} </h2>
|
||||
<table class="table w-auto table-responsive-sm table-striped table-hover table-bordered">
|
||||
<caption>
|
||||
Holz et al. Phys. Chem. Chem. Phys., 2000, 2, 4740-4742
|
||||
</caption>
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th scope="col">T/K</th>
|
||||
<th scope="col">T/°C</th>
|
||||
<th scope="col">D/m²s⁻¹</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>{{ temperature_kelvin|stringformat:".2f" }}</td>
|
||||
<td>{{ temperature_celsius|stringformat:".2f" }}</td>
|
||||
<td>{{ diffusion_constant|stringformat:".3e" }}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,5 +1,4 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="container">
|
||||
|
@ -1,6 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
<div class="container text-left">
|
||||
<form action="diffusion" id="diffusion_form">
|
||||
<h1>SFG Position Calculator</h1>
|
||||
|
||||
<form action="position">
|
||||
@ -49,15 +50,27 @@
|
||||
<option value="magnex_profile.dat">Magnex</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-6">
|
||||
<label class="form-label">Gradient in T/m:<br>(assuming ⌀5mm)</label>
|
||||
<!-- <div class="col"><input type="number" name="gradient" class="form-control" step="any"
|
||||
placeholder="Gradient in T/m"></div>-->
|
||||
<div class="col">
|
||||
<button type="submit" name="gradient_search" class="btn btn-primary btn-sm">Get position</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cols-6">
|
||||
<div class="col">
|
||||
<select name="standard" class="form-select" size="1" form="diffusion_form">
|
||||
<option value="h2o">D(H2O)</option>
|
||||
<option value="tetradecane">D(Tetradecane)</option>
|
||||
<option value="pentanol">D(Pentanol)</option>
|
||||
<option value="dodecane">D(Dodecane)</option>
|
||||
<option value="dioxane">D(Dioxane)</option>
|
||||
<option value="dmso">D(DMSO)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col">
|
||||
<input type="number" name="temperature" class="form-control" step="any" placeholder="T/K" form="diffusion_form"></div>
|
||||
<div class="col">
|
||||
<button type="submit" name="diffusion_search" class="btn btn-primary btn-sm" form="diffusion_form">Get diffusion coefficient</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -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'),
|
||||
]
|
||||
|
||||
|
||||
|
@ -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 = "H<sub>2</sub>O"
|
||||
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})
|
||||
|
Loading…
x
Reference in New Issue
Block a user