added tables and other edits
Browse files
efficiency_module/efficiency.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import numpy as np
|
| 2 |
from flask import render_template, request
|
| 3 |
from . import blueprint
|
|
|
|
| 4 |
|
| 5 |
# load the index page for the exposure module
|
| 6 |
@blueprint.route('/efficiency', methods=['GET'])
|
|
@@ -11,5 +12,37 @@ def efficiency():
|
|
| 11 |
# build the report page for the exposure module
|
| 12 |
@blueprint.route('/efficiency', methods=['POST'])
|
| 13 |
def eff_post():
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
from flask import render_template, request
|
| 3 |
from . import blueprint
|
| 4 |
+
from functions import PlaneSheetAnalytical
|
| 5 |
|
| 6 |
# load the index page for the exposure module
|
| 7 |
@blueprint.route('/efficiency', methods=['GET'])
|
|
|
|
| 12 |
# build the report page for the exposure module
|
| 13 |
@blueprint.route('/efficiency', methods=['POST'])
|
| 14 |
def eff_post():
|
| 15 |
+
|
| 16 |
+
mass = float(request.form["mass"])
|
| 17 |
+
density = float(request.form["density"])
|
| 18 |
+
PolymerVolume = mass / density
|
| 19 |
+
SurfaceArea = float(request.form["area"])
|
| 20 |
+
|
| 21 |
+
SolventVolume = float(request.form["svol"])
|
| 22 |
+
ExtractionTime = float(request.form["time"])*3600.
|
| 23 |
+
iterations = int(request.form["iterations"])
|
| 24 |
+
|
| 25 |
+
ExtractionTime = ExtractionTime * iterations
|
| 26 |
+
SolventVolume = SolventVolume * iterations
|
| 27 |
+
|
| 28 |
+
#D = float(request.form["DiffCoeff"])
|
| 29 |
+
#K = float(request.form["PartCoeff"])
|
| 30 |
+
|
| 31 |
+
L = PolymerVolume / SurfaceArea
|
| 32 |
+
|
| 33 |
+
nterms = 5
|
| 34 |
+
M0 = 1.
|
| 35 |
+
K = np.array((1e-3, 1., 1e3))
|
| 36 |
+
D = np.array((1e-7, 1e-10, 1e-13))
|
| 37 |
+
ExtEff = np.zeros((3,3))
|
| 38 |
+
for i in range(3):
|
| 39 |
+
for j in range(3):
|
| 40 |
+
ExtEff[i,j] = PlaneSheetAnalytical(M0, D[i], K[j], PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime, nterms)
|
| 41 |
+
print(ExtEff[i,j])
|
| 42 |
+
|
| 43 |
+
Conc = ExtEff * PolymerVolume / SolventVolume
|
| 44 |
+
|
| 45 |
+
print(Conc)
|
| 46 |
+
|
| 47 |
+
return render_template('efficiency_report.html', ExtEff = ExtEff, Conc=Conc)
|
| 48 |
|
efficiency_module/templates/efficiency_index.html
CHANGED
|
@@ -22,5 +22,41 @@
|
|
| 22 |
|
| 23 |
<form method="POST">
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
</body>
|
| 26 |
</html>
|
|
|
|
| 22 |
|
| 23 |
<form method="POST">
|
| 24 |
|
| 25 |
+
<!-- Test article input section -->
|
| 26 |
+
|
| 27 |
+
<h3> Test article <button type="button" class="Info_btn" data-toggle="modal" data-target="#ArticleModal">ⓘ</button> </h3>
|
| 28 |
+
Mass (g):
|
| 29 |
+
<input name="mass" id="mass" step="any" value="1.0" min="0.000001" type="number" required> <br>
|
| 30 |
+
Density (g/cm<sup>3</sup>):
|
| 31 |
+
<input name="density" id="density" step="any" value="1.0" min="0.01" type="number" required> <br>
|
| 32 |
+
Exposed surface area (cm<sup>2</sup>):
|
| 33 |
+
<input name="area" id="area" step="any" value="5.0" min="0.001" type="number" required><br>
|
| 34 |
+
|
| 35 |
+
<!-- Extraction conditions input section -->
|
| 36 |
+
|
| 37 |
+
<h3> Extraction conditions <button type="button" class="Info_btn" data-toggle="modal" data-target="#ExtractionModal">ⓘ</button> </h3>
|
| 38 |
+
|
| 39 |
+
Solvent volume (ml):
|
| 40 |
+
<input name="svol" id="svol" step="any" value="1.0" min="0.000001" type="number" required> <br>
|
| 41 |
+
Immersion time per iteration (h):
|
| 42 |
+
<input name="time" id="time" step="any" value="24.0" min="0.001" type="number" required> <br>
|
| 43 |
+
Number of iterations:
|
| 44 |
+
<input name="iterations" id="iterations" step="any" value="1" min="1" type="number" step="1" onchange="this.value = parseInt(this.value);" required> <br>
|
| 45 |
+
|
| 46 |
+
<!-- Material properties input section
|
| 47 |
+
<h3> Material properties <button type="button" class="Info_btn" data-toggle="modal" data-target="#MaterialModal">ⓘ</button> </h3>
|
| 48 |
+
Diffusion coefficient (D): <select name="DiffCoeff">
|
| 49 |
+
<option value="1e-7" selected>Fast (1e-7 cm2/s) </option>
|
| 50 |
+
<option value="1e-10">Medium (1e-10 cm2/s) </option>
|
| 51 |
+
<option value="1e-13">Slow (1e-13 cm2/s) </option>
|
| 52 |
+
</select> <br>
|
| 53 |
+
Partition coefficient (K): <select name="PartCoeff">
|
| 54 |
+
<option value="1e-3" selected>Low (1e-3) </option>
|
| 55 |
+
<option value="1">Medium (1) </option>
|
| 56 |
+
<option value="1e3">High (1e3) </option>
|
| 57 |
+
</select> <br> -->
|
| 58 |
+
|
| 59 |
+
<h3> Efficiency estimation </h3>
|
| 60 |
+
Click to calculate: <button type="submit">Submit</button>
|
| 61 |
</body>
|
| 62 |
</html>
|
efficiency_module/templates/efficiency_report.html
CHANGED
|
@@ -27,6 +27,11 @@
|
|
| 27 |
display: table;
|
| 28 |
clear: both;
|
| 29 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
</style>
|
| 31 |
|
| 32 |
</head>
|
|
@@ -36,7 +41,7 @@
|
|
| 36 |
<br clear="all" />
|
| 37 |
|
| 38 |
<header>
|
| 39 |
-
<h1 style="text-align:center"><font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculator (CHRIS) Report -
|
| 40 |
</header>
|
| 41 |
|
| 42 |
<body>
|
|
@@ -45,49 +50,94 @@
|
|
| 45 |
<script> document.write(new Date().toLocaleDateString()); </script>.
|
| 46 |
</p>
|
| 47 |
|
| 48 |
-
<h2>
|
| 49 |
-
|
| 50 |
-
<div class="container">
|
| 51 |
-
<div class="row">
|
| 52 |
-
<div class="column">
|
| 53 |
-
Input :: {{chemName}} <br> <br>
|
| 54 |
-
IUPAC Name :: {{iupac}} <br> <br>
|
| 55 |
-
CAS :: {{cas}} <br> <br>
|
| 56 |
-
Molecular weight (g/mol) :: {{'%0.4f'%MW|float}}
|
| 57 |
-
{% if ceramic %} :: ceramic detected, assume maximum Mw {% endif %}
|
| 58 |
-
<br> <br>
|
| 59 |
-
{% if show_properties %}
|
| 60 |
-
LogKow :: {{LogP}}{{LogP_origin}}<br> <br>
|
| 61 |
-
Density (g/cm<sup>3</sup>) :: {{rho}}{{rho_origin}}<br> <br>
|
| 62 |
-
Melting point (°C) :: {{mp}}{{mp_origin}}<br> <br>
|
| 63 |
-
{% endif %}
|
| 64 |
-
SMILES :: {{smiles}}
|
| 65 |
-
</div>
|
| 66 |
-
<div class="column">
|
| 67 |
-
<img src="{{molImage}}"/>
|
| 68 |
-
</div>
|
| 69 |
-
</div>
|
| 70 |
-
</div>
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
<h2> Exposure </h2>
|
| 74 |
|
| 75 |
<p>
|
| 76 |
-
<u>
|
| 77 |
<p>
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
<p>
|
| 80 |
This estimate was derived using solutions to the conservative plane sheet model for mass release, \( M \):
|
| 81 |
|
| 82 |
\[
|
| 83 |
-
|
| 84 |
-
\begin{array}{cr}
|
| 85 |
-
2 M_0 \sqrt{\tau/\pi} & \tau \leq 0.2 \\
|
| 86 |
-
M_0\left(1-8 \exp\left[-\tau \pi^2/4 \right]/\pi^2\right) & \tau > 0.2
|
| 87 |
-
\end{array} \right.
|
| 88 |
\]
|
| 89 |
|
| 90 |
-
where \( \tau= D t A^2 / V^2 \) and \( A \) and \( V \) are the surface area and volume of the polymer matrix, respectively, \( M_0 \) is total mass initially contained in the polymer, \( D \) is a conservative estimate of the diffusion coefficient of the leachable within the polymer matrix, and \( t \) is time. Based on the input provided, the calculation was based on the following values:
|
| 91 |
</p>
|
| 92 |
|
| 93 |
<p>
|
|
@@ -98,73 +148,6 @@ where \( \tau= D t A^2 / V^2 \) and \( A \) and \( V \) are the surface area and
|
|
| 98 |
\( t \) = {{time}} h <br>
|
| 99 |
</p>
|
| 100 |
|
| 101 |
-
<p>
|
| 102 |
-
In addition to the maximum daily (day 1) release rate, it can be helpful to examine the decay in release rate over time predicted by the model,
|
| 103 |
-
which is illustrated for the first 30 days of exposure in the plot below:
|
| 104 |
-
</p>
|
| 105 |
-
|
| 106 |
-
<img src="{{ image }}"/>
|
| 107 |
-
|
| 108 |
-
<h2> Assumptions </h2>
|
| 109 |
-
|
| 110 |
-
{% if assume[0] and assume[1] and assume[2] and assume[3] and assume[4] %}
|
| 111 |
-
|
| 112 |
-
<p>
|
| 113 |
-
<font color="green"> You have confirmed your system complies with the model assumptions and no further data are needed to support using the exposure estimation provided by CHRIS in a submission to CDRH. </font>
|
| 114 |
-
</p>
|
| 115 |
-
|
| 116 |
-
{% else %}
|
| 117 |
-
|
| 118 |
-
<p>
|
| 119 |
-
<font color="red"> You have not confirmed compliance with one or more of the underlying assumptions upon which the exposure calculation is based. Therefore, it may be necessary to provide a justification and supporting data for why the results obtained for a system that may not comply with unchecked assumptions below are still valid if the assessment is used to support a submission to CDRH: </font> <br>
|
| 120 |
-
</p>
|
| 121 |
-
|
| 122 |
-
{% if not assume[0] %}
|
| 123 |
-
<font color="red"> • The polymer matrix does not swell or degrade in the clinical use environment. <br> </font>
|
| 124 |
-
{% endif %}
|
| 125 |
-
|
| 126 |
-
{% if not assume[1] %}
|
| 127 |
-
<font color="red"> • Any particles/aggregates of the chemical are much smaller than the smallest component dimension (≤ 50x). <br> </font>
|
| 128 |
-
{% endif %}
|
| 129 |
-
|
| 130 |
-
{% if not assume[2] %}
|
| 131 |
-
<font color="red"> • The chemical is homogeneously distributed throughout the polymer. <br> </font>
|
| 132 |
-
{% endif %}
|
| 133 |
-
|
| 134 |
-
{% if not assume[3] %}
|
| 135 |
-
<font color="red"> • The total amount of the chemical is present in dilute concentrations (≤ 2 %). <br> </font>
|
| 136 |
-
{% endif %}
|
| 137 |
-
|
| 138 |
-
{% if not assume[4] %}
|
| 139 |
-
<font color="red"> • Manufacturing processes do not impact the integrity of the polymer. <br> </font>
|
| 140 |
-
{% endif %}
|
| 141 |
-
|
| 142 |
-
{% endif %}
|
| 143 |
-
|
| 144 |
-
<h2> Screening level toxicological risk assessment </h2>
|
| 145 |
-
|
| 146 |
-
<p>
|
| 147 |
-
The threshold for toxicological concern (TTC) for {{exposure}} contact is {{TTC}} mg. Based on the exposure estimation this results in a margin of safety (MOS) of {{MOS}}.
|
| 148 |
-
</p>
|
| 149 |
-
|
| 150 |
-
{% if MOS >= 1 %}
|
| 151 |
-
|
| 152 |
-
<p>
|
| 153 |
-
<font color="green"> The MOS based on the mutagenic TTC is greater than one; therefore, no further analysis is needed for systemic biocompatibility endpoints. </font>
|
| 154 |
-
</p>
|
| 155 |
-
|
| 156 |
-
<p>
|
| 157 |
-
<font color="red"> *Note*: This assessment assumes that the chemical is not in the cohort of concern. </font>
|
| 158 |
-
</p>
|
| 159 |
-
|
| 160 |
-
{% else %}
|
| 161 |
-
|
| 162 |
-
<p>
|
| 163 |
-
<font color="red"> The MOS based on the mutagenic TTC is less than one; therefore, further analysis is needed to address systemic biocompatibility endpoints. For example, a compound specific tolerable intake value could be independently derived and compared to the exposure estimate provided above. </font>
|
| 164 |
-
</p>
|
| 165 |
-
|
| 166 |
-
{% endif %}
|
| 167 |
-
|
| 168 |
<button type="button" onclick="javascript:history.back()">Back</button>
|
| 169 |
|
| 170 |
</body>
|
|
|
|
| 27 |
display: table;
|
| 28 |
clear: both;
|
| 29 |
}
|
| 30 |
+
|
| 31 |
+
table, th, td {
|
| 32 |
+
border:1px solid black;
|
| 33 |
+
text-align: center;
|
| 34 |
+
}
|
| 35 |
</style>
|
| 36 |
|
| 37 |
</head>
|
|
|
|
| 41 |
<br clear="all" />
|
| 42 |
|
| 43 |
<header>
|
| 44 |
+
<h1 style="text-align:center"><font color="#0070C0">CH</font>emical <font color="#0070C0">RIS</font>k calculator (CHRIS) Report - Extraction Efficiency </h1>
|
| 45 |
</header>
|
| 46 |
|
| 47 |
<body>
|
|
|
|
| 50 |
<script> document.write(new Date().toLocaleDateString()); </script>.
|
| 51 |
</p>
|
| 52 |
|
| 53 |
+
<h2> Extraction efficiency </h2>
|
| 54 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
<p>
|
| 57 |
+
<u> Model predicted extraction efficiency (mass extracted / total mass): </u>
|
| 58 |
<p>
|
| 59 |
|
| 60 |
+
<table style="width:50%">
|
| 61 |
+
<tr>
|
| 62 |
+
<td> </td>
|
| 63 |
+
<td> </td>
|
| 64 |
+
<td colspan="3"> D (cm<sup>2</sup>/s) </td>
|
| 65 |
+
</tr>
|
| 66 |
+
<tr>
|
| 67 |
+
<td> </td>
|
| 68 |
+
<td> </td>
|
| 69 |
+
<td> 1x10<sup>-7</sup> </td>
|
| 70 |
+
<td> 1x10<sup>-10</sup> </td>
|
| 71 |
+
<td> 1x10<sup>-13</sup> </td>
|
| 72 |
+
</tr>
|
| 73 |
+
<tr>
|
| 74 |
+
<td rowspan="3"> K </td>
|
| 75 |
+
<td> 1x10<sup>-3</sup> </td>
|
| 76 |
+
<td> {{'%0.4f'%ExtEff[0,0]|float}} </td>
|
| 77 |
+
<td> {{'%0.4f'%ExtEff[1,0]|float}} </td>
|
| 78 |
+
<td> {{'%0.4f'%ExtEff[2,0]|float}} </td>
|
| 79 |
+
</tr>
|
| 80 |
+
<tr>
|
| 81 |
+
<td> 1 </td>
|
| 82 |
+
<td> {{'%0.4f'%ExtEff[0,1]|float}} </td>
|
| 83 |
+
<td> {{'%0.4f'%ExtEff[1,1]|float}} </td>
|
| 84 |
+
<td> {{'%0.4f'%ExtEff[2,1]|float}} </td>
|
| 85 |
+
</tr>
|
| 86 |
+
<tr>
|
| 87 |
+
<td> 1x10<sup>3</sup> </td>
|
| 88 |
+
<td> {{'%0.4f'%ExtEff[0,2]|float}} </td>
|
| 89 |
+
<td> {{'%0.4f'%ExtEff[1,2]|float}} </td>
|
| 90 |
+
<td> {{'%0.4f'%ExtEff[2,2]|float}} </td>
|
| 91 |
+
</tr>
|
| 92 |
+
|
| 93 |
+
</table>
|
| 94 |
+
|
| 95 |
+
<h2> Normalized concentration (C/C0) </h2>
|
| 96 |
+
|
| 97 |
+
<table style="width:50%">
|
| 98 |
+
<tr>
|
| 99 |
+
<td> </td>
|
| 100 |
+
<td> </td>
|
| 101 |
+
<td colspan="3"> D (cm<sup>2</sup>/s) </td>
|
| 102 |
+
</tr>
|
| 103 |
+
<tr>
|
| 104 |
+
<td> </td>
|
| 105 |
+
<td> </td>
|
| 106 |
+
<td> 1x10<sup>-7</sup> </td>
|
| 107 |
+
<td> 1x10<sup>-10</sup> </td>
|
| 108 |
+
<td> 1x10<sup>-13</sup> </td>
|
| 109 |
+
</tr>
|
| 110 |
+
<tr>
|
| 111 |
+
<td rowspan="3"> K </td>
|
| 112 |
+
<td> 1x10<sup>-3</sup> </td>
|
| 113 |
+
<td> {{'%0.4f'%Conc[0,0]|float}} </td>
|
| 114 |
+
<td> {{'%0.4f'%Conc[1,0]|float}} </td>
|
| 115 |
+
<td> {{'%0.4f'%Conc[2,0]|float}} </td>
|
| 116 |
+
</tr>
|
| 117 |
+
<tr>
|
| 118 |
+
<td> 1 </td>
|
| 119 |
+
<td> {{'%0.4f'%Conc[0,1]|float}} </td>
|
| 120 |
+
<td> {{'%0.4f'%Conc[1,1]|float}} </td>
|
| 121 |
+
<td> {{'%0.4f'%Conc[2,1]|float}} </td>
|
| 122 |
+
</tr>
|
| 123 |
+
<tr>
|
| 124 |
+
<td> 1x10<sup>3</sup> </td>
|
| 125 |
+
<td> {{'%0.4f'%Conc[0,2]|float}} </td>
|
| 126 |
+
<td> {{'%0.4f'%Conc[1,2]|float}} </td>
|
| 127 |
+
<td> {{'%0.4f'%Conc[2,2]|float}} </td>
|
| 128 |
+
</tr>
|
| 129 |
+
</table>
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
<h2> The model </h2>
|
| 133 |
+
|
| 134 |
<p>
|
| 135 |
This estimate was derived using solutions to the conservative plane sheet model for mass release, \( M \):
|
| 136 |
|
| 137 |
\[
|
| 138 |
+
\frac{M}{M_0} =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
\]
|
| 140 |
|
|
|
|
| 141 |
</p>
|
| 142 |
|
| 143 |
<p>
|
|
|
|
| 148 |
\( t \) = {{time}} h <br>
|
| 149 |
</p>
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
<button type="button" onclick="javascript:history.back()">Back</button>
|
| 152 |
|
| 153 |
</body>
|
functions.py
CHANGED
|
@@ -6,6 +6,8 @@ matplotlib.use('Agg')
|
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
import io
|
| 8 |
import base64
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def SigFigs(number, n):
|
| 11 |
if number == 0: return number
|
|
@@ -21,7 +23,7 @@ def Piringer(Mw, Ap):
|
|
| 21 |
|
| 22 |
def WilkeChang(Mw):
|
| 23 |
# Semi-empirical model for D(Mw) assuming diffusion in water
|
| 24 |
-
Va = 4.
|
| 25 |
T = 310.
|
| 26 |
MwH2O = 18.
|
| 27 |
viscosity = 0.6913
|
|
@@ -79,3 +81,58 @@ def RatePlot(tarray, rates):
|
|
| 79 |
|
| 80 |
return pngImageB64String
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
import matplotlib.pyplot as plt
|
| 7 |
import io
|
| 8 |
import base64
|
| 9 |
+
from scipy import special
|
| 10 |
+
from scipy.optimize import bisect
|
| 11 |
|
| 12 |
def SigFigs(number, n):
|
| 13 |
if number == 0: return number
|
|
|
|
| 23 |
|
| 24 |
def WilkeChang(Mw):
|
| 25 |
# Semi-empirical model for D(Mw) assuming diffusion in water
|
| 26 |
+
Va = 4.21 + 1.58 * Mw # molecular volume as a function of Mw assuming linear alkanes as worst case
|
| 27 |
T = 310.
|
| 28 |
MwH2O = 18.
|
| 29 |
viscosity = 0.6913
|
|
|
|
| 81 |
|
| 82 |
return pngImageB64String
|
| 83 |
|
| 84 |
+
|
| 85 |
+
def PlaneSheetFiniteBathMass(M0, D, K, PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime, nterms):
|
| 86 |
+
L = PolymerVolume / SurfaceArea # effective length scale of the component
|
| 87 |
+
alpha = SolventVolume / PolymerVolume / K
|
| 88 |
+
|
| 89 |
+
Minfty = M0 / (1. + 1. / (alpha))
|
| 90 |
+
|
| 91 |
+
qn = np.zeros((nterms))
|
| 92 |
+
for j in range(nterms):
|
| 93 |
+
solved = False
|
| 94 |
+
eps = 1e-8
|
| 95 |
+
while not solved:
|
| 96 |
+
f = lambda x: np.tan(x) + alpha * x
|
| 97 |
+
rts = bisect(f, np.pi / 2. + j * np.pi + eps, np.pi * (1. + j) - eps, xtol=1e-6)
|
| 98 |
+
# print(rts)
|
| 99 |
+
solved = True
|
| 100 |
+
qn[j] = rts
|
| 101 |
+
|
| 102 |
+
result = 1.
|
| 103 |
+
for j in range(nterms):
|
| 104 |
+
result = result - (2. * alpha * (1. + alpha)) * np.exp(-D * qn[j] ** 2. * ExtractionTime / L ** 2.) / (
|
| 105 |
+
1. + alpha + alpha ** 2. * qn[j] ** 2.)
|
| 106 |
+
result = Minfty * result
|
| 107 |
+
|
| 108 |
+
return result
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
def PlaneSheetFiniteBathMassApprox(M0, D, K, PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime):
|
| 112 |
+
L = PolymerVolume / SurfaceArea # effective length scale of the component
|
| 113 |
+
alpha = SolventVolume / PolymerVolume / K
|
| 114 |
+
|
| 115 |
+
Minfty = M0 / (1. + 1. / (alpha))
|
| 116 |
+
|
| 117 |
+
T = D * ExtractionTime / L ** 2.
|
| 118 |
+
|
| 119 |
+
# if exp will blow up, use asymptotic expansion instead
|
| 120 |
+
if (T / alpha ** 2. < 100.):
|
| 121 |
+
result = Minfty * (1. + alpha) * (1. - np.exp(T / alpha ** 2.) * special.erfc(np.sqrt(T) / alpha))
|
| 122 |
+
else:
|
| 123 |
+
result = Minfty * (1. + alpha) * (1. - alpha / (np.sqrt(np.pi) * np.sqrt(T)) + alpha ** 3. / (
|
| 124 |
+
2. * np.sqrt(np.pi) * (T) ** 1.5) - 3. * alpha ** 5. / (4. * np.sqrt(np.pi) * (T) ** 2.5))
|
| 125 |
+
|
| 126 |
+
return result
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
def PlaneSheetAnalytical(M0, D, K, PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime, nterms):
|
| 130 |
+
L = PolymerVolume / SurfaceArea # effective length scale of the component
|
| 131 |
+
tau = D * ExtractionTime / L ** 2.
|
| 132 |
+
|
| 133 |
+
if tau > 0.05:
|
| 134 |
+
result = PlaneSheetFiniteBathMass(M0, D, K, PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime, nterms)
|
| 135 |
+
else:
|
| 136 |
+
result = PlaneSheetFiniteBathMassApprox(M0, D, K, PolymerVolume, SurfaceArea, SolventVolume, ExtractionTime)
|
| 137 |
+
|
| 138 |
+
return result
|