{
"cells": [
{
"cell_type": "markdown",
"id": "b32490e3-68ce-4204-95d1-e21083575a0d",
"metadata": {},
"source": [
"# Deep Water Liquid and Gas Properties"
]
},
{
"cell_type": "markdown",
"id": "15006122-c45e-47d2-82d7-ffb5f89d0490",
"metadata": {},
"source": [
"## 1. Introduction"
]
},
{
"cell_type": "markdown",
"id": "dc3e844a-5bd2-4c99-bf00-3461c563a6b1",
"metadata": {},
"source": [
"This Jupyter notebook performs the calculations of the liquid and gas properties at pressures and temperatures that vary from the water surface to the deep ocean (3500 m depth and 1.5 °C temperature) for use in modeling bubble oscillations and sound production by fish swim bladders for the paper Mark W. Sprague, Michael L. Fine, and Timothy M. Cameron (2022), \"An investigation of bubble resonance and its implications for sound production by deep-water fishes.\" Julia version 1.7.2 was used for the calculations. Symbolic calculations use the SymPy package (which calls the Python SymPy package). Symbolic expressions are converted to Julia functions to calculate numerical values. For each parameter we calculate values for the warm surface (temperature 20 °C, salinity 35 g/kg), cold surface (temperature 1.5 °C, salinity 35 g/kg), and 3500 m deep (temperature 1.5 °C, salinity 35 g/kg) environments. We also calculate values a 1 m depth intervals for an ocean with constant temperature 1.5 °C and salinity 35 g/kg. The depth profile values required for our acoustic calculations are stored in dataframes in tabular form exported to CSV files. See the main paper for all references cited here.\n",
"\n",
"This notebook uses the following Julia packages.\n",
"\n",
"* SymPy - symbolic calculations.\n",
"* Roots - numerical root finding.\n",
"* DataFrames - store tabulated values in a dataframe for export.\n",
"* CSV - export dataframes with tabulated values into a CSV file.\n",
"\n",
"Many of the symbolic calculations in this notebook produce long symbolic expressions as output. These expressions are many lines long (sometimes over a page long) and often do not fit within the page margins or screen size. Output from these expressions has been suppressed using a trailing semicolon (`;`). To view the output, delete the trailing semicolon before entering the input cell."
]
},
{
"cell_type": "markdown",
"id": "a6f939ce-abf3-4439-ade9-e9990dba35c2",
"metadata": {},
"source": [
"## 2. Initializations"
]
},
{
"cell_type": "markdown",
"id": "534698a5-93ed-41c2-a82e-dc18a4a5993d",
"metadata": {},
"source": [
"Load the necessary packages and import the symbols defined by `SymPy`."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "a7fac6cb-9cc3-4d2f-84d7-86de8ed21375",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"using SymPy, Roots, CSV, DataFrames\n",
"import_from(sympy)"
]
},
{
"cell_type": "markdown",
"id": "a72c2a46-b73b-445a-a8a0-4c34f997c3b5",
"metadata": {},
"source": [
"## 3. Parameters"
]
},
{
"cell_type": "markdown",
"id": "2d52997b-31be-4676-a32d-f76dafe38c8c",
"metadata": {},
"source": [
"Define some parameters."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "7a8ba560-10c8-47d0-81c1-a01db4020dbb",
"metadata": {},
"outputs": [],
"source": [
"tcold = 1.5; # °C, cold water temperature"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "2e268809-4fcb-4519-892d-aafcf93e570c",
"metadata": {},
"outputs": [],
"source": [
"Tcold = tcold + 273.15; # K, cold water absolute temperature"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "9a7b2bd6-1467-4f8f-b494-97708b06569a",
"metadata": {},
"outputs": [],
"source": [
"sal = 35.0; # g/kg, salinity"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "34995939-8eff-40a3-bb36-bc7a0f36d5e9",
"metadata": {},
"outputs": [],
"source": [
"ts = 20.0; # °C, warm surface temperature"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7ff556fc-afe2-426c-b902-f9f6af671fba",
"metadata": {},
"outputs": [],
"source": [
"Ts = 293.15; # K, warm surface absolute temperature"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "49d739de-997d-47a9-95aa-2266b7eb15cf",
"metadata": {},
"outputs": [],
"source": [
"ps = 1.01325e5; # Pa, surface pressure"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "0bdc8dad-3a89-4943-bdfa-803a76851c58",
"metadata": {},
"outputs": [],
"source": [
"ϕ0 = 30.0 * pi/180; # degrees, lattitude for gravitational acceleration \n",
" # term in pressure-depth calculations"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "7b094fa1-d99c-46ed-b17a-903931853c55",
"metadata": {},
"outputs": [],
"source": [
"dvals = 0:3500; # m, range of depth values for calculation"
]
},
{
"cell_type": "markdown",
"id": "4d174894-c163-442f-bd5f-dbc75deb116a",
"metadata": {},
"source": [
"Note that the array `dvals` contains depths at 1 m intervals from 0 m to 3500 m. A depth `d` that is a whole number value in meters is at index `d + 1` in `dvals`. This is useful because we do not have to repeat indexed calculations based on `dvals` when we need values at specific depths."
]
},
{
"cell_type": "markdown",
"id": "f2250ff0-f362-4376-a86e-ad2e994f5790",
"metadata": {},
"source": [
"For calculations a depths 1000 m and 2000 m, locate the `dvals` elements that represent these depths."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "d4fd0497-e73b-463f-9b80-c7aee94f2285",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1000"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dvals[1001]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "0bb305f7-6bb8-46f2-92a4-bc8e1388def3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2000"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dvals[2001]"
]
},
{
"cell_type": "markdown",
"id": "fc63405d-9105-4969-8112-8b58b603937a",
"metadata": {},
"source": [
"Initialize dataframes for storing tabulated parameter values. The dataframe `valso2` will hold the water and oxygen gas properties required for the acoustic calculations, and the dataframe `valsn2` will hold the water and nitrogen gas properties required for the acoustic calculations."
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "b76b3c51-18f7-4db8-86f5-3d0390f3b876",
"metadata": {},
"outputs": [],
"source": [
"valso2 = DataFrame(depth=dvals);\n",
"valsn2 = DataFrame(depth=dvals);"
]
},
{
"cell_type": "markdown",
"id": "c885e6ce-4066-401c-a04c-1f8ad02f28f1",
"metadata": {
"tags": []
},
"source": [
"## 4. Liquid Properties"
]
},
{
"cell_type": "markdown",
"id": "f6e7ef7e-b6ea-4481-8b04-214c28a40c7d",
"metadata": {},
"source": [
"These are the relations for the properties of the liquid (seawater)."
]
},
{
"cell_type": "markdown",
"id": "23f9ad77-beed-4eeb-8d84-8c64fbaef130",
"metadata": {},
"source": [
"Define some symbols."
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "ad587c6b-7983-423f-a72b-bec3d36ecacb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(ϕ, p, P, z, S, Sfrac, t, pPa)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@vars ϕ p P z S Sfrac t pPa"
]
},
{
"cell_type": "markdown",
"id": "46769b27-be44-450f-8ea3-bac65038acd8",
"metadata": {
"tags": []
},
"source": [
"### 4.1. Pressure vs. Depth"
]
},
{
"cell_type": "markdown",
"id": "012f0f9d-5a50-433e-b4c0-c16ec128ef7f",
"metadata": {},
"source": [
"Pressure vs. depth relationship from Saunders and Fofonoff [52]."
]
},
{
"cell_type": "markdown",
"id": "4c11cbdd-9b9d-46ae-87d1-977f4f1ae6c9",
"metadata": {},
"source": [
"Define parameters used in calculation. "
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "cbf789f0-1f8f-4048-8ede-35c5a3e21f3b",
"metadata": {},
"outputs": [],
"source": [
"cd = [0.712953, 1.113e-7, -3.434e-12, 14190.7];"
]
},
{
"cell_type": "markdown",
"id": "e683bbdb-95db-4b0b-93d6-0539b381f428",
"metadata": {},
"source": [
"The expression below is for the effective gravitational acceleration in terms of the latitude angle `ϕ`."
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "5a6394dd-22e8-4570-a614-1068f0103248",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$0.0518591581632 \\sin^{2}{\\left(ϕ \\right)} - 5.77038762 \\cdot 10^{-5} \\sin^{2}{\\left(2 ϕ \\right)} + 9.780318$"
],
"text/plain": [
" 2 2 \n",
"0.0518591581632⋅sin (ϕ) - 5.77038762e-5⋅sin (2⋅ϕ) + 9.780318"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g0 = 9.780318 * (1 + 5.3024e-3 * sin(ϕ)^2 - 5.9e-6 * sin(2 * ϕ)^2) # m/s^2, gravitational acceleration"
]
},
{
"cell_type": "markdown",
"id": "6ccc6895-725f-41e2-ba8a-98b846eec512",
"metadata": {},
"source": [
"This is the gravitational acceleration at latitude $\\phi_0 = 30^\\circ$ N."
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "0196e5c3-6599-41bd-8f38-8a56f64fbec0",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$9.79323951163365$"
],
"text/plain": [
"9.79323951163365"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"g0(ϕ=>ϕ0)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "617d5014-0652-483e-8963-0788e14d548e",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$p - 101325.0$"
],
"text/plain": [
"p - 101325.0"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pg = p - ps # Pa, pressure gradient with surface"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "ba7c3814-f652-430a-af69-c77a4449aa5d",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\frac{p}{10000} - 10.1325$"
],
"text/plain": [
" p \n",
"───── - 10.1325\n",
"10000 "
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pdb = pg/10^4 # dbar, pressure in decibars; used to compare values in the reference"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "ecfe63b8-dc3b-4046-923a-9ce106101a3c",
"metadata": {},
"outputs": [],
"source": [
"γprime = 2.226e-6; # m s^-2 dbar^-1"
]
},
{
"cell_type": "markdown",
"id": "0e93e4a9-91d7-48c3-92ca-149cd322db38",
"metadata": {},
"source": [
"We ignore the $\\Delta D$ term Eq. (4) in Saunders and Fofonoff [52] to use a standard ocean."
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "def8dae9-e86a-4a85-979f-a2b58cd83642",
"metadata": {},
"outputs": [],
"source": [
"ΔD = 0; # Ignore this term."
]
},
{
"cell_type": "markdown",
"id": "1106bad2-1468-4201-b09e-2df53ff02d23",
"metadata": {},
"source": [
"This is Eq. (4) in Saunders and Fofonoff [52] with the pressure `p` in Pa."
]
},
{
"cell_type": "markdown",
"id": "15344f8f-8978-4e92-b122-cd2f183b2352",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "fcb022dc-f310-421a-8f32-5f631f216442",
"metadata": {},
"outputs": [],
"source": [
"zpeq = Eq(z, simplify(sum(((cd .* (pdb, pdb^2, pdb^3, log(1 + 1.83e-5 * pdb))) ./\n",
" ((100 * g0 + 1/2 * γprime * pdb) * 10^-3) .+ ΔD /\n",
" 0.98))));"
]
},
{
"cell_type": "markdown",
"id": "314ee193-38ed-41e8-8804-d70b9ccaeea3",
"metadata": {},
"source": [
"Calculate depth for various pressure gradients to compare with the value in Table 1 in Saunders and Fofonoff [52]."
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "53dfac54-eac6-4c7e-afa8-0266066d054e",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$z = 496.013686442597$"
],
"text/plain": [
"z = 496.013686442597"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zpeq(ϕ => ϕ0, p => 1.01325e5 + 500e4)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "330e6c8c-9719-490b-a7c0-b2c5c4ffbfbb",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$z = 990.88969207793$"
],
"text/plain": [
"z = 990.88969207793"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zpeq(ϕ => ϕ0, p => 1.01325e5 + 1000e4)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "07425c77-579e-4bcc-beca-11e456637228",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$z = 2959.38223978458$"
],
"text/plain": [
"z = 2959.38223978458"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zpeq(ϕ => ϕ0, p => 1.01325e5 + 3000e4)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "87a8cf28-8a97-4ba6-b03f-8ea89eaeb8b9",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$z = 3937.26224667999$"
],
"text/plain": [
"z = 3937.26224667999"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zpeq(ϕ => ϕ0, p => 1.01325e5 + 4000e4)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "1ea64d1a-2f34-4b34-be4a-518cfc0e4bac",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.045032427473836185"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(3937.26224667999 - 3935.49)/3935.49 * 100"
]
},
{
"cell_type": "markdown",
"id": "d05bbf4f-40c5-495a-8e6c-2d05646b1b8a",
"metadata": {},
"source": [
"These values are consistent with the table to better than 0.05%, which is OK for our calculations.\n",
"\n",
"Now create a Julia function we can solve numerically."
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "25476871-3e95-4e61-b4e5-a0ffbb3abf41",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"zpjl = lambdify(lhs(zpeq) - rhs(zpeq),(ϕ, z, p))"
]
},
{
"cell_type": "markdown",
"id": "6680b649-1650-44a9-8dea-6df7ab85a612",
"metadata": {},
"source": [
"The function `psub` gives the pressure at a given depth."
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "d3d22997-c65f-401e-9bbe-5047f980ebb8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"psub (generic function with 2 methods)"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psub(ϕ, z, p0=100.e5) = find_zero(p1 -> zpjl(ϕ, z, p1), p0)"
]
},
{
"cell_type": "markdown",
"id": "6f527bd4-f243-4598-86ad-6bde026bb318",
"metadata": {},
"source": [
"Create a Julia function that converts the calculated pressure to dbar so we can compare calculations to Table 1 in Saunders and Fofonoff [52]."
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "53760c74-c071-48a9-bd6c-7967a3e56dd6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pdbjl = lambdify(pdb, (p,))"
]
},
{
"cell_type": "markdown",
"id": "fa5126b3-6bc5-43d7-9e3c-e2043e2c0926",
"metadata": {},
"source": [
"Now test this for some values in Table 1 in in Saunders and Fofonoff [52]."
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "2c15c09e-e293-4987-82c7-3e1108acb9b5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"499.97609563134597"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pdbjl(psub(ϕ0, 495.99))"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "cd1b1af7-14a6-4bfd-9f06-ccf8d002734e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"999.8789310233103"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pdbjl(psub(ϕ0, 990.77))"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "5837ac10-ee4e-4d11-bed8-b79e4c3c99f3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2998.9772647391114"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pdbjl(psub(30*pi/180, 2958.38))"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "94cd9019-a666-4fec-b4fd-032d2765123a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3998.183851177998"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pdbjl(psub(30*pi/180, 3935.49))"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "564a71ec-f221-474a-8dc7-ba0ab22dcefb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.04540372055005264"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(4000 - pdbjl(psub(30*pi/180, 3935.49))) / 4000 * 100"
]
},
{
"cell_type": "markdown",
"id": "9751fb12-8292-43ad-99b7-304d79d59067",
"metadata": {},
"source": [
"These values are also consistent with those in Table 1 in Saunders and Fofonoff [52] to better than 0.05%."
]
},
{
"cell_type": "markdown",
"id": "aca217cf-eebb-48f5-a9a2-e8305cac73c9",
"metadata": {},
"source": [
"Create a table of pressures at the depths in `dvals`."
]
},
{
"cell_type": "markdown",
"id": "b9f2e2cf-598d-43d3-aa71-6e55e684e5ad",
"metadata": {},
"source": [
"Warm surface pressure."
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "ae52fc81-6201-4239-9a41-2b11fda2a282",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"101325.0"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psub(ϕ0, 0)"
]
},
{
"cell_type": "markdown",
"id": "be7e06b2-6ad5-419f-8eee-7c9c862a62e7",
"metadata": {},
"source": [
"Cold surface pressure."
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "71618c4b-45a6-4e7d-8ca6-cb69cb75ede9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"101325.0"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psub(ϕ0, 0)"
]
},
{
"cell_type": "markdown",
"id": "9af75e96-1d69-4573-89f2-d296bd1db4d1",
"metadata": {},
"source": [
"Pressure at depth 1000 m."
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "3bd9832c-3566-49e6-941b-ac020dd28d93",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0193478046816997e7"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psub(ϕ0, 1000)"
]
},
{
"cell_type": "markdown",
"id": "c64a8395-82ba-4985-95e1-fd11fa198702",
"metadata": {},
"source": [
"Pressure at depth 2000 m."
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "38bea19b-59f3-4bda-a958-d0d9e9c0e52d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.0331946613939572e7"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psub(ϕ0, 2000)"
]
},
{
"cell_type": "markdown",
"id": "39e53398-0161-43f5-bde2-5cf703fd0098",
"metadata": {},
"source": [
"Deep water pressure."
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "3e908a27-6e97-4cad-ab55-fe3bb3459d50",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.562456759610306e7"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"psub(ϕ0, 3500)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "3fd5cd2b-d526-4eb0-a348-ad0748a0298d",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"ptab = map(d1 -> psub(30*pi/180, d1), dvals);"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "fcaa623a-247d-4b05-a78a-a61df9895487",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(101325.0, 3.562456759610306e7)"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ptab[1], ptab[end]"
]
},
{
"cell_type": "markdown",
"id": "f0cb32b9-2925-4138-8473-e4aa5829f5fd",
"metadata": {},
"source": [
"Store these pressures in the two dataframes."
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "69961e67-8977-4b56-8a30-b77c396b181c",
"metadata": {},
"outputs": [],
"source": [
"valso2.pressure = ptab;\n",
"valsn2.pressure = ptab;"
]
},
{
"cell_type": "markdown",
"id": "51f8fbdf-a306-4aff-a919-0689274fe12e",
"metadata": {},
"source": [
"### 4.2. Density"
]
},
{
"cell_type": "markdown",
"id": "d7cb574a-6742-4ba0-befa-8001ac4d22db",
"metadata": {},
"source": [
"We calculate seawater density using Eqs. (7) from Sharqaway *et al.* [53]."
]
},
{
"cell_type": "markdown",
"id": "0d327ee3-4900-46a1-b9e2-bd60d03b184f",
"metadata": {},
"source": [
"Define the parameters in the equation."
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "750d9204-d2ce-4427-bbd5-2c01aa4111e7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(999.2, 0.09539, -2.581e-5, 3.131e-5, -6.174e-8, 0.4337, 2.549e-5, -2.899e-7, 9.578e-10, 0.001763, -0.0001231, 1.366e-6, 4.045e-9, -1.467e-5, 8.839e-7, -1.102e-9, 4.247e-11, -3.959e-14)"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arho = (9.992e2, 9.539e-2, -2.581e-5, 3.131e-5, -6.174e-8, \n",
" 4.337e-1, 2.549e-5, -2.899e-7, 9.578e-10, 1.763e-3, -1.231e-4,\n",
" 1.366e-6, 4.045e-9, -1.467e-5, 8.839e-7, -1.102e-9, \n",
" 4.247e-11, -3.959e-14)"
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "9efa18ec-0903-440d-8a58-2c28765eefa2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-0.7999, 0.002409, -2.581e-5, 6.856e-8, 0.0006298, -9.363e-7)"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"brho = (-7.999e-1, 2.409e-3, -2.581e-5, 6.856e-8, \n",
" 6.298e-4, -9.363e-7)"
]
},
{
"cell_type": "markdown",
"id": "cffe26d2-b1eb-4ee0-898c-b6948f20054f",
"metadata": {},
"source": [
"This is Eq. (7) from Sharqaway *et al.* [53]. Note that the pressure `p` is in MPa, and the temperature `t` is in °C. Note that the stated accuracy of this equation is ±2.5%."
]
},
{
"cell_type": "markdown",
"id": "6eeb40ea-2fd2-4c0d-907b-60783ebe061e",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "e00f030d-cb0e-4708-a215-da273c13fd85",
"metadata": {},
"outputs": [],
"source": [
"ρsw = simplify(sum(arho .* (1, t, t^2, t^3, t^4, p, p*t^2, p*t^3,\n",
" p*t^4, p^2, p^2*t, p^2*t^2, p^2*t^3, p^3, p^3*t, p^3*t^2,\n",
" p^3*t^3, p^3*t^4)) - sum(brho .* (S, S*t, S*t^2, S*t^3, S*p,\n",
" S*p^2)));"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "fbdfed6a-1791-4d00-a702-ca844c851bc2",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$1000.77202240146$"
],
"text/plain": [
"1000.77202240146"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρsw(t=>15, p=>1.01325e5/1e6, S=>0)"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "1de05cb6-9134-4734-a7b2-28871d882a8c",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$1028.03294469513$"
],
"text/plain": [
"1028.03294469513"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρsw(t=>20, p=>1.01325e5/1e6, S=>35)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"id": "a7140c8b-ef24-4dfe-9354-a5bf3184e970",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$1043.32748758591$"
],
"text/plain": [
"1043.32748758591"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρsw(t=>tcold, p=>ptab[end]/1e6, S=>sal)"
]
},
{
"cell_type": "markdown",
"id": "74dfde5a-8c07-4891-97d9-b4a22e4c794e",
"metadata": {},
"source": [
"These values are reasonable given the accuracy of the equation."
]
},
{
"cell_type": "markdown",
"id": "ac88380f-cb20-430c-a6a2-0f77823ae76e",
"metadata": {},
"source": [
"Create a Julia function to calculate seawater density."
]
},
{
"cell_type": "code",
"execution_count": 49,
"id": "bce81ae3-8832-49de-9ac9-b201d0205050",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswjl = lambdify(ρsw(p=>pPa/1e6), (t, pPa, S))"
]
},
{
"cell_type": "markdown",
"id": "ff0bdb90-7964-402e-8607-65b9126cc902",
"metadata": {},
"source": [
"Warm surface density."
]
},
{
"cell_type": "code",
"execution_count": 50,
"id": "0fe62bb8-44c1-4600-a91a-91bee33d681c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1028.032944695128"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswjl(ts, ptab[1], sal)"
]
},
{
"cell_type": "markdown",
"id": "ea7e3499-d867-4c3f-8bd6-2a4eaab597e8",
"metadata": {},
"source": [
"Cold surface density."
]
},
{
"cell_type": "code",
"execution_count": 51,
"id": "5ea0d681-56f8-4860-a985-9e0ffc1ffcfb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1027.2569176419536"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswjl(tcold, ptab[1], sal)"
]
},
{
"cell_type": "markdown",
"id": "d412b3aa-89f6-48c8-9694-b7ba1c163a0a",
"metadata": {},
"source": [
"Density at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 52,
"id": "c11d0e3a-7876-442d-909a-cd5ab160aedc",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"1031.5655667337887"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswjl(tcold, ptab[1001], sal)"
]
},
{
"cell_type": "markdown",
"id": "ff7f2e5e-8503-46c4-ac2a-85605a6f687b",
"metadata": {},
"source": [
"Density at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"id": "885e9077-01f5-4e45-88ef-7cebd28ee0ec",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"1036.1412358223129"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswjl(tcold, ptab[2001], sal)"
]
},
{
"cell_type": "markdown",
"id": "d1a3ca90-a603-4e78-b067-97e5beccdd1d",
"metadata": {},
"source": [
"Deep water density"
]
},
{
"cell_type": "code",
"execution_count": 54,
"id": "a68851de-06a9-4562-9a37-36fd858b99b2",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"1043.3274875859083"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswjl(tcold, ptab[end], sal)"
]
},
{
"cell_type": "markdown",
"id": "7f789fe2-af2e-4d1e-b613-e57f7b6efe90",
"metadata": {},
"source": [
"Tabulate density values for the depths in `dvals`."
]
},
{
"cell_type": "code",
"execution_count": 55,
"id": "b4d0ea15-026f-46e6-a10f-f8a313a42b7f",
"metadata": {},
"outputs": [],
"source": [
"ρswtab = map(p1 -> ρswjl(tcold, p1, sal), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 56,
"id": "d1ce92c3-2e50-4c31-9a6d-e43442afc049",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1027.2569176419536, 1043.3274875859083)"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρswtab[1], ρswtab[end]"
]
},
{
"cell_type": "markdown",
"id": "402c29bc-7a50-43b1-9d15-eef591807526",
"metadata": {},
"source": [
"Add these values to the two dataframes."
]
},
{
"cell_type": "code",
"execution_count": 57,
"id": "4abb0e0b-3272-4f8c-988a-617b24a2a02b",
"metadata": {},
"outputs": [],
"source": [
"valso2.water_density = ρswtab\n",
"valsn2.water_density = ρswtab;"
]
},
{
"cell_type": "markdown",
"id": "45963f8a-5b15-44b5-be46-e997395efefa",
"metadata": {},
"source": [
"### 4.3. Dynamic Viscosity"
]
},
{
"cell_type": "markdown",
"id": "c1ad0fbe-fb41-4b77-baf6-a26729d40bf6",
"metadata": {},
"source": [
"We calculate the dynamic viscosity of seawater using Eqs. (22) and (23) from Sharqaway *et al.* [53]."
]
},
{
"cell_type": "markdown",
"id": "7d4db7c8-a7cd-4ac8-a6a1-2cdab69e01d9",
"metadata": {},
"source": [
"This is Eq. (23)."
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "1b451f46-a73c-45b6-9170-09c4c7085b9e",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$4.2844 \\cdot 10^{-5} + \\frac{1}{663.182137693 \\left(0.0153862723677935 t + 1\\right)^{2} - 91.296}$"
],
"text/plain": [
" 1 \n",
"4.2844e-5 + ──────────────────────────────────────────────────\n",
" 2 \n",
" 663.182137693⋅(0.0153862723677935⋅t + 1) - 91.296"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μw = 4.2844e-5 + (0.157*(t + 64.993)^2 - 91.296)^-1"
]
},
{
"cell_type": "code",
"execution_count": 59,
"id": "fc43b487-4838-4969-9e12-cfcffaa8e9cc",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$- 9.52 \\cdot 10^{-5} t^{2} + 0.01998 t + 1.541$"
],
"text/plain": [
" 2 \n",
"- 9.52e-5⋅t + 0.01998⋅t + 1.541"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Amu = 1.541 + 1.998e-2*t - 9.52e-5*t^2"
]
},
{
"cell_type": "code",
"execution_count": 60,
"id": "20a78ac5-8df7-4ae6-b782-fe3acf9a7fa6",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$0.0004724 t^{2} - 0.07561 t + 7.974$"
],
"text/plain": [
" 2 \n",
"0.0004724⋅t - 0.07561⋅t + 7.974"
]
},
"execution_count": 60,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Bmu = 7.974 - 7.561e-2*t + 4.724e-4*t^2"
]
},
{
"cell_type": "markdown",
"id": "8c03baa6-d43e-4ad5-bf37-37ec4de2c63c",
"metadata": {},
"source": [
"This is Eq. (22). The salinity value `Sfrac` in the following equation is in kg/kg. We need to divide the traditional salinity in g/kg by 1000 to convert it."
]
},
{
"cell_type": "markdown",
"id": "db4452be-64c7-4e31-8c67-5fe2efb101e4",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 61,
"id": "f34ba3ed-8c91-44ed-89cf-82390732e590",
"metadata": {},
"outputs": [],
"source": [
"μsw = μw*(1 + Amu*Sfrac + Bmu*Sfrac^2);"
]
},
{
"cell_type": "markdown",
"id": "1a2e255e-dad2-41e7-a4d2-b52d8789f4f6",
"metadata": {},
"source": [
"Create a Julia function for dynamic viscosity."
]
},
{
"cell_type": "code",
"execution_count": 62,
"id": "2ffed514-a1c5-4313-9c49-243e462b3996",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μswjl = lambdify(μsw(Sfrac=>S/1000), (t, S))"
]
},
{
"cell_type": "markdown",
"id": "767003c8-b17b-4c99-988b-d60f7552d4cd",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 63,
"id": "49aedc50-0833-4f46-9119-bbf79d572398",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0010766289252529318"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μswjl(ts, sal)"
]
},
{
"cell_type": "markdown",
"id": "92af3d16-3ea0-44cf-b0b6-c0b76d4e0a2e",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 64,
"id": "f74da201-f8e7-4686-a095-505f856ecd08",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0018115654847495556"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "80d30ca4-f52d-4b34-9ad1-064b950257f0",
"metadata": {},
"source": [
"Value at depth 1000 m"
]
},
{
"cell_type": "code",
"execution_count": 65,
"id": "8ac5c1fc-1deb-4685-85e9-07e83ba5e9dc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0018115654847495556"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "82d696c6-d377-40fc-b5a3-886e255fb9ab",
"metadata": {},
"source": [
"Value at depth 2000 m"
]
},
{
"cell_type": "code",
"execution_count": 66,
"id": "ce48f212-eee4-41d5-a5d9-f423ff81224c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0018115654847495556"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "addb398a-f741-4367-8aa5-f5bf09f30c16",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 67,
"id": "7cc79635-e138-4669-a82a-f2392a34a1e8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0018115654847495556"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"μswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "7ca70756-f977-4f9a-b533-16bc92029c78",
"metadata": {},
"source": [
"This parameter only depends on temperature and salinity, which we are holding constant for this depth profile. Calculate the constant value and multiply it by the `ones` vector."
]
},
{
"cell_type": "code",
"execution_count": 68,
"id": "8d70de3b-5317-4285-8c33-16e3185d79a3",
"metadata": {},
"outputs": [],
"source": [
"μswtab = μswjl(tcold, sal) .* ones(length(dvals));"
]
},
{
"cell_type": "markdown",
"id": "ca53f622-6553-45d1-acc8-34688a4a0ea1",
"metadata": {},
"source": [
"Store these values in the dataframes."
]
},
{
"cell_type": "code",
"execution_count": 69,
"id": "509b17fb-54e2-41ae-a81d-155e48cda2e7",
"metadata": {},
"outputs": [],
"source": [
"valso2.water_dyn_viscosity = μswtab\n",
"valsn2.water_dyn_viscosity = μswtab;"
]
},
{
"cell_type": "markdown",
"id": "e3c40654-a173-4fcc-99c9-14ac09190e30",
"metadata": {},
"source": [
"### 4.4. Surface Tension"
]
},
{
"cell_type": "markdown",
"id": "3f19dde2-526f-44f6-8c45-98121940227c",
"metadata": {},
"source": [
"We use Eqs. (27) and (28) from Sharqaway *et al.* [53] for the water surface tension."
]
},
{
"cell_type": "markdown",
"id": "3aafe74a-e6ea-40f6-be3a-f774a8688297",
"metadata": {},
"source": [
"This is Eq. (27)."
]
},
{
"cell_type": "markdown",
"id": "516b254e-abb6-4e13-b68b-62657407192b",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 70,
"id": "cb7b9ea8-2aa9-4542-b5ef-70da1d58abba",
"metadata": {},
"outputs": [],
"source": [
"σw = 0.2358 * (1 - (t + 273.15)/647.096)^1.256 * (1 - 0.625*(1 - (t\n",
" + 273.15)/647.096));"
]
},
{
"cell_type": "markdown",
"id": "3ccbdf86-2045-4ab1-9031-caf6c2e670af",
"metadata": {},
"source": [
"This is Eq. (38) solved for the seawater surface tension."
]
},
{
"cell_type": "markdown",
"id": "ba045d31-cced-4496-a1fc-0110d34cba4c",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 71,
"id": "42221b92-a302-433f-8147-8795b532694b",
"metadata": {},
"outputs": [],
"source": [
"σsw = (1 + (0.000226*t + 0.00946) * log(1 + 0.0331 * S)) * σw;"
]
},
{
"cell_type": "markdown",
"id": "b409018f-88d0-47a7-89cd-819b2fe1422a",
"metadata": {},
"source": [
"Create a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 72,
"id": "767bdbdd-cb0e-4b84-9f40-63a49444b8d0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σswjl = lambdify(σsw, (t, S))"
]
},
{
"cell_type": "markdown",
"id": "ec570ee4-86a0-46fa-aad0-6404927bb821",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 73,
"id": "efcefa81-ebb4-4bc7-8867-b68ee3b6e526",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0735185195321562"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σswjl(ts, sal)"
]
},
{
"cell_type": "markdown",
"id": "ae7cdf71-83b0-489e-9f4d-7f0c746b10bb",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 74,
"id": "ad89bddc-fbdf-417a-b980-f20e9ac3fde1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.07600619501340314"
]
},
"execution_count": 74,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "3f100328-d057-4a3e-8b04-3eef0e66f8f2",
"metadata": {},
"source": [
"Value at depth 1000 m"
]
},
{
"cell_type": "code",
"execution_count": 75,
"id": "4727b229-65a5-442e-bb0c-2e0cb5e76315",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.07600619501340314"
]
},
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "b4d6ed08-8734-4c84-a0a3-e3fd7790e298",
"metadata": {},
"source": [
"Value at depth 2000 m"
]
},
{
"cell_type": "code",
"execution_count": 76,
"id": "f07f18fe-ed13-4472-a1a9-d68358e51639",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.07600619501340314"
]
},
"execution_count": 76,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "e298262e-f388-44ff-a93c-fe3786858ac3",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 77,
"id": "365ea894-be82-473b-805f-7b3bb77cccde",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.07600619501340314"
]
},
"execution_count": 77,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σswjl(tcold, sal)"
]
},
{
"cell_type": "markdown",
"id": "978710eb-07e6-4cbb-a41e-543c86c02972",
"metadata": {},
"source": [
"This parameter only depends on temperature and salinity, which we are holding constant for this depth profile. Calculate the constant value and multiply it by the `ones` vector."
]
},
{
"cell_type": "code",
"execution_count": 78,
"id": "49e8a47d-e7c0-4865-a887-ab6e7093da80",
"metadata": {},
"outputs": [],
"source": [
"σswtab = σswjl(tcold, sal) .* ones(length(dvals));"
]
},
{
"cell_type": "markdown",
"id": "ff8fb6d7-04c2-42a8-bc31-da3c77582dba",
"metadata": {},
"source": [
"Add these values to the dataframes."
]
},
{
"cell_type": "code",
"execution_count": 79,
"id": "da0c8224-f87e-44ce-98ee-7ef27e855bbc",
"metadata": {},
"outputs": [],
"source": [
"valso2.water_surface_tension = σswtab\n",
"valsn2.water_surface_tension = σswtab;"
]
},
{
"cell_type": "markdown",
"id": "afbe3c71-e329-4fb4-89a5-aea336e6d7d3",
"metadata": {},
"source": [
"### 4.5. Sound Speed"
]
},
{
"cell_type": "markdown",
"id": "9699ed7c-993f-42a5-b8cc-1c23f74fdd68",
"metadata": {},
"source": [
"We calculate sound speed from the UN equation in Wong and Zhu [54]."
]
},
{
"cell_type": "markdown",
"id": "5b99d3c8-e8bd-45b7-8410-9d835497904d",
"metadata": {},
"source": [
"The parameter `P` is the pressure in bar. (1 bar = 105 Pa.)\n",
"\n",
"Define the other parameters in the equation."
]
},
{
"cell_type": "code",
"execution_count": 80,
"id": "7d58f3ff-7eeb-4508-9ee8-8f766596af11",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((1.389, -0.01262, 7.166e-5, 2.008e-6, -3.21e-8), (9.4742e-5, -1.2583e-5, -6.4928e-8, 1.0515e-8, -2.0142e-10), (-3.9064e-7, 9.1061e-9, -1.6009e-10, 7.994e-12), (1.1e-10, 6.651e-12, -3.391e-13))"
]
},
"execution_count": 80,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Asw = (\n",
" (1.389, -1.262e-2, 7.166e-5, 2.008e-6, -3.21e-8), \n",
" (9.4742e-5, -1.2583e-5, -6.4928e-8, 1.0515e-8, -2.0142e-10), \n",
" (-3.9064e-7, 9.1061e-9, -1.6009e-10, 7.994e-12), \n",
" (1.100e-10, 6.651e-12, -3.391e-13)\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 81,
"id": "cddd67a1-c808-47d6-9fc6-086b3e0f77ed",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((-0.01922, -4.42e-5), (7.3637e-5, 1.795e-7))"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Bsw = ((-1.922e-2, -4.42e-5), (7.3637e-5, 1.7950e-7))"
]
},
{
"cell_type": "code",
"execution_count": 82,
"id": "f3b41bba-2f6e-401d-8585-3828fead0604",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.001727, -7.9836e-6)"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Dsw = (1.727e-3, -7.9836e-6)"
]
},
{
"cell_type": "code",
"execution_count": 83,
"id": "9ff51302-55fb-4f86-8d96-f2f47da573a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"((1402.388, 5.0383, -0.058109, 0.00033432, -1.47797e-6, 3.1419e-9), (0.153563, 0.00068999, -8.1829e-6, 1.3632e-7, -6.126e-10), (3.126e-5, -1.7111e-6, 2.5986e-8, -2.5353e-10, 1.0415e-12), (-9.7729e-9, 3.8513e-10, -2.3654e-12))"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Cww = ((1402.388, 5.03830, -5.81090e-2, 3.3432e-4, -1.47797e-6,\n",
" 3.1419e-9), (0.153563, 6.8999e-4, -8.1829e-6, 1.3632e-7,\n",
" -6.1260e-10), (3.1260e-5, -1.7111e-6, 2.5986e-8, -2.5353e-10,\n",
" 1.0415e-12), (-9.7729e-9, 3.8513e-10, -2.3654e-12))"
]
},
{
"cell_type": "markdown",
"id": "0aeb7fde-2665-4bb1-b978-28c15df47f48",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 84,
"id": "53ae72d8-4a89-4498-8dbb-0b92569fcd05",
"metadata": {},
"outputs": [],
"source": [
"AtP = (sum(Asw[1] .* (1, t, t^2, t^3, t^4)) + \n",
" sum(Asw[2] .* (1, t, t^2, t^3, t^4)) * P + \n",
" sum(Asw[3] .* (1, t, t^2, t^3)) * P^2 + sum(Asw[4] .* (1, t, t^2)) * P^3);"
]
},
{
"cell_type": "code",
"execution_count": 85,
"id": "d5dab8bc-c020-406f-a0bc-6b9097e4245a",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$P \\left(1.795 \\cdot 10^{-7} t + 7.3637 \\cdot 10^{-5}\\right) - 4.42 \\cdot 10^{-5} t - 0.01922$"
],
"text/plain": [
"P⋅(1.795e-7⋅t + 7.3637e-5) - 4.42e-5⋅t - 0.01922"
]
},
"execution_count": 85,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"BtP = sum(Bsw[1] .* (1, t)) + sum(Bsw[2] .* (1, t)) * P"
]
},
{
"cell_type": "code",
"execution_count": 86,
"id": "49d5f000-7b3b-4860-81b7-9da5999d690f",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$0.001727 - 7.9836 \\cdot 10^{-6} P$"
],
"text/plain": [
"0.001727 - 7.9836e-6⋅P"
]
},
"execution_count": 86,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"DtP = sum(Dsw .* (1, P))"
]
},
{
"cell_type": "markdown",
"id": "7006a39b-173d-4be1-b2eb-c39f64f4cb01",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 87,
"id": "026594ef-3021-452d-a50d-e61db278eca1",
"metadata": {},
"outputs": [],
"source": [
"CwtP = sum(Cww[1] .* (1, t, t^2, t^3, t^4, t^5)) + sum(Cww[2] .* (1,\n",
" t, t^2, t^3, t^4)) * P + sum(Cww[3] .* (1, t, t^2, t^3, t^4)) *\n",
" P^2 + sum(Cww[4] .* (1, t, t^2)) * P^3;"
]
},
{
"cell_type": "markdown",
"id": "80190860-2eb8-4979-bd00-0a4821496cc1",
"metadata": {},
"source": [
"The following expression is the sound speed as a function of temperature, salinity, and pressure."
]
},
{
"cell_type": "markdown",
"id": "dc6829f2-b499-4291-b255-383c73a913df",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 88,
"id": "faac8111-1d9e-4eed-a2aa-52d4776e616e",
"metadata": {},
"outputs": [],
"source": [
"CStP = CwtP + AtP*S + BtP*S^(3/2) + DtP*S^2;"
]
},
{
"cell_type": "markdown",
"id": "007df546-e79e-4f97-ae9b-6de1b6c4dfde",
"metadata": {},
"source": [
"Create a Julia function with the pressure value in Pa. "
]
},
{
"cell_type": "code",
"execution_count": 89,
"id": "1bdb689c-2177-45f2-bac4-8c87cc79740a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 89,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CtSpjl = lambdify(CStP(P=>p/1e5),(t, S, p))"
]
},
{
"cell_type": "markdown",
"id": "5aa347e4-fea4-4f35-b304-9c7beeb42799",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 90,
"id": "d2b33911-1b99-4f6c-9860-284b4588341b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1521.6469588481918"
]
},
"execution_count": 90,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CtSpjl(ts, sal, ptab[1])"
]
},
{
"cell_type": "markdown",
"id": "79ff9467-e11f-4fdb-8e85-6d574f7be3cc",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 91,
"id": "d6f9c335-9445-4943-ac12-ebca650be533",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1456.0611774871181"
]
},
"execution_count": 91,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CtSpjl(tcold, sal, ptab[1])"
]
},
{
"cell_type": "markdown",
"id": "14b9006e-8c46-420e-bbfd-a879ad809dcb",
"metadata": {},
"source": [
"Value at depth 1000 m (index 1001 in `dvals`)"
]
},
{
"cell_type": "code",
"execution_count": 92,
"id": "8a89f377-443d-4d29-aeb8-8269d0867543",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1472.6428237138698"
]
},
"execution_count": 92,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CtSpjl(tcold, sal, ptab[1001])"
]
},
{
"cell_type": "markdown",
"id": "29ad87e8-0e49-49d9-a145-f4c76db5e096",
"metadata": {},
"source": [
"Value at depth 2000 m (index 2001 in `dvals`)"
]
},
{
"cell_type": "code",
"execution_count": 93,
"id": "c2d61d09-dd38-485a-9f11-6a27effec54f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1489.5878214658405"
]
},
"execution_count": 93,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CtSpjl(tcold, sal, ptab[2001])"
]
},
{
"cell_type": "markdown",
"id": "4d02fd1a-e778-46d4-b494-7d7948c12a96",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 94,
"id": "fb5c4a7e-b040-4c63-a870-ef6840757474",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1515.6224501126085"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CtSpjl(tcold, sal, ptab[end])"
]
},
{
"cell_type": "markdown",
"id": "f8126b70-673d-4747-b55a-3299cc2cf226",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 95,
"id": "a1f85ae0-285b-4ef3-bcab-c62d56924d1a",
"metadata": {},
"outputs": [],
"source": [
"ctab = map(p1 -> CtSpjl(tcold, sal, p1), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 96,
"id": "35500d15-39bb-411b-98e3-95e8c1400ed6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1456.0611774871181, 1515.6224501126085)"
]
},
"execution_count": 96,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ctab[1], ctab[end]"
]
},
{
"cell_type": "markdown",
"id": "2d1e6f5d-a16e-4f33-9181-583495891f26",
"metadata": {},
"source": [
"Add these values to the dataframes."
]
},
{
"cell_type": "code",
"execution_count": 97,
"id": "414db42f-0eff-4d53-8904-f2aacdfff610",
"metadata": {},
"outputs": [],
"source": [
"valso2.water_sound_speed = ctab\n",
"valsn2.water_sound_speed = ctab;"
]
},
{
"cell_type": "markdown",
"id": "713e4e26-2b56-466a-a651-2798a1e21288",
"metadata": {
"tags": []
},
"source": [
"## 5. Gas Properties"
]
},
{
"cell_type": "code",
"execution_count": 98,
"id": "474602bd-e056-43e4-af00-2f3032a7a882",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8.31451"
]
},
"execution_count": 98,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"R = 8.314510 # J mol^-1 K^-1, universal gas constant"
]
},
{
"cell_type": "markdown",
"id": "a05862b8-633f-44b6-aeab-a6e5ede192b2",
"metadata": {},
"source": [
"### 5.1. Oxygen"
]
},
{
"cell_type": "markdown",
"id": "5806a64a-ee10-48ed-bb53-7b387e1e5c5b",
"metadata": {},
"source": [
"We calculate oxygen densities, heat capacities, and sound speeds using the relationships from Schmidt and Wagner [56]. We calculate thermal conductivities using the relationships in Lemmon and Jacobsen [58]. We calculate thermal diffusivities using the relationship in Ainslie and Leighton [1]."
]
},
{
"cell_type": "markdown",
"id": "cf885f5b-d711-4032-9643-fb3d1bdb8dab",
"metadata": {},
"source": [
"Define some gas parameters used by Schmidt and Wagner [56]."
]
},
{
"cell_type": "code",
"execution_count": 99,
"id": "18be7021-2e9e-477c-81d6-6cd5d8824137",
"metadata": {},
"outputs": [],
"source": [
"MO2 = 31.9988/1000; # kg, O_2 Molar mass"
]
},
{
"cell_type": "code",
"execution_count": 100,
"id": "7030ac68-5928-4242-9562-79a14bc10f7e",
"metadata": {},
"outputs": [],
"source": [
"T0 = 298.15; # K"
]
},
{
"cell_type": "code",
"execution_count": 101,
"id": "396fd614-15b4-4d77-9b97-3fd4105eb563",
"metadata": {},
"outputs": [],
"source": [
"p0 = 1.01325e5; # Pa"
]
},
{
"cell_type": "code",
"execution_count": 102,
"id": "f09b61c6-c670-41b9-a525-034906a926fc",
"metadata": {},
"outputs": [],
"source": [
"ρc = 13.63e3; # mol/m^3"
]
},
{
"cell_type": "code",
"execution_count": 103,
"id": "614dd359-76fb-4410-8054-8725d597b521",
"metadata": {},
"outputs": [],
"source": [
"Tc = 154.581; # K "
]
},
{
"cell_type": "code",
"execution_count": 104,
"id": "43758785-78f8-464c-85e4-3131f022b43b",
"metadata": {},
"outputs": [],
"source": [
"δ0 = p0 /(R * T0 * ρc);"
]
},
{
"cell_type": "code",
"execution_count": 105,
"id": "9d9b8a78-3d45-4b0d-8d8f-f40398089860",
"metadata": {},
"outputs": [],
"source": [
"τ0 = Tc / T0;"
]
},
{
"cell_type": "markdown",
"id": "da6daa6b-2e6d-431e-a720-572fc96f7a0d",
"metadata": {},
"source": [
"Define variables used in symbolic calculations."
]
},
{
"cell_type": "code",
"execution_count": 106,
"id": "8d73cb9b-1c3c-4d09-9e60-b24b7dc13f43",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(δ, τ, T, ρ, M)"
]
},
"execution_count": 106,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@vars δ τ T ρ M"
]
},
{
"cell_type": "markdown",
"id": "a8f12ce4-78e9-47ae-b287-02051f262701",
"metadata": {},
"source": [
"Define the coefficients in the equations."
]
},
{
"cell_type": "code",
"execution_count": 107,
"id": "854d9751-0166-47ac-a14f-239763fb6855",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.3983768749, -1.846157454, 0.4183473197, 0.02370620711, 0.09771730573, 0.03017891294, 0.02273353212, 0.01357254086, -0.04052698943, 0.0005454628515, 0.0005113182277, 2.953466883e-7, -8.687645072e-5, -0.2127082589, 0.08735941958, 0.127550919, -0.09067701064, -0.03540084206, -0.03623278059, 0.0132769929, -0.0003254111865, -0.008313582932, 0.002124570559, -0.0008325206232, -2.626173276e-5, 0.002599581482, 0.009984649663, 0.002199923153, -0.02591350486, -0.1259630848, 0.1478355637, -0.01011251078)"
]
},
"execution_count": 107,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"no2 = (0.3983768749, -0.1846157454e1, 0.4183473197, 0.2370620711e-1,\n",
" 0.9771730573e-1, 0.3017891294e-1, 0.2273353212e-1,\n",
" 0.1357254086e-1, -0.4052698943e-1, 0.5454628515e-3,\n",
" 0.5113182277e-3, 0.2953466883e-6, -0.8687645072e-4,\n",
" -0.2127082589, 0.8735941958e-1, 0.1275509190, -0.9067701064e-1,\n",
" -0.3540084206e-1, -0.3623278059e-1, 0.1327699290e-1,\n",
" -0.3254111865e-3, -0.8313582932e-2, 0.2124570559e-2,\n",
" -0.8325206232e-3, -0.2626173276e-4, 0.2599581482e-2,\n",
" 0.9984649663e-2, 0.2199923153e-2, -0.2591350486e-1,\n",
" -0.1259630848, 0.1478355637, -0.1011251078e-1)"
]
},
{
"cell_type": "code",
"execution_count": 108,
"id": "ff250eee-394b-4959-a050-92ab48a847f3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-0.000740775, -6.6493e-5, 2.50042, -21.4487, 1.01258, -0.944365, 14.5066, 74.9148, 4.14817)"
]
},
"execution_count": 108,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"kko2 = (-0.740775e-3, -0.664930e-4, 0.250042e1, -0.214487e2,\n",
" 0.101258e1, -0.944365, 0.145066e2, 0.749148e2, 0.414817e1)"
]
},
{
"cell_type": "code",
"execution_count": 109,
"id": "105ac581-7494-4cc8-94ca-35a381f6b34f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 1, 1, 2, 2, 2, 3, 3, 3, 6, 7, 7, 8, 1, 1, 2, 2, 3, 3, 5, 6, 7, 8, 10, 2, 3, 3, 4, 4, 5, 5, 5)"
]
},
"execution_count": 109,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ro2 = (1, 1, 1, 2, 2, 2, 3, 3, 3, 6, 7, 7, 8, 1, 1, 2, 2, 3, 3, 5, 6,\n",
" 7, 8, 10, 2, 3, 3, 4, 4, 5, 5, 5)"
]
},
{
"cell_type": "code",
"execution_count": 110,
"id": "1d4503c1-5866-471e-9388-a29353dc032f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 1.5, 2.5, -0.5, 1.5, 2, 0, 1, 2.5, 0, 2, 5, 2, 5, 6, 3.5, 5.5, 3, 7, 6, 8.5, 4, 6.5, 5.5, 22, 11, 18, 11, 23, 17, 18, 23)"
]
},
"execution_count": 110,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"so2 = (0, 1.5, 2.5, -0.5, 1.5, 2, 0, 1, 2.5, 0, 2, 5, 2, 5, 6, 3.5,\n",
" 5.5, 3, 7, 6, 8.5, 4, 6.5, 5.5, 22, 11, 18, 11, 23, 17, 18, 23)"
]
},
{
"cell_type": "markdown",
"id": "f1099a36-a045-44f8-a504-d20d1d7b9c8e",
"metadata": {},
"source": [
"The following is Eq. (15) in Schmidt and Wagner [56] with $\\Phi^{id}$ changed to `α0`."
]
},
{
"cell_type": "markdown",
"id": "762412a3-f323-4b45-909a-beb9abeef402",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 111,
"id": "8e06636c-7869-4e55-aa80-ce436e9d1f87",
"metadata": {},
"outputs": [],
"source": [
"α0 = (kko2[1]*τ^1.5 + kko2[2]*τ^-2 + kko2[3]*log(τ) + kko2[4]*τ +\n",
" kko2[5]*log(exp(kko2[7]*τ) - 1) + kko2[6]*log(1 +\n",
" 2/3*exp(-kko2[8]*τ)) + kko2[9] + log(δ/δ0));"
]
},
{
"cell_type": "markdown",
"id": "46c5b093-eadb-4399-bdf3-d13f02c41185",
"metadata": {},
"source": [
"The following is Eq (11) in Lemmon and Jacobsen [58] with $\\Phi^r$ changed to `αr`."
]
},
{
"cell_type": "markdown",
"id": "58acc3ab-8473-4c71-a4a4-41d240b47a12",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 112,
"id": "0dc548e0-c9bc-4f68-9974-ffcac4c6e781",
"metadata": {},
"outputs": [],
"source": [
"αr = (\n",
" sum(map(m -> no2[m] * δ^ro2[m] * τ^so2[m], 1:13)) +\n",
" exp(-δ^2) * \n",
" sum(map(m -> no2[m] * δ^ro2[m] * τ^so2[m], 14:24)) + \n",
" exp(-δ^4) * \n",
" sum(map(m -> no2[m] * δ^ro2[m] * τ^so2[m], 25:32))\n",
");"
]
},
{
"cell_type": "markdown",
"id": "dea887ab-ba10-457a-b803-b080ea3f0943",
"metadata": {},
"source": [
"#### 5.1.1. Density"
]
},
{
"cell_type": "markdown",
"id": "d2a37b9c-2128-4bdc-bab8-ee33f64adb06",
"metadata": {},
"source": [
"Find the molar density from the root of Eq. (A1) in Schmidt and Wagner [56]. The term `ρ` in this equation is molar density with SI unit mol/m3."
]
},
{
"cell_type": "markdown",
"id": "fa1baa09-a513-4342-baae-badc96860f30",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 113,
"id": "650ed7d9-d2ea-4b16-987b-4803b7e34d32",
"metadata": {},
"outputs": [],
"source": [
"ρeq = Eq(p, ρ * R * T * (1 + δ * diff(αr, δ)))(δ => ρ/ρc, τ => Tc/T);"
]
},
{
"cell_type": "markdown",
"id": "bb7ba9f9-afc5-48b6-a35f-5f61d079cf6e",
"metadata": {},
"source": [
"Create a Julia function that we can use to find roots numerically."
]
},
{
"cell_type": "code",
"execution_count": 114,
"id": "b06870c4-53d2-4d99-83ee-5cf5d3a4eb7f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 114,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρeqjl = lambdify(lhs(ρeq) - rhs(ρeq), (p, T, ρ))"
]
},
{
"cell_type": "markdown",
"id": "65158e84-0f64-452b-b68c-6256a8fe98ff",
"metadata": {},
"source": [
"Now create a function that numerically finds a root for the density at a given value of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 115,
"id": "5d22fd7a-a614-4c39-8f1d-0b394b4f9191",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ρo2 (generic function with 2 methods)"
]
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρo2(p, T, ρ0=24000.0) = find_zero(ρ1 -> ρeqjl(p, T, ρ1), ρ0)"
]
},
{
"cell_type": "markdown",
"id": "e127874f-f3c8-400c-8abe-53dd6c4fde42",
"metadata": {},
"source": [
"Now we comparing to densities tabulated by Weber [57] for O2. \n",
"\n",
"Find the density at $p = 700$ bar (or $700 \\times 10^5$ Pa) and $T = 270$ K."
]
},
{
"cell_type": "code",
"execution_count": 116,
"id": "04300df7-9b12-40c0-bda4-1bb26e36a389",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"22886.84924777297"
]
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρo2(700e5, 270)"
]
},
{
"cell_type": "markdown",
"id": "21b278ca-09e8-4dc4-827d-45648d45e528",
"metadata": {},
"source": [
"The Weber [57] gives a volume of 1.3657 cm3/g at this pressure and temperature (Table VIa). Convert this to density in mol/m3."
]
},
{
"cell_type": "code",
"execution_count": 117,
"id": "8d60f1c0-2a26-400f-a392-a65317e5f196",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"22882.89662367062"
]
},
"execution_count": 117,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(1/(1.3657 #= cm^3/g =#) * (1 #= kg =# / 1000 #= g =#) * \n",
" (1 / MO2 #= kg/mol =#) * (100 #= cm =# / 1 #= m =#)^3 )"
]
},
{
"cell_type": "markdown",
"id": "770c8b77-7b4d-4fd5-9724-33cace92bf6b",
"metadata": {},
"source": [
"The calculated value is consistent to 4 significant figures. This is good."
]
},
{
"cell_type": "markdown",
"id": "24cd3062-c7f9-4f83-b32d-452d522b8766",
"metadata": {},
"source": [
"Now find the density at $p = 700$ bar (or $700 \\times 10^5$ Pa) and $T = 300$ K."
]
},
{
"cell_type": "code",
"execution_count": 118,
"id": "f1bb3da3-df1a-4f3a-875b-242276c75051",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20920.324839551213"
]
},
"execution_count": 118,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρo2(700e5, 300)"
]
},
{
"cell_type": "markdown",
"id": "d7551618-5e5e-408a-86fc-29d48248cd2f",
"metadata": {},
"source": [
"Weber [57] gives a volume of 1.4941 cm3/g (Table VIa). Convert this to density in mol/m3."
]
},
{
"cell_type": "code",
"execution_count": 119,
"id": "31bedfea-0eca-4c51-890c-8925167580c3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20916.385729835325"
]
},
"execution_count": 119,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(1/(1.4941 #= cm^3/g =#) * (1 #= kg =# / 1000 #= g =#) * \n",
" (1 / MO2 #= kg/mol =#) * (100 #= cm =# / 1 #= m =#)^3 )"
]
},
{
"cell_type": "markdown",
"id": "d977ab46-85a4-4f68-9cd2-1c5e66839c9c",
"metadata": {},
"source": [
"This also agrees to four significant figures."
]
},
{
"cell_type": "markdown",
"id": "5f2fb0c9-b005-446b-b182-d9b46f8a4a28",
"metadata": {},
"source": [
"Now tabulate mass density values by multiplying each molar density by the molar mass."
]
},
{
"cell_type": "code",
"execution_count": 120,
"id": "d3f5be1b-8b5f-4a69-8380-ae8337fe2a01",
"metadata": {},
"outputs": [],
"source": [
"ρo2tab = map(p1 -> ρo2(p1, Tcold) * MO2, ptab);"
]
},
{
"cell_type": "markdown",
"id": "f8c4ee8a-ba5c-41f8-9049-527c02fa5da3",
"metadata": {},
"source": [
"The values below ate the mass densities for oxygen at the cold surface, depth 1000 m, depth 2000 m, and depth 3500 m."
]
},
{
"cell_type": "code",
"execution_count": 121,
"id": "812fb117-c363-4844-b635-6de50195d64b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.4211670046377123, 154.7115917256005, 314.00236160237546, 500.93121320697526)"
]
},
"execution_count": 121,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρo2tab[1], ρo2tab[1001], ρo2tab[2001], ρo2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "22a90d8e-d6be-4a44-a5fd-1d069c4fe72b",
"metadata": {},
"source": [
"#### 5.1.2. Isochoric Heat Capacity $c_v$"
]
},
{
"cell_type": "markdown",
"id": "6ce544be-0735-4ace-896d-5158860ce5f2",
"metadata": {},
"source": [
"The following is Eq. (A6) from Schmidt and Wagner [56]."
]
},
{
"cell_type": "markdown",
"id": "93a1d97d-638c-4b17-a101-d4839171184c",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 122,
"id": "e5d20dc1-fc1e-4945-bbac-7620ee52378c",
"metadata": {},
"outputs": [],
"source": [
"cv = -τ^2 * (diff(α0, τ, τ) + diff(αr, τ, τ)) * R;"
]
},
{
"cell_type": "markdown",
"id": "a8d0b03b-d760-489d-9c79-aa04853330fd",
"metadata": {},
"source": [
"Substitute the values of $\\delta$ and $\\tau$ in terms of molar density and temperature."
]
},
{
"cell_type": "markdown",
"id": "5d7dc6bf-9e92-4242-92f7-5abf1212f38c",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 123,
"id": "12b6c77c-0bab-48fd-96c3-d2917a6db79b",
"metadata": {},
"outputs": [],
"source": [
"cv(δ => ρ/ρc, τ => Tc/T);"
]
},
{
"cell_type": "markdown",
"id": "ccb406d9-3704-467a-8b0a-14855449b1c6",
"metadata": {},
"source": [
"Define a Julia function for calculations."
]
},
{
"cell_type": "code",
"execution_count": 124,
"id": "a6a539b3-2a5f-4c61-88e9-5bb9deaae741",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvjl = lambdify(cv(δ => ρ/ρc, τ => Tc/T),(ρ, T))"
]
},
{
"cell_type": "markdown",
"id": "93b23088-f28e-4baa-95c2-0ac439ce5428",
"metadata": {},
"source": [
"Calculate some values."
]
},
{
"cell_type": "code",
"execution_count": 125,
"id": "4ad67a0e-e278-439c-b675-0e7d111b587a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"23.898882530084624"
]
},
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvjl(ρo2(700e5, 270), 270)"
]
},
{
"cell_type": "markdown",
"id": "b767b8ec-c17d-497e-b0ea-6179ac5d35a7",
"metadata": {},
"source": [
"Define another Julia function that uses an input pressure and temperature to calculate the needed density value."
]
},
{
"cell_type": "code",
"execution_count": 126,
"id": "0f38b8cd-1633-4c32-84d9-762cd67f8416",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"cvpTo2 (generic function with 1 method)"
]
},
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTo2(p, T) = cvjl(ρo2(p, T), T)"
]
},
{
"cell_type": "code",
"execution_count": 127,
"id": "b5a38d7c-1638-443a-b73e-b1ba26cb7ee9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"21.078866720527625"
]
},
"execution_count": 127,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTo2(1e5, 300)"
]
},
{
"cell_type": "code",
"execution_count": 128,
"id": "eca940a5-72e6-4edb-8575-fb24b0c366d4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20.95584051862463"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTo2(1e5, 270)"
]
},
{
"cell_type": "markdown",
"id": "fc920c2c-3fed-44ad-bc15-bab1d23e5257",
"metadata": {},
"source": [
"Weber [57] reports specific heat $C_v$ values in J/(g K). Get these by dividing the `cvpTo2` values by the molar mass in g, which is 1000 `MO2`."
]
},
{
"cell_type": "code",
"execution_count": 129,
"id": "ade22f8b-e72e-4eb9-a29c-2e79d92b58ef",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.660918602988702"
]
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTo2(10e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "code",
"execution_count": 130,
"id": "186be077-8d11-400f-a015-605100684ba4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.6644992914305471"
]
},
"execution_count": 130,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTo2(25e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "markdown",
"id": "7182f723-a130-4490-898c-b86f438c8747",
"metadata": {},
"source": [
"These values are very close to Weber's results. They begin to diverge at higher pressures."
]
},
{
"cell_type": "code",
"execution_count": 131,
"id": "68ebe256-5874-4b94-8108-a542447759c3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.7089086969553833"
]
},
"execution_count": 131,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTo2(300e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "markdown",
"id": "df209acf-f08c-48c2-b691-daaa021b384f",
"metadata": {},
"source": [
"#### 5.1.3. Isobaric Heat Capacity $c_p$"
]
},
{
"cell_type": "markdown",
"id": "cb71d01a-5397-46c3-a88c-b4a61247c6b3",
"metadata": {},
"source": [
"Use Eq. (A7) from Schmidt and Wagner [56] to calculate $c_p$."
]
},
{
"cell_type": "markdown",
"id": "7ca46cb8-9db0-4dd5-9249-032dc7a366ee",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 132,
"id": "d6425721-6891-4347-8871-676d29b50af3",
"metadata": {},
"outputs": [],
"source": [
"cp = (cv + (1 + δ * diff(αr, δ) - δ * τ *\n",
" diff(αr, δ, τ))^2 / (1 + 2 * δ * diff(αr, δ) + \n",
" δ^2 * diff(αr, δ, δ)) * R);"
]
},
{
"cell_type": "markdown",
"id": "f321590a-13d0-48d4-b208-a9f7d7cfaac4",
"metadata": {},
"source": [
"Define a Julia function to calculate values."
]
},
{
"cell_type": "code",
"execution_count": 133,
"id": "924424ae-26d5-4d60-945e-2a2a2852b8fc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 133,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cpjl = lambdify(cp(δ => ρ/ρc, τ => Tc/T),(ρ, T))"
]
},
{
"cell_type": "markdown",
"id": "1471f6eb-ecde-4b51-9ad2-9a55c3b9ff4b",
"metadata": {},
"source": [
"Define another Julia function that uses an input pressure and temperature to calculate the needed density value."
]
},
{
"cell_type": "code",
"execution_count": 134,
"id": "2ab4f191-04df-4fb2-a5a3-316afca993dd",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"cppTo2 (generic function with 1 method)"
]
},
"execution_count": 134,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTo2(p, T) = cpjl(ρo2(p, T), T)"
]
},
{
"cell_type": "markdown",
"id": "9fb84f24-e3b7-457c-bec1-ec39d795478c",
"metadata": {},
"source": [
"Calculate some values."
]
},
{
"cell_type": "code",
"execution_count": 135,
"id": "7293f066-5f00-4131-858c-013f181cc60e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"29.435205927984697"
]
},
"execution_count": 135,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTo2(1e5, 300)"
]
},
{
"cell_type": "code",
"execution_count": 136,
"id": "d28bbc39-ec69-4060-a52b-dea90fdca73f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.9198846809250565"
]
},
"execution_count": 136,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTo2(1e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "markdown",
"id": "b5e9592d-ee3a-4936-97d5-849e4a579773",
"metadata": {},
"source": [
"Weber [57] reports specific heat $C_p$ values in J/(g K). Get these by dividing the `cppTo2` values by the molar mass in g, which is 1000 `MO2`."
]
},
{
"cell_type": "code",
"execution_count": 137,
"id": "842086fd-4eca-4d5f-923c-25b6bec93c3b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.9340227201860647"
]
},
"execution_count": 137,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTo2(10e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "code",
"execution_count": 138,
"id": "2b6b15d3-bfc6-4f18-859e-1169522796ae",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.9582613365905686"
]
},
"execution_count": 138,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTo2(25e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "markdown",
"id": "6f5e22f5-7044-4cd0-8a92-64c659dcc57a",
"metadata": {},
"source": [
"These values are very close to Weber's results. They begin to diverge at higher pressures."
]
},
{
"cell_type": "code",
"execution_count": 139,
"id": "9f1bbe1c-329a-4d06-9eee-f2f52970429e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.3072282411638052"
]
},
"execution_count": 139,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTo2(300e5, 300) / (1000 * MO2)"
]
},
{
"cell_type": "markdown",
"id": "38bcf2b8-2bae-4e5c-a624-82f560323a09",
"metadata": {},
"source": [
"#### 5.1.4. Ratio of Specific Heats $\\gamma$"
]
},
{
"cell_type": "markdown",
"id": "bbe44ea0-333d-4b9b-ba53-6f7854adcb77",
"metadata": {},
"source": [
"Use the values of the two specific heats to calculate $\\gamma = c_p / c_v$."
]
},
{
"cell_type": "code",
"execution_count": 140,
"id": "75262674-9d61-4124-8223-a0209b96415d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"γo2 (generic function with 1 method)"
]
},
"execution_count": 140,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2(p, T) = cppTo2(p, T) / cvpTo2(p, T)"
]
},
{
"cell_type": "markdown",
"id": "06936f48-75fd-4997-bb75-b02bf3c404fe",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 141,
"id": "b472d325-c65a-4dd8-81c9-997db24ed759",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.3971781560134038"
]
},
"execution_count": 141,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2(ptab[1], Ts)"
]
},
{
"cell_type": "markdown",
"id": "e6679f1d-032e-4e52-bbb4-7ef4af764e85",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 142,
"id": "6fab773c-e26b-4dc3-8719-09b4dc8018ee",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.398953943344819"
]
},
"execution_count": 142,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2(ptab[1], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "24232451-b6cb-4932-8b54-926de50d1638",
"metadata": {},
"source": [
"Value at depth 1000 m (index 1001 in `dvals`)"
]
},
{
"cell_type": "code",
"execution_count": 143,
"id": "f2add2da-4e27-4181-a89f-120fc6baebfb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.6680921647387352"
]
},
"execution_count": 143,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "58ebea2b-669f-4d0e-a339-b1e401c0dd74",
"metadata": {},
"source": [
"Value at depth 2000 m (index 2001 in `dvals`)"
]
},
{
"cell_type": "code",
"execution_count": 144,
"id": "adaf0f49-af2d-4df0-ab27-5c9dc3349e6a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.8968036632857108"
]
},
"execution_count": 144,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "70321b93-e4b9-4a9f-b69b-dc2bf8e24f04",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 145,
"id": "71dc8409-eff8-4a48-a0f8-ba950ed7519d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.9497207685437572"
]
},
"execution_count": 145,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "8a753430-702b-4638-94a3-9fb7a68e1e47",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 146,
"id": "86b4af8c-430f-4aea-bae8-6ff680c83b93",
"metadata": {},
"outputs": [],
"source": [
"γo2tab = map(p1 -> γo2(p1, Tcold), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 147,
"id": "633f6197-c124-4c39-9438-3c35529e0552",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.398953943344819, 1.6680921647387352, 1.8968036632857108, 1.9497207685437572)"
]
},
"execution_count": 147,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γo2tab[1], γo2tab[1001], γo2tab[2001], γo2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "3e5fdd72-94fb-445f-b7de-34c8ccbfbe3f",
"metadata": {},
"source": [
"Add these values to the dataframe."
]
},
{
"cell_type": "code",
"execution_count": 148,
"id": "fd255012-b587-4aa2-aab1-e069077c0039",
"metadata": {},
"outputs": [],
"source": [
"valso2.gamma = γo2tab;"
]
},
{
"cell_type": "markdown",
"id": "c268fe01-ac9a-44bd-b4e1-9a52def3f0f9",
"metadata": {},
"source": [
"#### 5.1.5. Sound Speed"
]
},
{
"cell_type": "markdown",
"id": "8b1c4a7e-93a6-4bb5-882e-3df9bcb9c0c8",
"metadata": {},
"source": [
"Use Eq. (A8) from Schmidt and Wagner [56] to calculate the sound speed in oxygen. "
]
},
{
"cell_type": "markdown",
"id": "efc5f8eb-6151-4eaa-9630-8fe3d2386f82",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 149,
"id": "546e3da6-3ddb-4f13-a137-b6c72a3e022c",
"metadata": {},
"outputs": [],
"source": [
"w = sqrt( R * T / M * (1 + 2 * δ * diff(αr, δ) + δ^2 * diff(αr, δ, δ) - \n",
" (1 + δ * diff(αr, δ) - δ * τ * diff(αr, δ, τ))^2 / (τ^2 * \n",
" (diff(α0, τ, τ) + diff(αr, τ, τ)))));"
]
},
{
"cell_type": "markdown",
"id": "59a9826d-9088-47bb-9415-dccf2152b6d1",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 150,
"id": "dbafca78-8948-4bb5-84d1-d16802ab1957",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 150,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wjl = lambdify(w(δ => ρ/ρc, τ => Tc/T),(ρ, T, M))"
]
},
{
"cell_type": "markdown",
"id": "99218f9e-586a-4047-9d3c-5b63107c491c",
"metadata": {},
"source": [
"Define a function of pressure and temperature as before."
]
},
{
"cell_type": "code",
"execution_count": 151,
"id": "a2158909-08d1-4978-b3d2-cc256e2e05e1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"wpT (generic function with 1 method)"
]
},
"execution_count": 151,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(p, T) = wjl(ρo2(p, T), T, MO2)"
]
},
{
"cell_type": "code",
"execution_count": 152,
"id": "cc28320e-cd4b-4525-8851-ed4c87c990a2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"415.3954022737472"
]
},
"execution_count": 152,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(300e5, 300)"
]
},
{
"cell_type": "markdown",
"id": "f8f87fd1-d35b-4e38-9132-ad8a19b7ddef",
"metadata": {},
"source": [
"This value is similar to that of Weber [57]."
]
},
{
"cell_type": "markdown",
"id": "b43ab3c8-0552-44ca-8c92-882697b046d3",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 153,
"id": "6e3bf7e3-cb0d-4936-98ee-070084ed30e4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"325.9996893882054"
]
},
"execution_count": 153,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[1], Ts)"
]
},
{
"cell_type": "markdown",
"id": "55937c10-f0d6-4835-928d-d8a71a9357f6",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 154,
"id": "80634ca4-b0c2-4cd9-aa5d-1940a146c974",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"315.66916929963963"
]
},
"execution_count": 154,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[1], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "c328bf06-f86c-4b61-a006-e80f52f12a3d",
"metadata": {},
"source": [
"Value at depth 1000 m (index 1001 in `dvals`)"
]
},
{
"cell_type": "code",
"execution_count": 155,
"id": "bb9f3051-3894-419e-9e45-fb8cfea53441",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"322.7128276738636"
]
},
"execution_count": 155,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "3ce750e6-f0a2-4d0b-9098-19ddde2f431e",
"metadata": {},
"source": [
"Value at depth 2000 m (index 2001 in `dvals`)"
]
},
{
"cell_type": "code",
"execution_count": 156,
"id": "6eafbb56-7e72-4e41-90ee-2ca7076e7734",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"358.2715926515373"
]
},
"execution_count": 156,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "ff5e44bb-a180-4c96-a452-1b3482439eed",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 157,
"id": "8bbbae23-8eae-451f-bb46-5d763c1bdf72",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"447.86433243536436"
]
},
"execution_count": 157,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "d58eab43-23f5-43c2-9fa8-147a9074abd1",
"metadata": {},
"source": [
"Tabulate values for depth profile."
]
},
{
"cell_type": "code",
"execution_count": 158,
"id": "382432b1-fcc8-42f9-bf84-591871e17b6d",
"metadata": {},
"outputs": [],
"source": [
"wo2tab = map(p1 -> wpT(p1, Tcold), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 159,
"id": "f224308b-7ca7-4198-8274-6c4a61a75c23",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(315.66916929963963, 322.7128276738636, 358.2715926515373, 447.86433243536436)"
]
},
"execution_count": 159,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wo2tab[1], wo2tab[1001], wo2tab[2001], wo2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "e893e3d4-f866-4ef4-96c8-ec6338b619e1",
"metadata": {},
"source": [
"#### 5.1.6. Viscosity"
]
},
{
"cell_type": "markdown",
"id": "728bfec8-4784-4f78-ad56-6ed041accc43",
"metadata": {},
"source": [
"Use the relationships from Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "4d70ad3e-fcdf-4530-8798-b587a1032337",
"metadata": {},
"source": [
"Define parameters and coefficients."
]
},
{
"cell_type": "code",
"execution_count": 160,
"id": "54f35809-9dd6-4645-9f42-144963cb3adb",
"metadata": {},
"outputs": [],
"source": [
"pc = 5.043e6; # Pa"
]
},
{
"cell_type": "code",
"execution_count": 161,
"id": "35981c33-7ab9-43aa-9add-eb9c9ac9bd66",
"metadata": {},
"outputs": [],
"source": [
"bi = (0.431, -0.4623, 0.08406, 0.005341, -0.00331);"
]
},
{
"cell_type": "markdown",
"id": "cc46c938-b72e-4ced-89e6-c38fa8e0ac3b",
"metadata": {},
"source": [
"The following is the collision integral required for Eq. (2) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 162,
"id": "0f9902f6-f1b8-4327-8e64-4e8f903ecbf2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ω (generic function with 1 method)"
]
},
"execution_count": 162,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω(Tstar) = exp(sum(bi[i+1] * (log(Tstar))^i for i in 0:4))"
]
},
{
"cell_type": "code",
"execution_count": 163,
"id": "9e0677c1-6c08-4115-9281-35890bf5d2e2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"118.5"
]
},
"execution_count": 163,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ϵoverk = 118.5 # K"
]
},
{
"cell_type": "code",
"execution_count": 164,
"id": "f37cc76c-8577-4590-b96c-6a712cc8c08e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0788836619239601"
]
},
"execution_count": 164,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω(300/ϵoverk)"
]
},
{
"cell_type": "code",
"execution_count": 165,
"id": "0e04a911-7738-4d67-9de8-e3a66b236235",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.428e-10"
]
},
"execution_count": 165,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σvis = 0.3428e-9"
]
},
{
"cell_type": "markdown",
"id": "245b58eb-2da2-4322-a5cf-1b7b80dea1bf",
"metadata": {},
"source": [
"The following is Eq. (2) from Lemmon and Jacobsen [58] with the constants adjusted so all values are in SI units. The resulting value is in Pa s."
]
},
{
"cell_type": "markdown",
"id": "a237fc19-ecb3-4248-908a-cffecf6297c2",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 166,
"id": "d8535043-315e-4267-9c87-b334f87914fc",
"metadata": {},
"outputs": [],
"source": [
"η0 = 0.0266958e-24 * sqrt(1000 * M * T) / (σvis^2*Ω(T/ϵoverk));"
]
},
{
"cell_type": "markdown",
"id": "4038c5b7-03bf-4b2b-9efb-7c2e0517dab9",
"metadata": {},
"source": [
"The following parameters are needed for Eq. (3) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 167,
"id": "3b576d38-7e9e-4c03-be9d-2c423cb88001",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(17.67, 0.4042, 0.0001077, 0.351, -13.67)"
]
},
"execution_count": 167,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Nvis = (17.67, 0.4042, 0.0001077, 0.3510, -13.67)"
]
},
{
"cell_type": "code",
"execution_count": 168,
"id": "f93d2ea0-e196-4a38-9af7-93dd361af7c6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.05, 0, 2.1, 0, 0.5)"
]
},
"execution_count": 168,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tvis = (0.05, 0, 2.10, 0, 0.5)"
]
},
{
"cell_type": "code",
"execution_count": 169,
"id": "2e357770-5a4d-425c-9f16-4eb1fa8d7c39",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 5, 12, 8, 1)"
]
},
"execution_count": 169,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dvis = (1, 5, 12, 8, 1)"
]
},
{
"cell_type": "code",
"execution_count": 170,
"id": "7fa98608-200e-4dd6-9274-43117243ac05",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 0, 0, 1, 2)"
]
},
"execution_count": 170,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lvis = (0, 0, 0, 1, 2)"
]
},
{
"cell_type": "markdown",
"id": "9d816588-952c-4a64-b942-025c864633cf",
"metadata": {},
"source": [
"This is Eq. (3) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "8cbe77e9-7288-4657-a543-949be75dca34",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 171,
"id": "ec85ed74-d85b-4809-ac1c-b73565910452",
"metadata": {},
"outputs": [],
"source": [
"ηr = 10^-6 * sum(Nvis[i] * τ^tvis[i] * δ^dvis[i] * \n",
" exp(lvis[i] == 0 ? 0 : -δ^lvis[i]) for i in 1:5);"
]
},
{
"cell_type": "markdown",
"id": "b0193a9f-b7be-43ef-98f6-302cd2f4c4ad",
"metadata": {},
"source": [
"This is Eq. (1) in Lemmon and Jacobsen [58]. The viscosity of oxygen is $\\eta$."
]
},
{
"cell_type": "markdown",
"id": "3a0ba74a-7585-49ab-a330-83fd59c37062",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 172,
"id": "b33c3de6-6429-49cc-b1f1-f6051784fd27",
"metadata": {},
"outputs": [],
"source": [
"η = η0 + ηr;"
]
},
{
"cell_type": "markdown",
"id": "840543df-ef0b-4505-bffd-ef6448179cf4",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 173,
"id": "a46e623f-d77e-4109-854f-88bc0cd936e5",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηjl = lambdify(η(δ => ρ/ρc, τ => Tc/T), (ρ, T, M))"
]
},
{
"cell_type": "markdown",
"id": "ebca6079-c750-44a0-b0b7-825f74f01dcd",
"metadata": {},
"source": [
"Calculate some values to compare with Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 174,
"id": "fbc8a8d2-a170-482c-a076-912b6a8971a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"23.757700201413066"
]
},
"execution_count": 174,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηjl(5e3, 300, MO2) * 1e6"
]
},
{
"cell_type": "code",
"execution_count": 175,
"id": "012b0e3e-822f-425b-a512-af93efb10601",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"172.13579729510082"
]
},
"execution_count": 175,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηjl(35e3, 100, MO2) * 1e6"
]
},
{
"cell_type": "code",
"execution_count": 176,
"id": "ec5a5993-fc6b-4f7c-ad5f-61d3ff8a7eb8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"22.44451567141834"
]
},
"execution_count": 176,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηjl(10e3, 200, MO2) * 1e6"
]
},
{
"cell_type": "markdown",
"id": "d415bb51-35f3-4468-a7d3-3e4c353c794c",
"metadata": {},
"source": [
"These values are consistent with the values in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "92faa093-b808-490f-8cde-4270889f7579",
"metadata": {},
"source": [
"Define a function of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 177,
"id": "849114a8-440e-4043-ac0f-8959065bf2bd",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ηpT (generic function with 1 method)"
]
},
"execution_count": 177,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(p, T) = ηjl(ρo2(p, T), T, MO2)"
]
},
{
"cell_type": "markdown",
"id": "7cec2c46-22f4-47fa-a1e6-1c67eb62717c",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 178,
"id": "db621c17-0687-4f71-8dc0-41c433b39e57",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.027266881737361e-5"
]
},
"execution_count": 178,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[1], Ts)"
]
},
{
"cell_type": "markdown",
"id": "c9fbb87c-08cb-4c39-a6ae-ce788483271e",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 179,
"id": "a3c02605-d42a-4ff6-8403-6719b99874a8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.9229098582802137e-5"
]
},
"execution_count": 179,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[1], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "2606c342-4b2f-47e7-bd35-54d0d003f98e",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 180,
"id": "18df60f6-62fd-4ac1-ab02-0213bb59e283",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.2091576792708548e-5"
]
},
"execution_count": 180,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "e5303899-1c73-42ce-932d-c0b54ba57c0b",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 181,
"id": "12a91333-06ec-4f4b-9fab-6a63d14329a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.726127656589478e-5"
]
},
"execution_count": 181,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "bdb34f12-fb90-46ab-a790-b751d00ca80f",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 182,
"id": "357ef44a-3a6a-4330-b315-67f29514c8c1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.692230187855806e-5"
]
},
"execution_count": 182,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "d4e02db4-c4d1-4e60-b956-b97ed524e629",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 183,
"id": "3d669de8-4cce-4fd3-b06e-9fabbb4e74dc",
"metadata": {},
"outputs": [],
"source": [
"ηo2tab = map(p1 -> ηpT(p1, Tcold), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 184,
"id": "97e6691c-1031-4529-b0ce-4127728ffd69",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.9229098582802137e-5, 2.2091576792708548e-5, 2.726127656589478e-5, 3.692230187855806e-5)"
]
},
"execution_count": 184,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηo2tab[1], ηo2tab[1001], ηo2tab[2001], ηo2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "dcb0d991-862c-495c-9bd2-eda3f8e736b9",
"metadata": {
"tags": []
},
"source": [
"#### 5.1.7. Thermal Conductivity"
]
},
{
"cell_type": "markdown",
"id": "1a2f3aa4-320d-4034-a56f-ecb09b57b3eb",
"metadata": {},
"source": [
"Use the relationships from Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "48ec0a41-a6db-4d01-be70-86d5568a5142",
"metadata": {},
"source": [
"Define the coefficients for the calculations (Table IV in Lemmon and Jacobsen [58])."
]
},
{
"cell_type": "code",
"execution_count": 185,
"id": "fd7fad30-8d71-4e04-9fc7-d732c9f08554",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.036, 6.283, -4.262, 15.31, 8.898, -0.7336, 6.728, -4.374, -0.4747)"
]
},
"execution_count": 185,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ncon = (1.036, 6.283, -4.262, 15.31, 8.898, -0.7336, \n",
" 6.728, -4.374, -0.4747)"
]
},
{
"cell_type": "markdown",
"id": "f77c62c7-8df0-4f8e-b157-cce1595740a5",
"metadata": {},
"source": [
"The first term in the list below is for $i=2$."
]
},
{
"cell_type": "code",
"execution_count": 186,
"id": "efc0991d-8400-4587-9740-586d13ca4092",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-0.9, -0.6, 0, 0, 0.3, 4.3, 0.5, 1.8)"
]
},
"execution_count": 186,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tcon = (-0.9, -0.6, 0, 0, 0.3, 4.3, 0.5, 1.8)"
]
},
{
"cell_type": "markdown",
"id": "d7292d02-e14c-4f62-a00a-9c39602c5d86",
"metadata": {},
"source": [
"The first term in the list below is for $i=4$."
]
},
{
"cell_type": "code",
"execution_count": 187,
"id": "0c577ac7-b789-4a1a-933c-364c57a6a1be",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 3, 4, 5, 7, 10)"
]
},
"execution_count": 187,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dcon = (1, 3, 4, 5, 7, 10)"
]
},
{
"cell_type": "markdown",
"id": "7696156e-4351-42bc-8eca-a4fa3e0cd4cb",
"metadata": {},
"source": [
"The first term in the list below is for $i=4$."
]
},
{
"cell_type": "code",
"execution_count": 188,
"id": "f25a510e-a98a-4765-84bc-5678353efb8a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 0, 0, 2, 2, 2)"
]
},
"execution_count": 188,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lcon = (0, 0, 0, 2, 2, 2)"
]
},
{
"cell_type": "markdown",
"id": "174d21ff-97e6-462d-b5bd-3faea26a8048",
"metadata": {},
"source": [
"The equation below is Eq. (5) in Lemmon and Jacobsen [58] adjusted so all parameters are in SI units."
]
},
{
"cell_type": "markdown",
"id": "e68dfd44-417d-4241-8c3b-c7875831d675",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 189,
"id": "e4edf4c0-7fe2-4cb1-9773-93b4977ae48a",
"metadata": {},
"outputs": [],
"source": [
"λ0 = 10^-3 * (Ncon[1] * (η0 / 10^-6) + Ncon[2] * τ^tcon[2 - 1] + Ncon[3]*τ^tcon[3 - 1]);"
]
},
{
"cell_type": "markdown",
"id": "ff5d2fd5-d51f-4eba-8b31-740389b7e6c3",
"metadata": {},
"source": [
"Define a Julia function for calculations."
]
},
{
"cell_type": "code",
"execution_count": 190,
"id": "0a70af36-da3f-495c-b336-52b915e2eb64",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 190,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ0jl = lambdify(λ0(τ=>Tc/T),(T, M))"
]
},
{
"cell_type": "markdown",
"id": "e9c8c06d-b4bc-4035-ba36-1e47c979dadf",
"metadata": {},
"source": [
"Compare symbolic and Julia function calculations."
]
},
{
"cell_type": "code",
"execution_count": 191,
"id": "cecccba8-0961-49bf-ac3d-6c9c938127f3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.008943340238199921795214540684620835839186806243358885993985347078141679335627102"
]
},
"execution_count": 191,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ0(τ=>Tc/T, M=>MO2)(T=>100))"
]
},
{
"cell_type": "code",
"execution_count": 192,
"id": "b244dd8a-76e1-404e-a8cb-3539d102c706",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.008943340238199926"
]
},
"execution_count": 192,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ0jl(100, MO2)"
]
},
{
"cell_type": "code",
"execution_count": 193,
"id": "b4098e24-c786-439d-a511-5a8447b34cce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02644030136501698760127026691516964213733322778655672323989834683839652527349483"
]
},
"execution_count": 193,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ0(τ=>Tc/T, M=>MO2)(T=>300))"
]
},
{
"cell_type": "code",
"execution_count": 194,
"id": "80be2f63-a1dd-4961-8c63-e301b20b331a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.026440301365017002"
]
},
"execution_count": 194,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ0jl(300, MO2)"
]
},
{
"cell_type": "markdown",
"id": "de79fb48-0f73-406c-ab9a-1ebcc9161af4",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "dc1ad6f2-f3c3-4bcf-a35b-e467bbe2ca5e",
"metadata": {},
"source": [
"This is Eq. (6) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "397ad104-197b-43b1-b25d-937b935f4fac",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 195,
"id": "721ca947-c3ed-4cff-998f-65d868688767",
"metadata": {},
"outputs": [],
"source": [
"λr = 10^-3 * sum( Ncon[i] * τ^tcon[i - 1] * δ^dcon[i -\n",
" 3] * exp(lcon[i - 3] == 0 ? 0 : -δ^lcon[i - 3]) for i in\n",
" 4:9);"
]
},
{
"cell_type": "markdown",
"id": "9b62edd6-4029-4951-8145-c88b25b204c6",
"metadata": {},
"source": [
"Define a Julia function for this."
]
},
{
"cell_type": "code",
"execution_count": 196,
"id": "a727adc7-4656-4345-b8ac-7692731398fe",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 196,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λrjl = lambdify(λr(δ => ρ/ρc, τ => Tc/T), (ρ, T))"
]
},
{
"cell_type": "markdown",
"id": "654bd284-3ba5-4058-af5c-1038301215f2",
"metadata": {},
"source": [
"Compare symbolic and Julia function values."
]
},
{
"cell_type": "code",
"execution_count": 197,
"id": "9eda22ee-3838-4e2a-852e-861ec1bceed4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0005631153755697235"
]
},
"execution_count": 197,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λr(δ => ρ/ρc, τ => Tc/T)(ρ => ρo2tab[end], T=>Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 198,
"id": "93a254b7-a74d-4e77-aa7d-8f66e2511798",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0005631153755697235"
]
},
"execution_count": 198,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λrjl(ρo2tab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "9ab73727-adab-400c-835b-800aef1ee6bb",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "3ddba898-4aed-4fb6-b077-535c3ce592c3",
"metadata": {},
"source": [
"In order to calculate $\\lambda^c$ in Eq. (7) in Lemmon and Jacobsen [58], we must calculate the parameters in Eqs. (8-11).\n",
"\n",
"First, we define some of the parameters in these equations."
]
},
{
"cell_type": "code",
"execution_count": 199,
"id": "80b17d6e-0d8f-4b12-8ed7-ac49f17831f6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.4e-10"
]
},
"execution_count": 199,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξ0 = 0.24e-9 # m"
]
},
{
"cell_type": "code",
"execution_count": 200,
"id": "dd262c2b-32b5-453e-af0b-bcb1bc2873ec",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.043e6"
]
},
"execution_count": 200,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pc = 5.043e6 # Pa"
]
},
{
"cell_type": "code",
"execution_count": 201,
"id": "62f13628-b070-439c-aaee-c75b798c289a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"13630.0"
]
},
"execution_count": 201,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρc = 13.63e3 # mol/m^3"
]
},
{
"cell_type": "markdown",
"id": "909bbf9f-1fcc-49a3-98fa-d1083bff6a19",
"metadata": {},
"source": [
"We need $\\left( \\frac{\\partial \\rho}{\\partial p} \\right)_T$. Use the equation of state from Eq. (A1) in Schmidt and Wagner [56] to get $\\left( \\frac{\\partial p}{\\partial \\rho} \\right)_T$, and invert it."
]
},
{
"cell_type": "markdown",
"id": "13fb2f99-fed5-4e1c-872f-628ffe953966",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 202,
"id": "44107a19-1e08-4fe3-abdf-eacc14e8306c",
"metadata": {},
"outputs": [],
"source": [
"dpdρ = diff(ρ * R * T * (1 + δ * diff(αr, δ))(δ => ρ/ρc, τ => Tc/T), ρ);"
]
},
{
"cell_type": "markdown",
"id": "ad421b1d-3112-4b0f-a91e-9ae7f6df4bf1",
"metadata": {},
"source": [
"$\\left( \\frac{\\partial \\rho}{\\partial p} \\right)_T$ is the reciprocal of the previous result."
]
},
{
"cell_type": "markdown",
"id": "65a985be-8683-46e7-b61c-c76f1ae56ead",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 203,
"id": "c6c9057e-63fb-4146-b180-491db37610e3",
"metadata": {},
"outputs": [],
"source": [
"dρdp = 1/dpdρ;"
]
},
{
"cell_type": "markdown",
"id": "8e736919-6048-49f4-bcda-0a7a0df0ced7",
"metadata": {},
"source": [
"The following is Eq. (11) from Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "4ff2f187-d97b-4400-9170-41d5dfbdbb6e",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 204,
"id": "7de7d593-dc78-41b0-80b2-a1499e157198",
"metadata": {},
"outputs": [],
"source": [
"χn = pc * ρ/ρc^2 * dρdp;"
]
},
{
"cell_type": "markdown",
"id": "161390f2-e57f-4571-8b2d-986ab75b43af",
"metadata": {},
"source": [
"Calculate some values to test this."
]
},
{
"cell_type": "code",
"execution_count": 205,
"id": "da2417cf-2734-4d89-aac3-9638be7e4030",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$0.100290882386026$"
],
"text/plain": [
"0.100290882386026"
]
},
"execution_count": 205,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χn(ρ => 15654, T => 309.162)"
]
},
{
"cell_type": "code",
"execution_count": 206,
"id": "054aa7b7-e0fd-48ed-bee0-6d78ff799edf",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.10029088238602606"
]
},
"execution_count": 206,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(χn(ρ => 15654, T => 309.162))"
]
},
{
"cell_type": "markdown",
"id": "81288e06-a53e-4342-8de1-980a88b8a6fe",
"metadata": {},
"source": [
"Compare the symbolic calculations above to values calculated by a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 207,
"id": "42d28ba7-83c6-44e5-8d2b-a2d4db6e2255",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1016422565742757"
]
},
"execution_count": 207,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lambdify(χn(T=>309.162), (ρ,))(15654)"
]
},
{
"cell_type": "code",
"execution_count": 208,
"id": "4f1c0920-03ae-4fe3-b3f1-042ee36dc025",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.100290882386026026561986816030949345798372149081095358519805036184306650964384"
]
},
"execution_count": 208,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lambdify(χn, (ρ,T))(BigFloat(\"15654.\"), BigFloat(\"309.162\"))"
]
},
{
"cell_type": "code",
"execution_count": 209,
"id": "170f427e-657c-4b4a-bc8f-1b7b0154ef2c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.10029088238602603"
]
},
"execution_count": 209,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"convert(Float64, lambdify(χn, (ρ,T))(BigFloat(\"15654.\"), BigFloat(\"309.162\")))"
]
},
{
"cell_type": "markdown",
"id": "1c0655d2-9ca9-46d2-8588-c829bc9cb406",
"metadata": {},
"source": [
"There is a significant loss in precision when we go to a Julia floating point calculation from the symbolic calculation. We are going to have to use BigFloat (extended precision) numbers in Julia for `χn` and the parameters that depend on it."
]
},
{
"cell_type": "markdown",
"id": "0550b2bc-b06f-4ef2-a489-f2fe254b6e17",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 210,
"id": "467f12b1-1d65-4609-9e45-64bc670fafef",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 210,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl = lambdify(χn, (ρ,T))"
]
},
{
"cell_type": "markdown",
"id": "5138994d-8a05-40e5-8325-84fb63f8644d",
"metadata": {},
"source": [
"Define some more needed parameters."
]
},
{
"cell_type": "code",
"execution_count": 211,
"id": "6994dcf7-c588-4772-95e0-10bd8e635dfc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.055"
]
},
"execution_count": 211,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Γ = 0.055"
]
},
{
"cell_type": "code",
"execution_count": 212,
"id": "44607a06-2d61-4c3c-9638-24cd7ee2746b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.63"
]
},
"execution_count": 212,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ν = 0.63"
]
},
{
"cell_type": "code",
"execution_count": 213,
"id": "f2ad6c36-68ed-47e8-8a53-d87ce4a027ff",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.2415"
]
},
"execution_count": 213,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γtc = 1.2415"
]
},
{
"cell_type": "code",
"execution_count": 214,
"id": "77541d43-2e17-4462-9c18-b23a8ee92681",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"309.162"
]
},
"execution_count": 214,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Tref = 309.162 # K"
]
},
{
"cell_type": "markdown",
"id": "14335809-8b38-4f93-8e4e-a1e93d02a963",
"metadata": {},
"source": [
"Compare some symbolic and Julia calculations to make sure everything is consistent."
]
},
{
"cell_type": "code",
"execution_count": 215,
"id": "5a58c5f2-82fc-4c1b-a189-58813041a6b8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.12908846305731383"
]
},
"execution_count": 215,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(χn(ρ => ρo2(ptab[end], Tcold), T => Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 216,
"id": "d42b71a1-a2de-4f83-abbc-ea78cb614b01",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1290884630573138707065711237495471618892319479222842391379867428471618969067207"
]
},
"execution_count": 216,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl(BigFloat(ρo2(ptab[end], Tcold)), BigFloat(Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 217,
"id": "38ff98dd-2aed-4a96-915d-aee48c08900c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1042176516484715"
]
},
"execution_count": 217,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(χn(ρ => ρo2(ptab[end], Tref), T => Tref))"
]
},
{
"cell_type": "code",
"execution_count": 218,
"id": "1f1866cc-19d5-43d0-9500-63b5b7815585",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1042176516484714596009724328089027645355496913660369305506133130603975957308881"
]
},
"execution_count": 218,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl(BigFloat(ρo2(ptab[end], Tref)), BigFloat(Tref))"
]
},
{
"cell_type": "markdown",
"id": "ac203dcb-24e4-4578-946a-a22071a83cd8",
"metadata": {},
"source": [
"The values above are consistent."
]
},
{
"cell_type": "markdown",
"id": "ebfd8775-021b-4c29-a562-5240075f81df",
"metadata": {},
"source": [
"This is Eq. (10) in Lemmon and Jacobsen [58]. We define it here as a symbolic function (which produces a SymPy expression)."
]
},
{
"cell_type": "code",
"execution_count": 219,
"id": "817ec05b-1ce3-4bbd-ab78-a31520afdf8b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ξ (generic function with 1 method)"
]
},
"execution_count": 219,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξ(ρ1, T1) = ξ0 * (((χn(ρ => ρ1, T => T1)) -\n",
" (χn(ρ => ρ1, T => Tref)) * (Tref/T1)) /\n",
" Γ)^(ν/γtc)"
]
},
{
"cell_type": "markdown",
"id": "b0485276-7b4d-46bd-a2cd-f4c6ade48b94",
"metadata": {},
"source": [
"Define a Julia function for this."
]
},
{
"cell_type": "code",
"execution_count": 220,
"id": "cc92451a-7939-4b52-9841-ea6aec427d0c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ξjl (generic function with 1 method)"
]
},
"execution_count": 220,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξjl(ρ1, T1) = ξ0 * (((χnjl(ρ1, T1)) - (χnjl(ρ1, Tref)) * (Tref/T1)) / Γ)^(ν/γtc)"
]
},
{
"cell_type": "markdown",
"id": "ec978ae8-408d-4c23-825e-13b333142b2e",
"metadata": {},
"source": [
"Compare symbolic and Julia floating point calculations."
]
},
{
"cell_type": "code",
"execution_count": 221,
"id": "c1c7d3f8-d100-4e6c-9c69-3400c5fe8b18",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.2906193451956456e-10"
]
},
"execution_count": 221,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(ξ(ρo2(ptab[end], Tcold), Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 222,
"id": "7c8af3c8-230a-48a2-a44a-11983867a308",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.2906193451956456e-10"
]
},
"execution_count": 222,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(ξ(ρo2tab[end]/MO2, Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 223,
"id": "3f1e2834-fc42-4f14-aaf3-7ca9d6d68660",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.2906193451956505e-10"
]
},
"execution_count": 223,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξjl(ρo2tab[end]/MO2, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "acce0949-e1c3-4a3c-8f7b-95d5f73448fa",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "e373d233-22af-41fb-9ff4-d167aaa4ba5b",
"metadata": {},
"source": [
"Define some more parameters."
]
},
{
"cell_type": "code",
"execution_count": 224,
"id": "43df66cc-023e-46c0-92f7-012c342eafa4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.01"
]
},
"execution_count": 224,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"R0 = 1.01"
]
},
{
"cell_type": "code",
"execution_count": 225,
"id": "e59934fc-aeca-4102-aeee-140524a10347",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.380658e-23"
]
},
"execution_count": 225,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"k = 1.380658e-23 # J/K"
]
},
{
"cell_type": "code",
"execution_count": 226,
"id": "2bbbc0c1-c6ce-4b3e-9025-2af0f1198297",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"5.1e-10"
]
},
"execution_count": 226,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"qD = 0.51e-9 # m"
]
},
{
"cell_type": "markdown",
"id": "dc3c6eb0-2fa5-47bd-aa37-c58d69030281",
"metadata": {},
"source": [
"The following is Eq. (8) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 227,
"id": "b84ebdb1-8d6c-4edd-83f7-a8689ead007d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ωn (generic function with 1 method)"
]
},
"execution_count": 227,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ωn(ρ1, T1) = (2/π * ((cp - cv) / cp * atan(ξ(ρ1, T1) /\n",
" qD) + cv / cp * ξ(ρ1, T1) / qD)(δ => ρ/ρc, \n",
" τ => Tc/T))(ρ => ρ1, T => T1)"
]
},
{
"cell_type": "markdown",
"id": "b287a335-d152-49e8-a2f0-93c0357fc215",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 228,
"id": "09fa0f1d-a21d-4fd2-a1f6-64cc7374cc5a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ωnjl (generic function with 1 method)"
]
},
"execution_count": 228,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ωnjl(ρ1, T1) = 2/π * ((cpjl(ρ1, T1) - cvjl(ρ1, T1)) / \n",
" cpjl(ρ1, T1) * atan(ξjl(ρ1, T1) /\n",
" qD) + cvjl(ρ1, T1) / cpjl(ρ1, T1) * ξjl(ρ1, T1) / qD)"
]
},
{
"cell_type": "markdown",
"id": "c51914dc-1d9b-4849-89a3-5462d082ddfe",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 229,
"id": "6316433b-710b-4a2c-a410-42eb05b349a5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1594910300518962"
]
},
"execution_count": 229,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(Ωn(ρo2tab[end]/MO2, Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 230,
"id": "cdbaf46c-d0b1-4678-b16f-58714a28497c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.15949103005189677"
]
},
"execution_count": 230,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ωnjl(ρo2tab[end]/MO2, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "883a63bf-1fff-4e1a-932a-77f0eb066e88",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "eafd6184-e10b-4b28-89fd-470f227d62a0",
"metadata": {},
"source": [
"The following is Eq. (9) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 231,
"id": "050c8477-1711-4fbc-b612-54b3c8225dab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ω0n (generic function with 1 method)"
]
},
"execution_count": 231,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω0n(ρ1, T1) = (2 / π * (1 - exp(-1 / ((ξ(ρ1, T1) /\n",
" qD)^-1 + 1/3 * (ξ(ρ1, T1) / qD)^2 * (ρc /\n",
" ρ)^2)))(δ => ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1)"
]
},
{
"cell_type": "markdown",
"id": "3c97be95-a585-47a8-8107-5bbb221598e7",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 232,
"id": "289cccc5-0636-4853-897b-1e84068c5a61",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ω0njl (generic function with 1 method)"
]
},
"execution_count": 232,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω0njl(ρ1, T1) = 2 / π * (1 - exp(-1 / ((ξjl(ρ1, T1) /\n",
" qD)^-1 + 1/3 * (ξjl(ρ1, T1) / qD)^2 * (ρc /\n",
" ρ1)^2)))"
]
},
{
"cell_type": "markdown",
"id": "349a5482-ec88-4b5b-afc1-009198945d9c",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 233,
"id": "13edcdeb-387c-4725-a019-c295dc908349",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.14182550739186106"
]
},
"execution_count": 233,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(Ω0n(ρo2tab[end]/MO2, Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 234,
"id": "78239818-2b27-46da-92a0-6ac434b0cad8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.14182550739186153"
]
},
"execution_count": 234,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω0njl(ρo2tab[end]/MO2, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "8abbcb8c-f06c-4f33-bb7f-9fca29fa9595",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "ff949d44-f644-41b2-aba4-39c7a7d306b2",
"metadata": {},
"source": [
"The following expression is Eq. (7) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 235,
"id": "68069189-8b91-4020-b0b3-8e5ffc676183",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λc (generic function with 1 method)"
]
},
"execution_count": 235,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λc(ρ1, T1) =\n",
" if (((χn(ρ => ρ1, T => T1)) - (χn(ρ => ρ1, T =>\n",
" Tref)) * (Tref / T1)) / Γ) > 0\n",
" ((ρ * cp * k * R0 * T1 / (6 * π * ξ(ρ1, T1) * η)\n",
" * (Ωn(ρ1, T1) - Ω0n(ρ1, T1)))(δ =>\n",
" ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1)\n",
" else\n",
" 0\n",
" end"
]
},
{
"cell_type": "markdown",
"id": "953cf8d4-c54e-474f-bce4-a2f31ecc2abc",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 236,
"id": "af5b121b-5c6d-408d-b606-c2ccae73aefc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λcjl (generic function with 1 method)"
]
},
"execution_count": 236,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function λcjl(ρ1, T1)\n",
" if ((χnjl(ρ1, T1) - (χnjl(ρ1, Tref)) * (Tref / T1)) / Γ) > 0\n",
" ρ1 * cpjl(ρ1, T1) * k * R0 * T1 / (6 * π * ξjl(ρ1, T1) * ηjl(ρ1, T1, MO2)) *\n",
" (Ωnjl(ρ1, T1) - Ω0njl(ρ1, T1))\n",
" else\n",
" 0\n",
" end\n",
"end"
]
},
{
"cell_type": "markdown",
"id": "7bfc707c-1d16-4229-8a79-70ede934da4d",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 237,
"id": "c94d2f18-b5fc-4008-884a-9acfa991fbe8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0005307032536702224121851763594323215540108757235491347020614663748715407872031297"
]
},
"execution_count": 237,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λc(ρo2tab[end]/MO2, Tcold)(M=>MO2))"
]
},
{
"cell_type": "code",
"execution_count": 238,
"id": "aa0a0db5-1d83-4c0f-9c75-61b5792a58a6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0005307032536702239"
]
},
"execution_count": 238,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λcjl(ρo2tab[end]/MO2, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "7a5168af-a65f-44fd-97d4-ab0fa0b817f0",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "dc2b805e-0482-439c-bccb-2c4643252521",
"metadata": {},
"source": [
"The following expression is Eq. (4) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 239,
"id": "d8df7ac5-f7f1-4736-b449-01d27fe99820",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λ (generic function with 1 method)"
]
},
"execution_count": 239,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ(ρ1, T1) = ((λ0 + λr + λc(ρ1, T1))(δ => ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1, M => MO2)"
]
},
{
"cell_type": "markdown",
"id": "a2774a73-fd52-4856-8fa5-bc66c479bbf1",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 240,
"id": "963969a0-4853-4bcf-bdf4-5ef46aed5fc1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λjl (generic function with 1 method)"
]
},
"execution_count": 240,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(ρ1, T1) = λ0jl(T1, MO2) + λrjl(ρ1, T1) + λcjl(ρ1, T1)"
]
},
{
"cell_type": "markdown",
"id": "97a0743f-eecb-4daa-9e79-8faec713c6be",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 241,
"id": "2aa90c68-d857-4aa2-9517-68e444c872cb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.05275295544451043311678204617381422587556138588676864015658200658423711192827348"
]
},
"execution_count": 241,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(ρo2tab[end]/MO2, Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 242,
"id": "b7df0538-fa2a-4551-a442-a92d3fb1452b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.05275295544451044"
]
},
"execution_count": 242,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(ρo2tab[end]/MO2, Tcold)"
]
},
{
"cell_type": "code",
"execution_count": 243,
"id": "8782bb73-6af3-4674-a50d-268aeacea77b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.05275295544451043509704043029688305700266487799056164517991671856937071866581793"
]
},
"execution_count": 243,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(ρo2tab[end]/MO2), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "12698029-8e22-4c00-935d-7d7e8169749e",
"metadata": {},
"source": [
"The values calculated above are consistent, but for more extreme parameters, we must use BigFloat (extended precision) number in the Julia calculations to get accurate results."
]
},
{
"cell_type": "markdown",
"id": "6f739114-321e-4863-9863-5354eba33f4f",
"metadata": {},
"source": [
"Compare some more symbolic and Julia values."
]
},
{
"cell_type": "code",
"execution_count": 244,
"id": "62330708-73f3-47a6-ad96-04400d197eb8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03254908818967474527217772266910616929800924469022653190021984020531302503726771"
]
},
"execution_count": 244,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(5000, 300))"
]
},
{
"cell_type": "code",
"execution_count": 245,
"id": "88f76619-95b5-4653-a519-160636289ed4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03254908818967474923525688827693130137820666067563214119394719831883702827282174"
]
},
"execution_count": 245,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(5000), BigFloat(300))"
]
},
{
"cell_type": "code",
"execution_count": 246,
"id": "47531051-a053-43c8-b816-cafeaf5de83d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03461241590178412955177322207379064297480321993063979135320308086933230717146617"
]
},
"execution_count": 246,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(10000, 200))"
]
},
{
"cell_type": "code",
"execution_count": 247,
"id": "4e06d552-3f1f-486e-b41f-1f462f9d01b5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03461241590178412218480262266138182109795267078112565253196592982886843787454069"
]
},
"execution_count": 247,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(10000), BigFloat(200))"
]
},
{
"cell_type": "code",
"execution_count": 248,
"id": "abf4adae-f130-40e7-ad72-f50547d15247",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"41.60020299418699"
]
},
"execution_count": 248,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρatm = ρo2(1.01325e5, 293.15)"
]
},
{
"cell_type": "code",
"execution_count": 249,
"id": "db43efbc-ee02-4e0e-91e1-ee4e30f9c7a0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02594592656359142167630243773140047580961416258065686902916156220190957099328145"
]
},
"execution_count": 249,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(ρatm, 293.15))"
]
},
{
"cell_type": "markdown",
"id": "865fd856-cc10-418d-ab95-9ed3e3338349",
"metadata": {},
"source": [
"Now produce some values to compare to Table V in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 250,
"id": "d3dd593c-aae0-42cb-89d9-12860bdb363a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02644030136501699452922266443490837771838501883746281015205665801569690013074298"
]
},
"execution_count": 250,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(0, 300))"
]
},
{
"cell_type": "code",
"execution_count": 251,
"id": "673a098f-4e12-4e36-b2d9-5e1b42833d1d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02644030136501699836528937081846066263194926765021006054746710978287985093940115"
]
},
"execution_count": 251,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(0), BigFloat(300))"
]
},
{
"cell_type": "code",
"execution_count": 252,
"id": "de51a1f7-a6b9-422d-85b7-53cd18098a09",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.008943340238199923166633864347394669058215070422100077280135001759203942532086278"
]
},
"execution_count": 252,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(0, 100))"
]
},
{
"cell_type": "code",
"execution_count": 253,
"id": "70967ad8-39ba-4c8f-8206-16a01d86e7a2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.008943340238199925337625265804124263106635902622932240632661182972401388976083374"
]
},
"execution_count": 253,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(0), BigFloat(100))"
]
},
{
"cell_type": "code",
"execution_count": 254,
"id": "0fae257d-39aa-4381-997a-54514c6baede",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1460436565562084522483961122172414293535465485409965616551350017592039425320859"
]
},
"execution_count": 254,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(35000, 100))"
]
},
{
"cell_type": "code",
"execution_count": 255,
"id": "9a9dadec-1a8e-4b69-a1d4-42e4f818812f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1460436565562084438235107534813359791835200809516249064342509686393078234564082"
]
},
"execution_count": 255,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(35000), BigFloat(100))"
]
},
{
"cell_type": "code",
"execution_count": 256,
"id": "743a06b8-cf8e-482c-8b17-6260f49c76fe",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03461241590178412955177322207379064297480321993063979135320308086933230717146617"
]
},
"execution_count": 256,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(10000, 200))"
]
},
{
"cell_type": "code",
"execution_count": 257,
"id": "a40d1b80-8df0-4663-b6d8-474ab1c7fa75",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03461241590178412218480262266138182109795267078112565253196592982886843787454069"
]
},
"execution_count": 257,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(10000), BigFloat(200))"
]
},
{
"cell_type": "code",
"execution_count": 258,
"id": "388d21d9-a031-4f4b-be49-93225875b328",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3774932839211806141737289280088801301302537832168264321261673664573873505761132"
]
},
"execution_count": 258,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(13600, 154.6))"
]
},
{
"cell_type": "code",
"execution_count": 259,
"id": "9377a922-de35-4b70-9c14-d01357f23655",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.3774932839200583716257450053512241709322229302900247225512449387305665682685319"
]
},
"execution_count": 259,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(13600), BigFloat(154.6))"
]
},
{
"cell_type": "markdown",
"id": "b720f020-2a39-49fd-90e6-90b5865c2512",
"metadata": {},
"source": [
"These values are consistent."
]
},
{
"cell_type": "markdown",
"id": "d76323b7-89d9-47be-83ec-65046933f22f",
"metadata": {},
"source": [
"Produce a Julia function of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 260,
"id": "72854def-3149-411e-8955-57241602e3b4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λo2pT (generic function with 1 method)"
]
},
"execution_count": 260,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2pT(p1, T1) = λjl(ρo2(p1, T1), T1)"
]
},
{
"cell_type": "markdown",
"id": "82a21212-1361-4ea1-856c-388e7b5b5408",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 261,
"id": "7332e1c0-5f4b-4b06-83fe-a37c880021ce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02594592656359142550146168737947547639246968817126879396255471323137710350194719"
]
},
"execution_count": 261,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2pT(BigFloat(ptab[1]), BigFloat(Ts))"
]
},
{
"cell_type": "markdown",
"id": "6eaceb60-da56-4699-904a-e91d839fdf70",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 262,
"id": "8123ba3c-5e38-4b3a-a502-977af5c83d90",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02447049831477466100267401275217865127526345125832720400382947752394809026362071"
]
},
"execution_count": 262,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2pT(BigFloat(ptab[1]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "1888c39d-9157-4441-b7f8-c3798d1ce337",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 263,
"id": "c479efe2-6c39-4f77-aa16-17033bc2e4b2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03037740010405363402520366412784942902038243947241342958815381578620640920539184"
]
},
"execution_count": 263,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2pT(BigFloat(ptab[1001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "d92249f1-510d-4f09-bd86-dc6fe6c5bbc5",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 264,
"id": "3632e142-ab4e-44cd-985a-b2dee26b0074",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03889394240824920359897757890768218657517236360308829831696300672957476739184674"
]
},
"execution_count": 264,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2pT(BigFloat(ptab[2001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "a635cace-e1df-4aec-8bcc-a677d51040c1",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 265,
"id": "8472b2b7-b79d-46ba-ad55-e64712a11d59",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.05275295544451042785000069206250406724958921915540248319033116260649915233325096"
]
},
"execution_count": 265,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2pT(BigFloat(ptab[end]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "99a9aedd-5abc-46f2-853c-24e9b2f02a67",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 266,
"id": "f58d3366-09cf-4f53-b3a7-c2e71b61b770",
"metadata": {},
"outputs": [],
"source": [
"λo2tab = map(p -> convert(Float64, λo2pT(BigFloat(p), BigFloat(Tcold))), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 267,
"id": "4f76e98b-e3dd-417a-9be0-5bcbe8d3b749",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.02447049831477466, 0.030377400104053633, 0.038893942408249206, 0.052752955444510426)"
]
},
"execution_count": 267,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λo2tab[1], λo2tab[1001], λo2tab[2001], λo2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "22f79172-ee86-403c-b7c5-e271e2b826fd",
"metadata": {},
"source": [
"#### 5.1.8. Thermal Diffusivity"
]
},
{
"cell_type": "markdown",
"id": "b5c9bac8-cc08-4b96-8150-8f5427ab2bd9",
"metadata": {},
"source": [
"Use the thermal diffusivity definition in Ainslie and Leighton [1]."
]
},
{
"cell_type": "code",
"execution_count": 268,
"id": "41e1fdbc-9c3f-4038-a3af-f79da4b18770",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"α (generic function with 1 method)"
]
},
"execution_count": 268,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"α(ρ1, T1) = ((λ(ρ1, T1) / (ρ1 * cp))(δ => ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1, M => MO2)"
]
},
{
"cell_type": "markdown",
"id": "2cf970ed-b681-4f89-9373-e817891ed2b2",
"metadata": {},
"source": [
"Calculate a value. Recall that the `ρo2tab` array is a mass density. We must divide it by molar mass `MO2` to get molar density."
]
},
{
"cell_type": "code",
"execution_count": 269,
"id": "2f2b491c-93af-4b8e-b6a1-5387b442dd9a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.48721949540435454051145588758847426971599006032218430054735763972069438917396e-08"
]
},
"execution_count": 269,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(α(ρo2tab[end]/MO2, Tcold))"
]
},
{
"cell_type": "markdown",
"id": "f05be5e2-fba7-4865-a4be-0d92004e6584",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 270,
"id": "415d177f-0a17-41df-b2ec-17963aa1316d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"αjl (generic function with 1 method)"
]
},
"execution_count": 270,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αjl(ρ1, T1) = λjl(ρ1, T1) / (ρ1 * cpjl(ρ1, T1))"
]
},
{
"cell_type": "code",
"execution_count": 271,
"id": "f9a04407-3b20-413a-b4d0-68212459b9d1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.487219495404364329811396921172735904625033812475985565163462702756592086379079e-08"
]
},
"execution_count": 271,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αjl(BigFloat(ρo2tab[end]/MO2), BigFloat(Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 272,
"id": "99d66e37-9ca4-4cb0-8fc8-4d9fd36d4707",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"αo2pT (generic function with 1 method)"
]
},
"execution_count": 272,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(p1, T1) = αjl(ρo2(p1, T1), T1)"
]
},
{
"cell_type": "code",
"execution_count": 273,
"id": "5ec37a59-74f1-4929-9aa3-e59ca3baa767",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.487219495404364865532554975198480907690881770854359231836399180562323383626429e-08"
]
},
"execution_count": 273,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(BigFloat(ptab[end]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "82fcfca1-84d3-4f0c-8702-9c591534a788",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 274,
"id": "93990832-a941-4a28-8f7a-493d803f786f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.120985841493112653296219166693105071621395430111438146683085448897844454307706e-05"
]
},
"execution_count": 274,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(BigFloat(ptab[1]), BigFloat(Ts))"
]
},
{
"cell_type": "markdown",
"id": "c86d3a8c-ee18-4835-b912-aae53a475774",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 275,
"id": "f5fe3d60-1cdd-4cba-a666-3eebcd197a35",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.877973098323995278124008176810104328920435150793272695302657778424528852338461e-05"
]
},
"execution_count": 275,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(BigFloat(ptab[1]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "c6a3c759-0e56-4ffe-8039-de136be7c50b",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 276,
"id": "8063765a-efda-44f6-b8e3-8d2ef09fba0a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.719742443384715854418450771641508186342003600288733110583327019015409320791956e-07"
]
},
"execution_count": 276,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(BigFloat(ptab[1001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "eb96f183-f584-4b82-b9f9-c9d56d165fb7",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 277,
"id": "8a14ac8c-9132-4cb0-87a6-8ab6353accd7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9.264192554939795735130225941054086882870839425383077380518022707172419462590197e-08"
]
},
"execution_count": 277,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(BigFloat(ptab[2001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "c40081e5-c0c9-42ab-833b-db4f90ececee",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 278,
"id": "7b5d282e-1132-456a-b0cb-9ef73d2bfd99",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"7.487219495404364865532554975198480907690881770854359231836399180562323383626429e-08"
]
},
"execution_count": 278,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2pT(BigFloat(ptab[end]), BigFloat(Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 279,
"id": "c7982066-95a6-486b-a92e-3642c222098b",
"metadata": {},
"outputs": [],
"source": [
"αo2tab = map(p -> convert(Float64, αo2pT(BigFloat(p), BigFloat(Tcold))), \n",
" ptab);"
]
},
{
"cell_type": "code",
"execution_count": 280,
"id": "bca8816f-3029-4b61-ad92-f5cd996ad57c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.8779730983239953e-5, 1.7197424433847157e-7, 9.264192554939795e-8, 7.487219495404365e-8)"
]
},
"execution_count": 280,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αo2tab[1], αo2tab[1001], αo2tab[2001], αo2tab[end]"
]
},
{
"cell_type": "code",
"execution_count": 281,
"id": "e21f3340-75e5-4567-b7dc-d54ab9cc3e94",
"metadata": {},
"outputs": [],
"source": [
"valso2.thermal_diffusivity = αo2tab;"
]
},
{
"cell_type": "markdown",
"id": "820f6c3b-5a01-48c1-9ff5-21cd0d16b203",
"metadata": {},
"source": [
"#### 5.1.9. Export Oxygen Parameters"
]
},
{
"cell_type": "markdown",
"id": "47336524-76d4-42f3-938c-ce30f00920b1",
"metadata": {},
"source": [
"We have all the needed oxygen parameters in `valso2`. Export them to a CSV file."
]
},
{
"cell_type": "markdown",
"id": "a17ff062-4458-42fc-839b-a681fda77b6b",
"metadata": {},
"source": [
"Here are the column names."
]
},
{
"cell_type": "code",
"execution_count": 282,
"id": "47712727-feb9-4a7d-93c9-b1be89c2bb86",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8-element Vector{String}:\n",
" \"depth\"\n",
" \"pressure\"\n",
" \"water_density\"\n",
" \"water_dyn_viscosity\"\n",
" \"water_surface_tension\"\n",
" \"water_sound_speed\"\n",
" \"gamma\"\n",
" \"thermal_diffusivity\""
]
},
"execution_count": 282,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"names(valso2)"
]
},
{
"cell_type": "markdown",
"id": "e3a5cc9e-34d2-4748-bd90-5fdb67efa0ed",
"metadata": {},
"source": [
"Reorder the dataframe columns to match the order that the acoustic calculations require."
]
},
{
"cell_type": "code",
"execution_count": 283,
"id": "50f0c158-d69b-4055-8f5a-66e5a8849d3c",
"metadata": {},
"outputs": [],
"source": [
"select!(valso2, [\"depth\", \"water_density\", \"pressure\", \"water_dyn_viscosity\", \n",
" \"water_surface_tension\", \"water_sound_speed\", \n",
" \"thermal_diffusivity\", \"gamma\"]);"
]
},
{
"cell_type": "code",
"execution_count": 284,
"id": "07c7bace-480f-49fe-b7ec-3712d4344a2f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"DeepWaterPropertiesO2.csv\""
]
},
"execution_count": 284,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CSV.write(\"DeepWaterPropertiesO2.csv\", valso2)"
]
},
{
"cell_type": "markdown",
"id": "e1f26e11-f016-483a-950d-98aa4522c67a",
"metadata": {
"tags": []
},
"source": [
"### 5.2. Nitrogen"
]
},
{
"cell_type": "markdown",
"id": "22217f0f-c686-4dc6-ae71-2b592eadcd32",
"metadata": {},
"source": [
"We calculate nitrogen densities, heat capacities, and sound speeds using the relationships from Span *et al.* [55]. We calculate thermal conductivities using the relationships in Lemmon and Jacobsen [58]. We calculate thermal diffusivities using the relationship in Ainslie and Leighton [1]."
]
},
{
"cell_type": "markdown",
"id": "3f40f6c0-4cc3-4a76-bb21-93e1113eb609",
"metadata": {},
"source": [
"Define some gas parameters from Span *et al.* [55]. "
]
},
{
"cell_type": "markdown",
"id": "10a01327-3308-44ef-9a99-d54b76e51fc1",
"metadata": {},
"source": [
"Make sure `R` is defined."
]
},
{
"cell_type": "code",
"execution_count": 285,
"id": "afb20e74-dc63-476e-9ffd-ece7a6e9fa19",
"metadata": {},
"outputs": [],
"source": [
"R = 8.314510; # J mol^-1 K^-1, universal gas constant"
]
},
{
"cell_type": "code",
"execution_count": 286,
"id": "9afff949-d05b-4413-bc5d-4c5bc659db30",
"metadata": {},
"outputs": [],
"source": [
"MN2 = 28.01348/1000; # kg, nitrogen molar mass"
]
},
{
"cell_type": "markdown",
"id": "5931a554-512f-4f4a-a1be-1a1474b98494",
"metadata": {},
"source": [
"Define variables used in symbolic calculations."
]
},
{
"cell_type": "code",
"execution_count": 287,
"id": "00c83778-e048-4f91-9d8c-8f077d2574b2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(δ, τ, ρ, T, M)"
]
},
"execution_count": 287,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"@vars δ τ ρ T M"
]
},
{
"cell_type": "markdown",
"id": "ecf92ade-9fde-45fc-b756-2ea7a22a8a97",
"metadata": {},
"source": [
"Define the coefficients for Eq. (53) in Span *et al.* [55]."
]
},
{
"cell_type": "code",
"execution_count": 288,
"id": "3ee06879-cd17-4006-bcae-7b826013c491",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(2.5, -12.76952708, -0.00784163, -0.0001934819, -1.247742e-5, 6.678326e-8, 1.012941, 26.65788)"
]
},
"execution_count": 288,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = (2.5, -12.76952708, -0.00784163, -1.934819e-4, -1.247742e-5,\n",
" 6.678326e-8, 1.012941, 26.65788)"
]
},
{
"cell_type": "markdown",
"id": "f827a9a0-1442-418c-aa64-787fcf69e276",
"metadata": {},
"source": [
"This is Eq. (53) in Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "28bfa792-944e-42f5-8c82-baec522ae275",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 289,
"id": "c8035a27-c342-4049-9a7c-67a6c2c00905",
"metadata": {},
"outputs": [],
"source": [
"α0 = log(δ) + a[1] * log(τ) + a[2] + a[3] * τ + \n",
" a[4] * τ^-1 + a[5] * τ^-2 + a[6] * τ^-3 + \n",
" a[7] * log(1 - exp(-a[8] * τ));"
]
},
{
"cell_type": "markdown",
"id": "3e396b53-b26a-4234-b768-153b9260d97a",
"metadata": {},
"source": [
"The following parameters are from Table 17 in Span *et al.* [55]."
]
},
{
"cell_type": "code",
"execution_count": 290,
"id": "9fbdc1a6-8012-4b2c-a472-ae390716723d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.924803575275, -0.492448489428, 0.661883336938, -1.92902649201, -0.0622469309629, 0.349943957581, 0.564857472498, -1.61720005987, -0.481395031883, 0.421150636384, -0.0161962230825, 0.172100994165, 0.00735448924933, 0.0168077305479, -0.00107626664179, -0.0137318088513, 0.000635466899859, 0.00304432279419, -0.0435762336045, -0.0723174889316, 0.0389644315272, -0.021220136391, 0.00408822981509, -5.51990017948e-5, -0.0462016716479, -0.00300311716011, 0.0368825891208, -0.0025585684622, 0.00896915264558, -0.0044151337035, 0.00133722924858, 0.000264832491957, 19.6688194015, -20.911560073, 0.0167788306989, 2627.67566274)"
]
},
"execution_count": 290,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nk = (0.924803575275, -0.492448489428, 0.661883336938,\n",
" -0.192902649201e1, -0.622469309629e-1, 0.349943957581,\n",
" 0.564857472498, -0.161720005987e1, -0.481395031883,\n",
" 0.421150636384, -0.161962230825e-1, 0.172100994165,\n",
" 0.735448924933e-2, 0.168077305479e-1, -0.107626664179e-2,\n",
" -0.137318088513e-1, 0.635466899859e-3, 0.304432279419e-2,\n",
" -0.435762336045e-1, -0.723174889316e-1, 0.389644315272e-1,\n",
" -0.212201363910e-1, 0.408822981509e-2, -0.551990017948e-4,\n",
" -0.462016716479e-1, -0.300311716011e-2, 0.368825891208e-1,\n",
" -0.255856846220e-2, 0.896915264558e-2, -0.441513370350e-2,\n",
" 0.133722924858e-2, 0.264832491957e-3, 0.196688194015e2,\n",
" -0.209115600730e2, 0.167788306989e-1, 0.262767566274e4)"
]
},
{
"cell_type": "code",
"execution_count": 291,
"id": "7446d41c-777f-47b6-9f23-949b1b7a4fc3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 1, 2, 2, 3, 3, 1, 1, 1, 3, 3, 4, 6, 6, 7, 7, 8, 8, 1, 2, 3, 4, 5, 8, 4, 5, 5, 8, 3, 5, 6, 9, 1, 1, 3, 2)"
]
},
"execution_count": 291,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ik = (1, 1, 2, 2, 3, 3, 1, 1, 1, 3, 3, 4, 6, 6, 7, 7, 8, 8, 1, 2, 3,\n",
" 4, 5, 8, 4, 5, 5, 8, 3, 5, 6, 9, 1, 1, 3, 2)"
]
},
{
"cell_type": "code",
"execution_count": 292,
"id": "061575b7-780a-4144-89e0-6ba54fb4714b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.25, 0.875, 0.5, 0.875, 0.375, 0.75, 0.5, 0.75, 2, 1.25, 3.5, 1, 0.5, 3, 0, 2.75, 0.75, 2.5, 4, 6, 6, 3, 3, 6, 16, 11, 15, 12, 12, 7, 4, 16, 0, 1, 2, 3)"
]
},
"execution_count": 292,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"jk = (0.25, 0.875, 0.5, 0.875, 0.375, 0.75, 0.5, 0.75, 2, 1.25, 3.5,\n",
" 1, 0.5, 3, 0, 2.75, 0.75, 2.5, 4, 6, 6, 3, 3, 6, 16, 11, 15, 12,\n",
" 12, 7, 4, 16, 0, 1, 2, 3)"
]
},
{
"cell_type": "code",
"execution_count": 293,
"id": "481f8303-252b-48df-a478-5f5a087d119a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 2, 2, 2, 2)"
]
},
"execution_count": 293,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lk = (0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,\n",
" 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 2, 2, 2, 2)"
]
},
{
"cell_type": "markdown",
"id": "6dc6f031-2336-4082-99e2-8aed31dbc9b6",
"metadata": {},
"source": [
"The following parameters are from Table 18 in Span *et al.* [55]. The first $\\phi$, $\\beta$, and $\\gamma$ indices in the equation are each 33. these are the first terms below."
]
},
{
"cell_type": "code",
"execution_count": 294,
"id": "b0bd02e1-72ad-480d-91e4-96f49f8c95e5",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"(20, 20, 15, 25)"
]
},
"execution_count": 294,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ϕk = (20, 20, 15, 25)"
]
},
{
"cell_type": "code",
"execution_count": 295,
"id": "0a2dedeb-85a7-493f-8408-0ccd343a6e37",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(325, 325, 300, 275)"
]
},
"execution_count": 295,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"βk = (325, 325, 300, 275)"
]
},
{
"cell_type": "code",
"execution_count": 296,
"id": "1305f477-fb2d-46fc-aad4-77d4d6a1393b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.16, 1.16, 1.13, 1.25)"
]
},
"execution_count": 296,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γk = (1.16, 1.16, 1.13, 1.25)"
]
},
{
"cell_type": "markdown",
"id": "748092e3-7870-4c25-a299-88952cd9a7bd",
"metadata": {},
"source": [
"This is Eq (55) from Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "1c0751ad-9709-47c2-8c45-7a23691f3845",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 297,
"id": "85e47e96-a133-481a-a093-d277485d468e",
"metadata": {},
"outputs": [],
"source": [
"αr = sum(nk[k] * δ^ik[k] * τ^jk[k] for k in 1:6) +\n",
" sum(nk[k] * δ^ik[k] * τ^jk[k] * exp(-δ^lk[k])\n",
" for k in 7:32) + sum(nk[k] * δ^ik[k] * τ^jk[k] *\n",
" exp(-ϕk[k - 32] * (δ - 1)^2 - βk[k - 32] * (τ -\n",
" γk[k - 32])^2) for k in 33:36);"
]
},
{
"cell_type": "markdown",
"id": "a38c1075-65c0-42e0-ab8d-c2c9294dc075",
"metadata": {},
"source": [
"Define the critical temperature and density."
]
},
{
"cell_type": "code",
"execution_count": 298,
"id": "a971686e-a359-4b18-9204-d98585204dc3",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"Tc = 126.192; # K"
]
},
{
"cell_type": "code",
"execution_count": 299,
"id": "6029ea16-b153-4be7-8f27-d325d83a6652",
"metadata": {},
"outputs": [],
"source": [
"ρc = 11.1839e3; # mol/m^3"
]
},
{
"cell_type": "markdown",
"id": "cd31e5a9-29dc-4345-9ff0-a03a6bf069bb",
"metadata": {},
"source": [
"#### 5.2.1. Density"
]
},
{
"cell_type": "markdown",
"id": "3fe145b6-6832-47c0-8bc1-8514df3d684f",
"metadata": {},
"source": [
"This is Eq. (56) from Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "585555a0-2b54-44b9-a080-0c5001bb2469",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 300,
"id": "67aa61bf-dbe5-4667-b8cb-e3edbfbfe9dd",
"metadata": {},
"outputs": [],
"source": [
"ρeq = Eq(p, ρ * R * T * (1 + δ * diff(αr, δ))(δ => ρ/ρc, τ => Tc/T));"
]
},
{
"cell_type": "markdown",
"id": "22aefa4c-301a-404c-a158-6bb88edba3c3",
"metadata": {},
"source": [
"Create a Julia function that we can use to find roots numerically."
]
},
{
"cell_type": "code",
"execution_count": 301,
"id": "73cdc3a1-2ef8-4744-b038-9bb2b6a91e81",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 301,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρeqjl = lambdify(lhs(ρeq) - rhs(ρeq), (p, T, ρ))"
]
},
{
"cell_type": "markdown",
"id": "73822116-4039-4da9-a5e0-c321bae66d96",
"metadata": {},
"source": [
"Now create a function that numerically finds a root for the density at a given value of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 302,
"id": "4fe83df4-ffdf-4e3a-8803-9adbbb9cb256",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ρn2 (generic function with 2 methods)"
]
},
"execution_count": 302,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(p, T, ρ0=24000.0) = find_zero(ρ1 -> ρeqjl(p, T, ρ1), ρ0)"
]
},
{
"cell_type": "markdown",
"id": "7346f338-d46d-443b-ab52-a063a05ff52a",
"metadata": {},
"source": [
"Now compare to densities from Span *et al.* [55] N2 data. Find the density at $p = 75$ Mbar ($750 \\times 10^5$ Pa) and $T = 270$ K."
]
},
{
"cell_type": "code",
"execution_count": 303,
"id": "d26393be-cb44-49db-850b-a394da457d88",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"19395.841644638156"
]
},
"execution_count": 303,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(750e5, 270)"
]
},
{
"cell_type": "markdown",
"id": "2e272e7a-5d0b-4ec2-abbd-ea4a02e96949",
"metadata": {},
"source": [
"Now find the density at $p = 75$ Mbar ($750 \\times 10^5$ Pa) and $T = 300$ K."
]
},
{
"cell_type": "code",
"execution_count": 304,
"id": "27e14434-42b8-4927-9925-ff196b6f0c63",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"18053.5804495223"
]
},
"execution_count": 304,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(750e5, 300)"
]
},
{
"cell_type": "markdown",
"id": "c0bd3003-496c-4ab5-9ffe-3dcf2fae34cc",
"metadata": {},
"source": [
"These values are consistent."
]
},
{
"cell_type": "markdown",
"id": "ff27f3df-0370-4066-85b0-690a4d7a1c11",
"metadata": {},
"source": [
"Warm surface values"
]
},
{
"cell_type": "code",
"execution_count": 305,
"id": "b3e7f059-c52c-49da-82c4-f8a78eb96a8f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"41.58105951222148"
]
},
"execution_count": 305,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[1], Ts)"
]
},
{
"cell_type": "code",
"execution_count": 306,
"id": "080cc3f3-01b6-4d83-ad34-66a8560d66bd",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"1.1648301790244262"
]
},
"execution_count": 306,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[1], Ts) * MN2"
]
},
{
"cell_type": "markdown",
"id": "5129d4d4-9bac-492e-832d-8629103b949e",
"metadata": {},
"source": [
"Cold surface values"
]
},
{
"cell_type": "code",
"execution_count": 307,
"id": "35ffc161-2383-49fb-a2ca-d30678e3727d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"44.39057228867911"
]
},
"execution_count": 307,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[1], Tcold)"
]
},
{
"cell_type": "code",
"execution_count": 308,
"id": "8245b378-f3fa-4738-917a-8b7ea2104c26",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"1.2435344089974665"
]
},
"execution_count": 308,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[1], Tcold) * MN2"
]
},
{
"cell_type": "markdown",
"id": "ee36dbfa-977f-41ec-9b51-affb31a76dcc",
"metadata": {},
"source": [
"Values at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 309,
"id": "d27382f8-dbfc-455c-8bfa-5d2496e7e8ce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4524.56749585226"
]
},
"execution_count": 309,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[1001], Tcold)"
]
},
{
"cell_type": "code",
"execution_count": 310,
"id": "46e6d576-38d5-45b7-902b-9ba4fd4f22ac",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"126.74888105370738"
]
},
"execution_count": 310,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[1001], Tcold) * MN2"
]
},
{
"cell_type": "markdown",
"id": "1f02f960-b264-47ec-b4fb-41c07656d39a",
"metadata": {},
"source": [
"Values at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 311,
"id": "ab5e50ee-a080-4257-b6ba-ee87028b49b6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8578.084713569095"
]
},
"execution_count": 311,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[2001], Tcold)"
]
},
{
"cell_type": "code",
"execution_count": 312,
"id": "659fe03f-5e5c-42b8-bcb1-74887684e49c",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"240.30200456187356"
]
},
"execution_count": 312,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[2001], Tcold) * MN2"
]
},
{
"cell_type": "markdown",
"id": "53b35512-5e4c-4484-9b6c-03898397dd57",
"metadata": {},
"source": [
"Deep water values"
]
},
{
"cell_type": "code",
"execution_count": 313,
"id": "53493cae-e461-4750-ab6a-31c08b3cf622",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"13047.278015394078"
]
},
"execution_count": 313,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[end], Tcold)"
]
},
{
"cell_type": "code",
"execution_count": 314,
"id": "69e2ca9b-9b3b-4b25-942a-532c329d558f",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"365.4996617386817"
]
},
"execution_count": 314,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2(ptab[end], Tcold) * MN2"
]
},
{
"cell_type": "markdown",
"id": "41822455-f089-49b5-aaaf-27719a5d32f5",
"metadata": {},
"source": [
"Now tabulate mass density values for the depth profile by multiplying each molar density by the molar mass."
]
},
{
"cell_type": "code",
"execution_count": 315,
"id": "aad76819-74a3-4e21-b5ba-60a6a5b48dbf",
"metadata": {},
"outputs": [],
"source": [
"ρn2tab = map(p1 -> ρn2(p1, Tcold) * MN2, ptab);"
]
},
{
"cell_type": "code",
"execution_count": 316,
"id": "404c4cd9-2b2d-45f0-b09a-c04addf31768",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.2435344089974665, 126.74888105370738, 240.30200456187356, 365.4996617386817)"
]
},
"execution_count": 316,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρn2tab[1], ρn2tab[1001], ρn2tab[2001], ρn2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "1c8d493e-d8d8-4cff-b5be-ff3572888257",
"metadata": {
"tags": []
},
"source": [
"#### 5.2.2. Isochoric Heat Capacity $c_v$"
]
},
{
"cell_type": "markdown",
"id": "4f226931-9b53-4fba-afd4-6382cc828e8b",
"metadata": {},
"source": [
"The following is Eq. (62) from Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "c9c4fc88-32d4-413a-9b30-603cb15309b2",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 317,
"id": "65c27fb1-c9c3-4556-b410-f776333f218c",
"metadata": {},
"outputs": [],
"source": [
"cv = -τ^2 * (diff(α0, τ, 2) + diff(αr, τ, 2)) * R;"
]
},
{
"cell_type": "markdown",
"id": "3330550c-d01e-4a41-9539-7c8eda160b2c",
"metadata": {},
"source": [
"Define a Julia function for calculations."
]
},
{
"cell_type": "code",
"execution_count": 318,
"id": "86ca3b87-ae89-493c-a813-99224aa8cf5e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 318,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvjl = lambdify(cv(δ => ρ/ρc, τ => Tc/T),(ρ, T))"
]
},
{
"cell_type": "markdown",
"id": "7df587e4-e305-45ce-85fe-2511b432de19",
"metadata": {},
"source": [
"Define a function of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 319,
"id": "a7acc7b8-b585-478e-b899-3d3b082a296b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"cvpTn2 (generic function with 1 method)"
]
},
"execution_count": 319,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(p, T) = cvjl(ρn2(p, T), T)"
]
},
{
"cell_type": "markdown",
"id": "edeaccd3-e83e-4c11-bfbc-35f9a6493168",
"metadata": {},
"source": [
"Calculate some values and compare with Span *et al.* [55]."
]
},
{
"cell_type": "code",
"execution_count": 320,
"id": "22fbaf3e-bad0-4145-a722-6848f916d352",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20.82243462328305"
]
},
"execution_count": 320,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(0.2e6, 290)"
]
},
{
"cell_type": "code",
"execution_count": 321,
"id": "1dcf0eb6-a17f-4d7f-a030-8255c6f0e409",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"23.810136385096367"
]
},
"execution_count": 321,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(75e6, 270)"
]
},
{
"cell_type": "markdown",
"id": "0484c3f0-32c0-4b47-9eec-0877b5dabea9",
"metadata": {},
"source": [
"These values are consistent."
]
},
{
"cell_type": "markdown",
"id": "2ae54882-a92a-4111-a594-02a7e24754f2",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 322,
"id": "c251d54c-1801-4a3c-8b7a-332fc1377395",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20.81602794850762"
]
},
"execution_count": 322,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(ptab[1], Ts)"
]
},
{
"cell_type": "markdown",
"id": "4d788c0c-b53b-44c5-a94e-e88f5fb19654",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 323,
"id": "39e15b43-22c5-4c5e-9748-29b8f42b2976",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20.81106217231203"
]
},
"execution_count": 323,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(ptab[1], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "4f2de016-2c5a-4942-8b83-83381bee8a8e",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 324,
"id": "eb107167-031c-418c-b1fd-0ad8479b9ce8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"21.575464252247457"
]
},
"execution_count": 324,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "322b44ac-6891-4680-8796-8bc45915111d",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 325,
"id": "73120ca9-384b-405e-8aa0-b004134be98b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"22.104361935551182"
]
},
"execution_count": 325,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "cd891006-0ad2-48ca-88b1-cd61611220dc",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 326,
"id": "79368290-3cd7-4dfa-ad69-a56a3eac4e80",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"22.655294332204793"
]
},
"execution_count": 326,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cvpTn2(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "916a021e-24f0-469b-a547-6c2683f77795",
"metadata": {},
"source": [
"#### 5.2.3. Isobaric Heat Capacity $c_p$"
]
},
{
"cell_type": "markdown",
"id": "7cd55f58-c22d-491d-87cb-d11323274006",
"metadata": {},
"source": [
"The following is Eq. (63) from Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "707ddc1d-448b-4ee6-8ade-943035825f2d",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 327,
"id": "847fc1ac-282b-4f39-8c32-fef0c12f0a3d",
"metadata": {},
"outputs": [],
"source": [
"cp = (cv + (1 + δ * diff(αr, δ) - δ * τ *\n",
" diff(αr, δ, τ))^2 / (1 + 2 * δ * diff(αr, δ) + \n",
" δ^2 * diff(αr, δ, δ)) * R);"
]
},
{
"cell_type": "markdown",
"id": "742d198b-a4de-4649-b915-055852138022",
"metadata": {},
"source": [
"Define a Julia function to calculate values."
]
},
{
"cell_type": "code",
"execution_count": 328,
"id": "58e8b819-1562-4ec5-9131-e3a2440013da",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 328,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cpjl = lambdify(cp(δ => ρ/ρc, τ => Tc/T),(ρ, T))"
]
},
{
"cell_type": "markdown",
"id": "0ec3696b-a454-4155-8145-d3ffb257876d",
"metadata": {},
"source": [
"Define another Julia function that uses an input pressure and temperature to calculate the needed density value."
]
},
{
"cell_type": "code",
"execution_count": 329,
"id": "46e3552e-199e-479f-91f4-201e977b84e0",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"cppTn2 (generic function with 1 method)"
]
},
"execution_count": 329,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(p, T) = cpjl(ρn2(p, T), T)"
]
},
{
"cell_type": "markdown",
"id": "634ee1b2-0c69-4e63-bb85-64e9f2c65c21",
"metadata": {},
"source": [
"Calculate some values."
]
},
{
"cell_type": "code",
"execution_count": 330,
"id": "d83cf265-be6f-4e84-a5d8-39753d215293",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"29.21999613937129"
]
},
"execution_count": 330,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(0.2e6, 290)"
]
},
{
"cell_type": "code",
"execution_count": 331,
"id": "49eaaf41-638a-4aec-a14e-3b7a5ed95dd2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"39.36103974887872"
]
},
"execution_count": 331,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(75e6, 270)"
]
},
{
"cell_type": "markdown",
"id": "1c7f97cd-ab3a-47aa-bcdc-5c59f593cd18",
"metadata": {},
"source": [
"These values are consistent with Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "42cc532f-88bb-4595-9d4d-e5b40208d9ac",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 332,
"id": "f5e20237-e6da-4b43-b510-f0134746fd19",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"29.171517219967"
]
},
"execution_count": 332,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(ptab[1], Ts)"
]
},
{
"cell_type": "markdown",
"id": "69f06e7d-8a75-4c1a-ab25-a203eae4a675",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 333,
"id": "8b2ca77c-072b-4f19-a2c9-95a413d3d0ae",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"29.173417101590708"
]
},
"execution_count": 333,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(ptab[1], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "72076b47-d094-4100-8cb4-79745539e897",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 334,
"id": "9c3de50a-901e-43c4-8466-61385a04ed78",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"34.778572361839494"
]
},
"execution_count": 334,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "e69a82bf-8ac1-4c62-b15b-694f7e98b914",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 335,
"id": "11ea651f-e0a4-435d-bdc6-445193fb64ef",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"38.42633485169769"
]
},
"execution_count": 335,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "ccf39490-fed2-47b2-ae6c-104ab6d8ed6b",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 336,
"id": "13bd646d-ab41-4450-af88-0db7f4f5044f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"39.87145571233225"
]
},
"execution_count": 336,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cppTn2(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "861df89f-0b1b-457b-9997-71edd4a26cd7",
"metadata": {},
"source": [
"#### 5.2.4. Ratio of Specific Heats $\\gamma$"
]
},
{
"cell_type": "markdown",
"id": "0248d40a-55b7-451e-9bb3-69a6d039f121",
"metadata": {},
"source": [
"Use the values of the two specific heats to calculate $\\gamma = c_p / c_v$."
]
},
{
"cell_type": "code",
"execution_count": 337,
"id": "60a93189-46f5-47be-a505-0850f2a00293",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"γn2 (generic function with 1 method)"
]
},
"execution_count": 337,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2(p, T) = cppTn2(p, T) / cvpTn2(p, T)"
]
},
{
"cell_type": "markdown",
"id": "6ca4eca9-bec2-423a-9f9f-fc4dbc60848b",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 338,
"id": "6a284216-2ee0-4e60-8ed2-a43a4a7907e3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.4013969087728102"
]
},
"execution_count": 338,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2(ptab[1], Ts)"
]
},
{
"cell_type": "markdown",
"id": "559ff435-f464-4b10-9139-6550ee19613e",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 339,
"id": "680d3897-7435-4f53-bfd0-bd46e717ef0f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.4018225912757267"
]
},
"execution_count": 339,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2(ptab[1], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "96a2727a-6b53-4c94-a596-24e612ca2fc2",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 340,
"id": "b29712c5-b35e-498e-9ca7-8b87381ee27d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.6119501279429806"
]
},
"execution_count": 340,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "99f076e6-8035-4c09-912a-ff872dce3b85",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 341,
"id": "a658952e-a8d3-4de7-99e1-70dfb4e36552",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.7384050697204398"
]
},
"execution_count": 341,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "c816c78c-63dd-4b53-ae74-30eee3a69586",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 342,
"id": "a8459cba-c3c9-4216-ad32-1decf96990a9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.7599177979186287"
]
},
"execution_count": 342,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "18facee0-d541-4a8d-bd5f-8ae5a0603694",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 343,
"id": "182ecfcf-4184-45fa-a0af-3c9511ac4fed",
"metadata": {},
"outputs": [],
"source": [
"γn2tab = map(p1 -> γn2(p1, Tcold), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 344,
"id": "281253ff-56c9-4fdf-85d2-38cb2511e585",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.4018225912757267, 1.6119501279429806, 1.7384050697204398, 1.7599177979186287)"
]
},
"execution_count": 344,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γn2tab[1], γn2tab[1001], γn2tab[2001], γn2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "b82849fc-1522-4500-a413-c3d9e70d4529",
"metadata": {},
"source": [
"Add these values to the dataframe."
]
},
{
"cell_type": "code",
"execution_count": 345,
"id": "ca4408eb-3475-4d30-bbcf-02c7deeefa8d",
"metadata": {},
"outputs": [],
"source": [
"valsn2.gamma = γn2tab;"
]
},
{
"cell_type": "markdown",
"id": "dc4079c9-9fc1-4fb9-8f2c-06b1ff480db3",
"metadata": {
"tags": []
},
"source": [
"#### 5.2.5. Sound Speed"
]
},
{
"cell_type": "markdown",
"id": "3ea3c832-439f-486e-9e15-84db46a0c107",
"metadata": {},
"source": [
"The following expression is Eq. (64) from Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "563a9c86-fca6-4529-8384-c4abf5005ebc",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 346,
"id": "87ae2d24-3d1b-4488-bc79-94f94d24da38",
"metadata": {},
"outputs": [],
"source": [
"w = sqrt( R * T / M * (1 + 2 * δ * diff(αr, δ) + δ^2 * diff(αr, δ, δ) - \n",
" (1 + δ * diff(αr, δ) - δ * τ * diff(αr, δ, τ))^2 / (τ^2 * \n",
" (diff(α0, τ, τ) + diff(αr, τ, τ)))));"
]
},
{
"cell_type": "markdown",
"id": "f59834b5-c7a4-4de1-9a3d-706ac8887290",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 347,
"id": "7cea4dd9-999a-41e2-bd8f-4771323f6bc2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 347,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wjl = lambdify(w(δ => ρ/ρc, τ => Tc/T),(ρ, T, M))"
]
},
{
"cell_type": "markdown",
"id": "ff533d97-4219-4695-bd55-74c2b57a5be9",
"metadata": {},
"source": [
"Define a function of pressure and temperature as before."
]
},
{
"cell_type": "code",
"execution_count": 348,
"id": "3453973c-6103-40ed-b8b2-a39849e8748a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"wpT (generic function with 1 method)"
]
},
"execution_count": 348,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(p, T) = wjl(ρn2(p, T), T, MN2)"
]
},
{
"cell_type": "markdown",
"id": "a32e7772-e5ac-4f40-8984-6ae1e95083f8",
"metadata": {},
"source": [
"Check values for 0.2 MPa"
]
},
{
"cell_type": "code",
"execution_count": 349,
"id": "49237db6-8913-4cae-9cf1-76128e5b0f7f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"347.3589765325666"
]
},
"execution_count": 349,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(0.2e6, 290)"
]
},
{
"cell_type": "markdown",
"id": "9272ce9e-cc33-4e1d-bab6-b485233a3ba6",
"metadata": {},
"source": [
"Check values for 75 MPa and 270 K."
]
},
{
"cell_type": "code",
"execution_count": 350,
"id": "23654e8d-8878-4141-abba-40fba05d5a64",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"749.3016933093184"
]
},
"execution_count": 350,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(75e6, 270)"
]
},
{
"cell_type": "markdown",
"id": "ea0f1546-710e-4448-af8c-481177bfc81c",
"metadata": {},
"source": [
"These are consistent with Span *et al.* [55]."
]
},
{
"cell_type": "markdown",
"id": "3c6fb11a-56ea-423b-8f0e-38c6660539e1",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 351,
"id": "16441e79-0758-4061-8854-34f4acb07690",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"349.1044228816854"
]
},
"execution_count": 351,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ps, Ts)"
]
},
{
"cell_type": "markdown",
"id": "d2fa9d7b-dfff-4f23-8291-b1452ab20972",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 352,
"id": "017b69bb-72a9-42f5-a97b-7944fa4a2110",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"337.89465634739565"
]
},
"execution_count": 352,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ps, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "830148ac-d74c-4ef7-8fec-24fdbb1d3edf",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 353,
"id": "85beec05-107f-43d8-99c0-8dbf48f58f01",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"363.76133310795603"
]
},
"execution_count": 353,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "843fe6ee-1520-44e2-9589-4efba4e004aa",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 354,
"id": "9c8c6806-b78c-40d7-ac47-4e2f51697ca9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"416.69020841364494"
]
},
"execution_count": 354,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "2b9c45b3-65a9-41e6-b065-ee9c2f6b1ec5",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 355,
"id": "93782506-40e0-4430-8841-0d3a915486ba",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"517.0273889822301"
]
},
"execution_count": 355,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wpT(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "875e712b-a9fa-438f-9681-4ff19a6b29cc",
"metadata": {},
"source": [
"Tabulate values for depth profile."
]
},
{
"cell_type": "code",
"execution_count": 356,
"id": "bd6615aa-faa0-4df7-805d-b27ace6541f2",
"metadata": {},
"outputs": [],
"source": [
"wn2tab = map(p1 -> wpT(p1, Tcold), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 357,
"id": "3e078dae-8e8e-40a8-9aee-3982aae8cceb",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(337.89465634739565, 363.76133310795603, 416.69020841364494, 517.0273889822301)"
]
},
"execution_count": 357,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wn2tab[1], wn2tab[1001], wn2tab[2001], wn2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "ddb69f09-03e0-4d73-bb84-6a35b3d96c3c",
"metadata": {
"tags": []
},
"source": [
"#### 5.2.6. Viscosity"
]
},
{
"cell_type": "markdown",
"id": "b8f1ef50-bf59-473f-bb8f-6ea53c3b4d0b",
"metadata": {},
"source": [
"Use the relationships from Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 358,
"id": "a6613b8e-0315-4741-b81e-ad23bfb548be",
"metadata": {},
"outputs": [],
"source": [
"pc = 3.3958e6; # Pa"
]
},
{
"cell_type": "markdown",
"id": "59b6898f-2332-43cd-97bb-653465cf02f7",
"metadata": {},
"source": [
"The following parameters were defined in the oxygen section above. We reuse them here."
]
},
{
"cell_type": "code",
"execution_count": 359,
"id": "3e9f8afc-cd04-40fd-8ca8-5acba706b4c1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.431, -0.4623, 0.08406, 0.005341, -0.00331)"
]
},
"execution_count": 359,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bi"
]
},
{
"cell_type": "code",
"execution_count": 360,
"id": "0d3efe08-f90d-476f-8ab8-0df24a1a496a",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\frac{1.53879554995687 e^{- 0.00331 \\log{\\left(T \\right)}^{4} + 0.005341 \\log{\\left(T \\right)}^{3} + 0.08406 \\log{\\left(T \\right)}^{2}}}{T^{0.4623}}$"
],
"text/plain": [
" 4 3 2\n",
" -0.4623 - 0.00331⋅log (T) + 0.005341⋅log (T) + 0.08406⋅log \n",
"1.53879554995687⋅T ⋅ℯ \n",
"\n",
" \n",
"(T)\n",
" "
]
},
"execution_count": 360,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω(T)"
]
},
{
"cell_type": "markdown",
"id": "71aa7300-15e7-42d7-b270-0f3d5aa18137",
"metadata": {},
"source": [
"Define some other needed parameters."
]
},
{
"cell_type": "code",
"execution_count": 361,
"id": "460f32ef-96ef-48aa-9541-709300d38e36",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"98.94"
]
},
"execution_count": 361,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ϵoverk = 98.94 # K"
]
},
{
"cell_type": "code",
"execution_count": 362,
"id": "3f7ef5e6-a290-4844-92d3-f7ad77586304",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.0241852717016806"
]
},
"execution_count": 362,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω(300/ϵoverk)"
]
},
{
"cell_type": "code",
"execution_count": 363,
"id": "c43d0e24-9669-449c-bc1a-390f75d76bb4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.656e-10"
]
},
"execution_count": 363,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"σvis = 0.3656e-9"
]
},
{
"cell_type": "markdown",
"id": "1fc3d274-31b8-4f20-a708-463240ce9c91",
"metadata": {},
"source": [
"The following is Eq. (2) from Lemmon and Jacobsen [58] with the constants adjusted so all values are in SI units. The resulting value is in Pa s."
]
},
{
"cell_type": "markdown",
"id": "1d6a7e6b-ea53-45ea-b3b4-78f2f2a98f0e",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 364,
"id": "27226d5b-9976-4527-b76c-664d34d382e1",
"metadata": {},
"outputs": [],
"source": [
"η0 = 0.0266958e-24 * sqrt(1000 * M * T) / (σvis^2 * Ω(T/ϵoverk));"
]
},
{
"cell_type": "markdown",
"id": "1e500e97-ef04-4ffc-abb9-1a931e00de4d",
"metadata": {},
"source": [
"Calculate a value for $T = 300$ K."
]
},
{
"cell_type": "code",
"execution_count": 365,
"id": "ec3060a2-fd14-4e47-b051-565971ed32a1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.787706414600966559101560198695408335590729400220960251909887121698465030839747e-05"
]
},
"execution_count": 365,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(η0(T=>300, M=>MN2))"
]
},
{
"cell_type": "markdown",
"id": "c2df09eb-c140-4396-a677-1427b7c5c9bd",
"metadata": {},
"source": [
"These are the parameters in Table III in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 366,
"id": "47a949d8-8416-4a7f-bad5-d6f7eb55d080",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(10.72, 0.03989, 0.001208, -7.402, 4.62)"
]
},
"execution_count": 366,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Nvis = (10.72, 0.03989, 0.001208, -7.402, 4.620)"
]
},
{
"cell_type": "code",
"execution_count": 367,
"id": "ee4e4582-753b-4d6d-825f-58d12ec4b86f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.1, 0.25, 3.2, 0.9, 0.3)"
]
},
"execution_count": 367,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tvis = (0.1, 0.25, 3.2, 0.9, 0.3)"
]
},
{
"cell_type": "code",
"execution_count": 368,
"id": "ca6fe506-368d-4e1c-bec6-aea5f9d97eb6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(2, 10, 12, 2, 1)"
]
},
"execution_count": 368,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dvis = (2, 10, 12, 2, 1)"
]
},
{
"cell_type": "code",
"execution_count": 369,
"id": "2db4726d-2cad-4465-a58b-22daffb768ef",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 1, 1, 2, 3)"
]
},
"execution_count": 369,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lvis = (0, 1, 1, 2, 3)"
]
},
{
"cell_type": "markdown",
"id": "55160f8a-f0d0-4f32-99e5-0904980a7942",
"metadata": {},
"source": [
"This is Eq. (3) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "342f5bbe-97c8-4a53-a4e2-efa63b22c724",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 370,
"id": "4ec32938-65fc-4ceb-aa64-b879283c6614",
"metadata": {},
"outputs": [],
"source": [
"ηr = 10^-6 * sum(Nvis[i] * τ^tvis[i] * δ^dvis[i] * \n",
" exp(lvis[i] == 0 ? 0 : -δ^lvis[i]) for i in 1:5);"
]
},
{
"cell_type": "markdown",
"id": "df3e658a-3a3b-4a0d-ac28-a24b49dd0e2a",
"metadata": {},
"source": [
"This is Eq. (1) in Lemmon and Jacobsen [58]. The viscosity of oxygen is $\\eta$."
]
},
{
"cell_type": "markdown",
"id": "1cabbff9-a38a-4f10-9968-82f18ed3fee4",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 371,
"id": "1d0f88ff-b7c2-4d39-8edb-43ece3a6b29f",
"metadata": {},
"outputs": [],
"source": [
"η = η0 + ηr;"
]
},
{
"cell_type": "markdown",
"id": "66b40661-158f-47d3-94fa-bfdeb0afef1b",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 372,
"id": "e4d0b498-8a6f-4254-8ca6-27fa8f2f1b3d",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 372,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηjl = lambdify(η(δ => ρ/ρc, τ => Tc/T), (ρ, T, M))"
]
},
{
"cell_type": "markdown",
"id": "4e04deaf-2f76-4596-95ac-45ea68ca34d2",
"metadata": {},
"source": [
"Calculate some values to compare with Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 373,
"id": "3fa5158b-035b-494d-8d49-22ed306bcb68",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"20.743041742625184"
]
},
"execution_count": 373,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1e6 * ηjl(5e3, 300, MN2)"
]
},
{
"cell_type": "code",
"execution_count": 374,
"id": "14f58159-5ad3-4f50-8b51-a61e39e02f5e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"79.7417506134048"
]
},
"execution_count": 374,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1e6 * ηjl(25e3, 100, MN2)"
]
},
{
"cell_type": "code",
"execution_count": 375,
"id": "40e9b4c7-77af-4ab5-8e46-b3bccbaf4b63",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"21.081044490030866"
]
},
"execution_count": 375,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"1e6 * ηjl(10e3, 200, MN2)"
]
},
{
"cell_type": "markdown",
"id": "4fd80932-c92b-4a18-9681-752aa77c8606",
"metadata": {},
"source": [
"These values are consistent with the values in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "7a21f155-a5f5-426d-831d-33ac82d1b2fd",
"metadata": {},
"source": [
"Define a function of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 376,
"id": "7dab7dd9-3c7d-4a89-8c60-4bababd598ab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ηpT (generic function with 1 method)"
]
},
"execution_count": 376,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(p, T) = ηjl(ρn2(p, T), T, MN2)"
]
},
{
"cell_type": "markdown",
"id": "234f35a3-1dad-4ceb-8988-7376a4492733",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 377,
"id": "f42a50a0-b269-4729-bc24-72773967ec9e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.7572933092983353e-5"
]
},
"execution_count": 377,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ps, Ts)"
]
},
{
"cell_type": "markdown",
"id": "236c67b8-37f3-44eb-a315-9b1023ee2552",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 378,
"id": "0752b965-0fc1-4465-aa10-2bb8dde173dc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.6700484916609287e-5"
]
},
"execution_count": 378,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ps, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "231dc65d-25b1-4dd6-8295-b4132d73af8a",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 379,
"id": "14023733-6f99-4364-8c56-54a554282480",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.9183615129628023e-5"
]
},
"execution_count": 379,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[1001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "503e87df-c3d8-4f95-92eb-5c8b91352982",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 380,
"id": "c053f243-3e72-42a7-8e8e-14bf0780b464",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.31078724711162e-5"
]
},
"execution_count": 380,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[2001], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "9f71b714-dc4c-42ce-8e4b-0f77e7198b6e",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 381,
"id": "a2ddd639-de87-4e67-ae01-addb37199a9b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.982149636014933e-5"
]
},
"execution_count": 381,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηpT(ptab[end], Tcold)"
]
},
{
"cell_type": "markdown",
"id": "6ddfb2f8-a23d-41d9-9b55-abd8e3066118",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 382,
"id": "5a7484b4-1229-4ea3-856e-a5a87445ef84",
"metadata": {},
"outputs": [],
"source": [
"ηn2tab = map(p1 -> ηpT(p1, Tcold), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 383,
"id": "a2eaec0b-db78-408c-a698-91b45b2193a8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.6700484916609287e-5, 1.9183615129628023e-5, 2.31078724711162e-5, 2.982149636014933e-5)"
]
},
"execution_count": 383,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ηn2tab[1], ηn2tab[1001], ηn2tab[2001], ηn2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "ddd33544-28c8-425b-9ea9-649d17a0749f",
"metadata": {
"tags": []
},
"source": [
"#### 5.2.7. Thermal Conductivity"
]
},
{
"cell_type": "markdown",
"id": "b5f6ccac-4d55-4283-a035-dd2f9a4de037",
"metadata": {},
"source": [
"Use the relationships from Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "aaedef9f-5e52-4ab1-8a89-db25e745b69a",
"metadata": {},
"source": [
"Define the coefficients in Table IV in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 384,
"id": "29b817da-d2b8-4083-bb38-e6535a6aecc6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.511, 2.117, -3.332, 8.862, 31.11, -73.13, 20.03, -0.7096, 0.2672)"
]
},
"execution_count": 384,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ncon = (1.511, 2.117, -3.332, 8.862, 31.11, -73.13, 20.03, -0.7096, 0.2672)"
]
},
{
"cell_type": "markdown",
"id": "15400afb-94b5-4d1a-85d7-d3861c6ab4e9",
"metadata": {},
"source": [
"The first term in the list below is for $i=2$."
]
},
{
"cell_type": "code",
"execution_count": 385,
"id": "484319d4-8809-44cd-8840-6f46932473ef",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(-1.0, -0.7, 0, 0.03, 0.2, 0.8, 0.6, 1.9)"
]
},
"execution_count": 385,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tcon = (-1.0, -0.7, 0, 0.03, 0.2, 0.8, 0.6, 1.9)"
]
},
{
"cell_type": "markdown",
"id": "f3c490d6-1164-4ad7-b421-de9d5b61987a",
"metadata": {},
"source": [
"The first term in the list below is for $i=4$."
]
},
{
"cell_type": "code",
"execution_count": 386,
"id": "85fd972d-fff1-4965-a9a8-b0c808e10d8b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 2, 3, 4, 8, 10)"
]
},
"execution_count": 386,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dcon = (1, 2, 3, 4, 8, 10)"
]
},
{
"cell_type": "markdown",
"id": "f1634dd2-8fb7-4624-be20-a7797af7ec6a",
"metadata": {},
"source": [
"The first term in the list below is for $i=4$."
]
},
{
"cell_type": "code",
"execution_count": 387,
"id": "d9bde19c-3ed9-4f72-8358-4ad3511f2a88",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0, 0, 1, 2, 2, 2)"
]
},
"execution_count": 387,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lcon = (0, 0, 1, 2, 2, 2)"
]
},
{
"cell_type": "markdown",
"id": "5f6e719d-87eb-4984-9ea0-d1a015046be7",
"metadata": {},
"source": [
"The equation below is Eq (5) in Lemmon and Jacobsen [58] adjusted so all parameters are in SI units."
]
},
{
"cell_type": "markdown",
"id": "adeede51-a66e-4afc-9f75-18b1756ae062",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 388,
"id": "348df324-0d02-4ba8-b93c-272ef0304417",
"metadata": {},
"outputs": [],
"source": [
"λ0 = 10^-3 * (Ncon[1] * (η0 / 10^-6) + Ncon[2] * τ^tcon[2 - 1] + Ncon[3] * \n",
" τ^tcon[3 - 1]);"
]
},
{
"cell_type": "markdown",
"id": "0797de61-6fd7-4057-8340-b5aef57c680d",
"metadata": {},
"source": [
"Define a Julia function for calculations."
]
},
{
"cell_type": "code",
"execution_count": 389,
"id": "234753a3-c651-483b-9c2c-0f96c9061509",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 389,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ0jl = lambdify(λ0(τ=>Tc/T),(T, M))"
]
},
{
"cell_type": "markdown",
"id": "cb119526-d2b3-413a-839e-7aadf8319824",
"metadata": {},
"source": [
"Compare symbolic and Julia function calculations."
]
},
{
"cell_type": "code",
"execution_count": 390,
"id": "b81b47cb-68ac-4831-be4e-f01f9b13c1fa",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.00927749392871776713910514104183435305005724945855386717792512728375971553062074"
]
},
"execution_count": 390,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ0(τ=>Tc/T, M=>MN2)(T=>100))"
]
},
{
"cell_type": "code",
"execution_count": 391,
"id": "10dc89ee-3d49-46ad-ac87-3d89993b4750",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.00927749392871777"
]
},
"execution_count": 391,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ0jl(100, MN2)"
]
},
{
"cell_type": "code",
"execution_count": 392,
"id": "1d972099-96cc-4cd9-8e94-dc5ea54756a2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02593608667121783418557850017966115010524922926872603486862866737795929613647187"
]
},
"execution_count": 392,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ0(τ=>Tc/T, M=>MN2)(T=>300))"
]
},
{
"cell_type": "code",
"execution_count": 393,
"id": "734e873b-f7fd-41b2-832d-0a491e00bd7b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.025936086671217842"
]
},
"execution_count": 393,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ0jl(300, MN2)"
]
},
{
"cell_type": "markdown",
"id": "c1e24ff0-2717-47a1-bccf-b4537834e56a",
"metadata": {},
"source": [
"These values are consistent."
]
},
{
"cell_type": "markdown",
"id": "8c95af95-e7bb-40fe-9869-7f90125dab6e",
"metadata": {},
"source": [
"This is Eq. (6) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "b1f8384e-fbf7-43ea-8fb1-6db64d8185d7",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 394,
"id": "74ff202c-489b-4324-9da8-0c7278979b1c",
"metadata": {},
"outputs": [],
"source": [
"λr = 10^-3 * sum( Ncon[i] * τ^tcon[i - 1] * δ^dcon[i -\n",
" 3] * exp(lcon[i - 3] == 0 ? 0 : -δ^lcon[i - 3]) for i in\n",
" 4:9);"
]
},
{
"cell_type": "markdown",
"id": "b43c3021-cf74-4ce8-903c-1055ac94fd93",
"metadata": {},
"source": [
"Define a Julia function for this."
]
},
{
"cell_type": "code",
"execution_count": 395,
"id": "5cb78e9c-ba4e-41fa-9c6e-a158079114d7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 395,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λrjl = lambdify(λr(δ => ρ/ρc, τ => Tc/T), (ρ, T))"
]
},
{
"cell_type": "markdown",
"id": "b6630584-4e67-4e7c-b3bc-384a43daede7",
"metadata": {},
"source": [
"Compare symbolic and Julia function values."
]
},
{
"cell_type": "code",
"execution_count": 396,
"id": "c757caf5-8b9a-4b55-a19f-969c3ed1c674",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.025539505273607738"
]
},
"execution_count": 396,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λr(δ => ρ/ρc, τ => Tc/T)(ρ => ρn2tab[end]/MN2, T=>Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 397,
"id": "f9983494-6d3a-4005-9188-de2ae0da30f4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.025539505273607738"
]
},
"execution_count": 397,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λrjl(ρn2tab[end]/MN2, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "6a3d9bb5-cb05-4f46-8ec4-248c8fd81d30",
"metadata": {},
"source": [
"In order to calculate $\\lambda^c$ in Eq. (7) in Lemmon and Jacobsen [58], we must calculate the parameters in Eqs. (8-11).\n",
"\n",
"First, we define some of the parameters in these equations."
]
},
{
"cell_type": "code",
"execution_count": 398,
"id": "147f8ea1-daca-4f15-b85f-54165f276f1a",
"metadata": {},
"outputs": [],
"source": [
"ξ0 = 0.17e-9; # m"
]
},
{
"cell_type": "code",
"execution_count": 399,
"id": "b4ace58b-2e2a-4c47-86e1-9da24269610a",
"metadata": {},
"outputs": [],
"source": [
"pc = 3.3958e6; # Pa"
]
},
{
"cell_type": "code",
"execution_count": 400,
"id": "86b98a4f-b0e3-45c6-9f59-aa51d84e5a5a",
"metadata": {},
"outputs": [],
"source": [
"ρc = 11.1839e3; # mol/m^3"
]
},
{
"cell_type": "markdown",
"id": "64430a9a-0eca-4626-b785-b63b838e61b7",
"metadata": {},
"source": [
"We need $\\left( \\frac{\\partial \\rho}{\\partial p} \\right)_T$. Use the equation of state from Eq. (56) from Lemmon and Jacobsen [58] to get $\\left( \\frac{\\partial p}{\\partial \\rho} \\right)_T$, and invert it."
]
},
{
"cell_type": "markdown",
"id": "fcd7b0eb-6197-4d5b-a4ea-b11340e6b915",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 401,
"id": "09c844ba-75fa-497e-a60d-b4aed3158a84",
"metadata": {},
"outputs": [],
"source": [
"dpdρ = diff(ρ * R * T * (1 + δ * diff(αr, δ))(δ => ρ/ρc, τ => Tc/T), ρ);"
]
},
{
"cell_type": "markdown",
"id": "5f9d3ef6-f66a-4a09-aa2c-6b25b6c43a65",
"metadata": {},
"source": [
"$\\left( \\frac{\\partial \\rho}{\\partial p} \\right)_T$ is the reciprocal of the previous result."
]
},
{
"cell_type": "markdown",
"id": "712fb812-d927-4981-883a-421b51401311",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 402,
"id": "08b10a4a-d14f-4779-9abe-ed5726ec6e19",
"metadata": {},
"outputs": [],
"source": [
"dρdp = 1/dpdρ;"
]
},
{
"cell_type": "markdown",
"id": "24e4e339-f422-4d71-b784-59a79105f221",
"metadata": {},
"source": [
"The following is Eq. (11) from Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "a552bda4-ebd5-42e9-a070-0ba68e19ead7",
"metadata": {},
"source": [
"*Output from the following symbolic calculation has been suppressed. Remove the trailing semicolon before entering the cell to display it.*"
]
},
{
"cell_type": "code",
"execution_count": 403,
"id": "073dd44b-dad8-4cc2-b98b-25b8e0c1bf0e",
"metadata": {},
"outputs": [],
"source": [
"χn = pc * ρ/ρc^2 * dρdp;"
]
},
{
"cell_type": "markdown",
"id": "3a77cc91-d432-468a-be1a-bcf8b9cca83f",
"metadata": {},
"source": [
"Calculate some values to test this."
]
},
{
"cell_type": "code",
"execution_count": 404,
"id": "542b6734-5fe5-4954-8caa-8eee05fb4498",
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$0.0602175741298228$"
],
"text/plain": [
"0.0602175741298228"
]
},
"execution_count": 404,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χn(ρ => 15654, T => 309.162)"
]
},
{
"cell_type": "code",
"execution_count": 405,
"id": "afa0929f-51c6-4fa7-b3e2-02b24b7f0681",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.06021757412982283"
]
},
"execution_count": 405,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(χn(ρ => 15654, T => 309.162))"
]
},
{
"cell_type": "code",
"execution_count": 406,
"id": "78513c57-a2ee-4bfa-8daf-9320ba26b24a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.05678388205384859"
]
},
"execution_count": 406,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lambdify(χn(T=>309.162), (ρ,))(15654)"
]
},
{
"cell_type": "code",
"execution_count": 407,
"id": "0553564b-499c-4769-9046-d4b2695eab59",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.06021757412982288700779976306189003702673070912411065870748388041709201066309367"
]
},
"execution_count": 407,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lambdify(χn, (ρ,T))(BigFloat(\"15654.\"), BigFloat(\"309.162\"))"
]
},
{
"cell_type": "code",
"execution_count": 408,
"id": "ceefead9-f6ce-40d7-ab65-245a063a9b6d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.060217574129822884"
]
},
"execution_count": 408,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"convert(Float64, lambdify(χn, (ρ,T))(BigFloat(\"15654.\"), BigFloat(\"309.162\")))"
]
},
{
"cell_type": "markdown",
"id": "1b99d1b9-c0e8-436a-9710-6a47253a5795",
"metadata": {},
"source": [
"There is a significant loss in precision when we go to a floating point calculation from the symbolic calculation. We are going to have to use BigFloat numbers for `χn` and the parameters that depend on it."
]
},
{
"cell_type": "markdown",
"id": "297ea8f1-482e-4b75-a95f-87ab068bd4fe",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 409,
"id": "20351fb3-8118-4823-9436-50d4621670d2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"#118 (generic function with 1 method)"
]
},
"execution_count": 409,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl = lambdify(χn, (ρ,T))"
]
},
{
"cell_type": "markdown",
"id": "76e9e57b-68d8-4494-bb5d-97f99608de1e",
"metadata": {},
"source": [
"Define some more needed parameters."
]
},
{
"cell_type": "code",
"execution_count": 410,
"id": "bd3c8c3f-a171-4780-9035-ccb30dcd58ad",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.055"
]
},
"execution_count": 410,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Γ = 0.055"
]
},
{
"cell_type": "code",
"execution_count": 411,
"id": "25f288ea-a515-42bf-a389-e9c531ebaf95",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.63"
]
},
"execution_count": 411,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ν = 0.63"
]
},
{
"cell_type": "code",
"execution_count": 412,
"id": "cceeb4d0-9f47-4e72-85d9-80185a96bef6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.2415"
]
},
"execution_count": 412,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"γtc = 1.2415"
]
},
{
"cell_type": "code",
"execution_count": 413,
"id": "2b7e0ea2-5c4e-487b-84be-c8de77c906dc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"252.384"
]
},
"execution_count": 413,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Tref = 252.384 # K"
]
},
{
"cell_type": "markdown",
"id": "928e05c1-9b31-4030-b144-9b2460a17657",
"metadata": {},
"source": [
"Compare some symbolic and Julia calculations to make sure everything is consistent."
]
},
{
"cell_type": "code",
"execution_count": 414,
"id": "bc70e2fc-e563-4f17-a806-04046efbd87a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.08324797739948357"
]
},
"execution_count": 414,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(χn(ρ => ρn2(ptab[end], Tcold), T => Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 415,
"id": "d113bb7f-c7d6-4289-995a-23f1f1b300bc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.07614500019331444898864891880754414665567656911879417994408818834904409021383484"
]
},
"execution_count": 415,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl(BigFloat(ρn2(ptab[end], Ts)), BigFloat(Ts))"
]
},
{
"cell_type": "code",
"execution_count": 416,
"id": "6065d9f0-ae30-4c55-9d7e-14985db17a44",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.09198684158279236104835953851523045730569138321788117580508021741916668028376403"
]
},
"execution_count": 416,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl(BigFloat(ρn2(ptab[end], Tref)), BigFloat(Tref))"
]
},
{
"cell_type": "code",
"execution_count": 417,
"id": "638d926a-977e-4999-9a4a-f05c94278199",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.09198684158279254"
]
},
"execution_count": 417,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(χn(ρ => ρn2(ptab[end], Tref), T => Tref))"
]
},
{
"cell_type": "code",
"execution_count": 418,
"id": "547dce8a-6482-4acf-8e23-67fec0ff6a16",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.09198684158279236104835953851523045730569138321788117580508021741916668028376403"
]
},
"execution_count": 418,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"χnjl(BigFloat(ρn2(ptab[end], Tref)), BigFloat(Tref))"
]
},
{
"cell_type": "markdown",
"id": "d1187edb-5281-45d0-9eb3-823a3e586a19",
"metadata": {},
"source": [
"The values above are consistent."
]
},
{
"cell_type": "markdown",
"id": "34e0f161-2f42-4c06-b1ab-c14d3b32f16d",
"metadata": {},
"source": [
"This is Eq. (10) in Lemmon and Jacobsen [58]. We define it here as a symbolic function (which produces a SymPy expression)."
]
},
{
"cell_type": "code",
"execution_count": 419,
"id": "ca8cd47c-d3ea-4841-a8f3-979e8de1bca1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ξ (generic function with 1 method)"
]
},
"execution_count": 419,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξ(ρ1, T1) = ξ0 * (((χn(ρ => ρ1, T => T1)) -\n",
" (χn(ρ => ρ1, T => Tref)) * (Tref/T1)) /\n",
" Γ)^(ν/γtc)"
]
},
{
"cell_type": "markdown",
"id": "5371b023-c71d-4503-8481-970a812d206c",
"metadata": {},
"source": [
"Define a Julia function for this."
]
},
{
"cell_type": "code",
"execution_count": 420,
"id": "696e9527-7fe2-47fb-bf80-092352786f4d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"ξjl (generic function with 1 method)"
]
},
"execution_count": 420,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξjl(ρ1, T1) = ξ0 * (((χnjl(ρ1, T1)) - (χnjl(ρ1, Tref)) * (Tref/T1)) / Γ)^(ν/γtc)"
]
},
{
"cell_type": "markdown",
"id": "4f70ef74-9544-4f56-91ef-8bf8f890650c",
"metadata": {},
"source": [
"Compare symbolic and Julia floating point calculations."
]
},
{
"cell_type": "code",
"execution_count": 421,
"id": "8235dea8-079f-4012-8135-c7369e9cb9e5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-1.3442826598788053e-12 + 5.7420423384909375e-11im"
]
},
"execution_count": 421,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(ξ(ρn2tab[end]/MN2, Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 422,
"id": "bb740200-acd3-4aab-91cb-0a3f57d4a8e4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"NaN"
]
},
"execution_count": 422,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ξjl(BigFloat(ρn2tab[end]+ 0im), BigFloat(Tcold+0im))"
]
},
{
"cell_type": "markdown",
"id": "1942cfa5-cc06-44a3-b7e4-50f491fedf4b",
"metadata": {},
"source": [
"The results above are correct. The temperatures given (and the temperatures in all the underwater environments in the paper) are greater than the critical temperature; therefore $\\xi$ does not contribute to the thermal conductivity through the $\\lambda_c$ term defined in Eq. (7) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "e260bc49-3504-493f-bba5-e5dfccb30f42",
"metadata": {},
"source": [
"Define some more paraeters."
]
},
{
"cell_type": "code",
"execution_count": 423,
"id": "2f5536b9-89d4-48e2-8555-c691415962ff",
"metadata": {},
"outputs": [],
"source": [
"R0 = 1.01;"
]
},
{
"cell_type": "code",
"execution_count": 424,
"id": "cfbad814-4252-4fb5-9c37-3e065c23dab6",
"metadata": {},
"outputs": [],
"source": [
"k = 1.380658e-23; # J/K"
]
},
{
"cell_type": "code",
"execution_count": 425,
"id": "c932bfc5-61ad-4be2-b454-6c9fdec44e9b",
"metadata": {},
"outputs": [],
"source": [
"qD = 0.40e-9; # m"
]
},
{
"cell_type": "markdown",
"id": "3adc5bec-3902-4af8-b62b-7c354cb8e63b",
"metadata": {},
"source": [
"The following is Eq. (8) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 426,
"id": "f339dae7-133b-4595-a3d1-0e60c958726a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ωn (generic function with 1 method)"
]
},
"execution_count": 426,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ωn(ρ1, T1) = (2/π * ((cp - cv) / cp * atan(ξ(ρ1, T1) /\n",
" qD) + cv / cp * ξ(ρ1, T1) / qD)(δ => ρ/ρc, \n",
" τ => Tc/T))(ρ => ρ1, T => T1)"
]
},
{
"cell_type": "markdown",
"id": "f1b37262-f23c-43a1-a0bf-8de75ae1ce30",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 427,
"id": "8681b626-be3f-4ac5-bb32-56fde9e4dc4c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ωnjl (generic function with 1 method)"
]
},
"execution_count": 427,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ωnjl(ρ1, T1) = 2/π * ((cpjl(ρ1, T1) - cvjl(ρ1, T1)) / \n",
" cpjl(ρ1, T1) * atan(ξjl(ρ1, T1) /\n",
" qD) + cvjl(ρ1, T1) / cpjl(ρ1, T1) * ξjl(ρ1, T1) / qD)"
]
},
{
"cell_type": "markdown",
"id": "fd8bcfe6-90a6-48be-8b50-0690e612bda9",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 428,
"id": "15c407b1-4bb3-4efb-bb81-79edd6d9d8f6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-0.00010979933356491272 + 0.004689978682126876im"
]
},
"execution_count": 428,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(Ωn(ρn2tab[end], Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 429,
"id": "b112f99b-554b-40f3-9e91-cc3208434f74",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-0.00010979933356491013 + 0.004689978682126766im"
]
},
"execution_count": 429,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ωnjl(ρn2tab[end], Tcold + 0im)"
]
},
{
"cell_type": "markdown",
"id": "76832e9f-a6fa-433e-9ca6-d2c55fa30924",
"metadata": {},
"source": [
"The following is Eq. (9) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 430,
"id": "e32be125-3733-44a9-ae4d-da7d7857d7fc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ω0n (generic function with 1 method)"
]
},
"execution_count": 430,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω0n(ρ1, T1) = (2 / π * (1 - exp(-1 / ((ξ(ρ1, T1) /\n",
" qD)^-1 + 1/3 * (ξ(ρ1, T1) / qD)^2 * (ρc /\n",
" ρ)^2)))(δ => ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1)"
]
},
{
"cell_type": "markdown",
"id": "92ddb97d-70f5-4288-80c1-acd7f2c46d25",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 431,
"id": "66d2beb3-03f9-464a-9129-17547a7b2e23",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Ω0njl (generic function with 1 method)"
]
},
"execution_count": 431,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω0njl(ρ1, T1) = 2 / π * (1 - exp(-1 / ((ξjl(ρ1, T1) /\n",
" qD)^-1 + 1/3 * (ξjl(ρ1, T1) / qD)^2 * (ρc /\n",
" ρ1)^2)))"
]
},
{
"cell_type": "markdown",
"id": "66b1379e-b5e7-46c1-94ee-1745b20a26f5",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 432,
"id": "c6afbc22-3da6-423a-b3bf-cea78d1320ea",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-9.311257188915345e-5 + 0.004690669700665422im"
]
},
"execution_count": 432,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(Ω0n(ρn2tab[end], Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 433,
"id": "a841e57d-289a-4664-b9fd-02bdb7e21b24",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"-9.311257188919424e-5 + 0.004690669700665313im"
]
},
"execution_count": 433,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Ω0njl(ρn2tab[end], Tcold + 0im)"
]
},
{
"cell_type": "markdown",
"id": "f29239c3-3491-440d-b6e5-5fba9cb5e5ac",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "292f5ee1-6945-4540-9cfc-dbea36c03e73",
"metadata": {},
"source": [
"The following expression is Eq. (7) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 434,
"id": "c4695660-ce2f-4b4e-9bfd-6b0aa5dc13c2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λc (generic function with 1 method)"
]
},
"execution_count": 434,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λc(ρ1, T1) =\n",
" if (((χn(ρ => ρ1, T => T1)) - (χn(ρ => ρ1, T =>\n",
" Tref)) * (Tref / T1)) / Γ) > 0\n",
" ((ρ * cp * k * R0 * T1 / (6 * π * ξ(ρ1, T1) * η)\n",
" * (Ωn(ρ1, T1) - Ω0n(ρ1, T1)))(δ =>\n",
" ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1)\n",
" else\n",
" 0\n",
" end"
]
},
{
"cell_type": "markdown",
"id": "879e3f53-31ba-4542-b5fe-8213d1d1bcb1",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 435,
"id": "33797a12-bde6-43f6-b06c-9869d61a63d6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λcjl (generic function with 1 method)"
]
},
"execution_count": 435,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function λcjl(ρ1, T1)\n",
" if ((χnjl(ρ1, T1) - (χnjl(ρ1, Tref)) * (Tref / T1)) / Γ) > 0\n",
" ρ1 * cpjl(ρ1, T1) * k * R0 * T1 / (6 * π * ξjl(ρ1, T1) * ηjl(ρ1, T1, MN2)) *\n",
" (Ωnjl(ρ1, T1) - Ω0njl(ρ1, T1))\n",
" else\n",
" 0\n",
" end\n",
"end"
]
},
{
"cell_type": "markdown",
"id": "e2af6a3c-9f92-4119-b990-d3d836ed0156",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 436,
"id": "4fd97861-f76a-40a2-acb6-ab7cd7ab4ca3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 436,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λc(ρn2tab[end]/MN2, Tcold)"
]
},
{
"cell_type": "code",
"execution_count": 437,
"id": "d657ab27-9451-4d42-8f4f-16bdcfdf8fe2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 437,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λcjl(ρn2tab[end]/MN2, Tcold)"
]
},
{
"cell_type": "markdown",
"id": "4bf523b5-c156-4ab9-bded-4827210456b9",
"metadata": {},
"source": [
"These are consistent."
]
},
{
"cell_type": "markdown",
"id": "dbe1794e-960a-4ca5-b06c-9454d7a0cc9c",
"metadata": {},
"source": [
"The following expression is Eq. (4) in Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "code",
"execution_count": 438,
"id": "85a19650-4d13-4f82-8a09-5efd3fc7a72e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λ (generic function with 1 method)"
]
},
"execution_count": 438,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λ(ρ1, T1) = ((λ0 + λr + λc(ρ1, T1))(δ => ρ/ρc, τ => Tc/T))(ρ => ρ1, T => T1, M => MN2)"
]
},
{
"cell_type": "markdown",
"id": "e594807a-1de1-4505-a90b-139d48364903",
"metadata": {},
"source": [
"Define a Julia function for this using the Julia functions for the parameters."
]
},
{
"cell_type": "code",
"execution_count": 439,
"id": "0ae107eb-5b54-4b45-9e89-5a9811200b9d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λjl (generic function with 1 method)"
]
},
"execution_count": 439,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(ρ1, T1) = λ0jl(T1, MN2) + λrjl(ρ1, T1) + λcjl(ρ1, T1)"
]
},
{
"cell_type": "markdown",
"id": "19faf2b0-4d62-48cf-9994-68f8cbbbf65a",
"metadata": {},
"source": [
"Compare symbolic and Julia calculations."
]
},
{
"cell_type": "code",
"execution_count": 440,
"id": "892c3597-3b3a-4729-96d9-da2f54e3f192",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.04961651940347420703109616860994708805258130385874692564684392089699048484177591"
]
},
"execution_count": 440,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(ρn2(ptab[end], Tcold), Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 441,
"id": "7d007804-b465-4929-99d6-0cc808f56c9e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.04961651940347420089771997907548118664760851853832029590563995478001820095462653"
]
},
"execution_count": 441,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(ρn2(ptab[end], Tcold)), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "ae6eff96-a781-4176-ad22-9cb2d874641a",
"metadata": {},
"source": [
"Compare some more symbolic and Julia values."
]
},
{
"cell_type": "code",
"execution_count": 442,
"id": "6d56ebfd-a5a7-4e82-956a-92ba24faf87e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03276943188143659576443538695955222910488788805769005404506590140203127919881955"
]
},
"execution_count": 442,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(5000, 300))"
]
},
{
"cell_type": "code",
"execution_count": 443,
"id": "d3e0119c-35ad-4e32-b760-42daf6da40b1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03276943188143659305666613788609230652156159567580010276938028893641680912092059"
]
},
"execution_count": 443,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(5000), BigFloat(300))"
]
},
{
"cell_type": "code",
"execution_count": 444,
"id": "a2f33f13-ffbd-46da-b097-31adbc77cba6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03600990664668442644078054776003486581759727445576727174459893820546463645340896"
]
},
"execution_count": 444,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(10000, 200))"
]
},
{
"cell_type": "code",
"execution_count": 445,
"id": "bca88540-2f64-4ede-add4-36a1ebc6857b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03600990664668442608600960822060793808210169710993873233888682978879271656335282"
]
},
"execution_count": 445,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(10000), BigFloat(200))"
]
},
{
"cell_type": "code",
"execution_count": 446,
"id": "1431924a-7790-45ac-aeec-f0f4248835ce",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"41.58105951222148"
]
},
"execution_count": 446,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ρatm = ρn2(1.01325e5, 293.15)"
]
},
{
"cell_type": "code",
"execution_count": 447,
"id": "60ac3c9f-7e38-4fec-bd3f-766499bc33d9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02547268399436569854852004147471750939605031705263036031149280542692716386774205"
]
},
"execution_count": 447,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(ρatm, 293.15))"
]
},
{
"cell_type": "code",
"execution_count": 448,
"id": "8c5de25e-76e7-4aaf-b630-9bd6d3484a1f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02593608667121784255154131527931323480079714976118126498256590140203127919881928"
]
},
"execution_count": 448,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(0, 300))"
]
},
{
"cell_type": "code",
"execution_count": 449,
"id": "c4caca33-ad35-43aa-900b-04426837b733",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02593608667121784013963971373148787296652647801054477325138569618925646741186437"
]
},
"execution_count": 449,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(0), BigFloat(300))"
]
},
{
"cell_type": "code",
"execution_count": 450,
"id": "217e7fe5-9958-417a-a74d-1febb23f7a6f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.00927749392871776713910514104183435305005724945855386717792512728375971553062074"
]
},
"execution_count": 450,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(0, 100))"
]
},
{
"cell_type": "code",
"execution_count": 451,
"id": "1fed21b6-2440-46de-82b7-8b40349dbbc7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.009277493928717769570614236010251825856602571761573130419573458478105581491863788"
]
},
"execution_count": 451,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(0), BigFloat(100))"
]
},
{
"cell_type": "code",
"execution_count": 452,
"id": "c2fae269-edbd-4dae-8830-f90194cc3614",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1038342450302420641403411394640530736047340847244110758645760258348835338671782"
]
},
"execution_count": 452,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(25000, 100))"
]
},
{
"cell_type": "code",
"execution_count": 453,
"id": "63eff637-8455-4004-83ab-9818294fc2b0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.1038342450302421167092440470479961347902925704881382204594676233341878766113536"
]
},
"execution_count": 453,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(25000), BigFloat(100))"
]
},
{
"cell_type": "code",
"execution_count": 454,
"id": "5c276e62-4840-47bd-8869-212b26acf5ea",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03600990664668442644078054776003486581759727445576727174459893820546463645340896"
]
},
"execution_count": 454,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(10000, 200))"
]
},
{
"cell_type": "code",
"execution_count": 455,
"id": "507a8fcb-3d89-4ebb-aa7e-500439f02f7f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03600990664668442608600960822060793808210169710993873233888682978879271656335282"
]
},
"execution_count": 455,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(10000), BigFloat(200))"
]
},
{
"cell_type": "code",
"execution_count": 456,
"id": "d4f25c66-9331-44c4-bf26-2d669fa0c2e5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.6758005439333020275702825386057180036631593812691489950818328132721624041932334"
]
},
"execution_count": 456,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(λ(11.18*1000, 126.195))"
]
},
{
"cell_type": "code",
"execution_count": 457,
"id": "a09b508a-14fc-4fab-a71f-10d7ff00dcf4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.6758005439060103689817855325592482061057559760527740399764477777138595715630296"
]
},
"execution_count": 457,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λjl(BigFloat(11.18*1000), BigFloat(126.195))"
]
},
{
"cell_type": "markdown",
"id": "29a0983e-b751-4e9e-96a4-292967f03d61",
"metadata": {},
"source": [
"These values are consistent with Lemmon and Jacobsen [58]."
]
},
{
"cell_type": "markdown",
"id": "e0e135af-d3ed-4860-835b-68f84b374b9d",
"metadata": {},
"source": [
"Define a Julia function of pressure and temperature."
]
},
{
"cell_type": "code",
"execution_count": 458,
"id": "2c0e96bb-85b1-44da-a0a5-f859c9f6323e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"λn2pT (generic function with 1 method)"
]
},
"execution_count": 458,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2pT(p1, T1) = λjl(ρn2(p1, T1), T1)"
]
},
{
"cell_type": "markdown",
"id": "5a087ffd-ee1d-4336-b496-3424faa640ef",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 459,
"id": "314de2d1-4f36-45ee-80a6-436a3f63c882",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02547268399436570281442150459929394026068295063947083411225377747581176178426063"
]
},
"execution_count": 459,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2pT(BigFloat(ptab[1]), BigFloat(Ts))"
]
},
{
"cell_type": "markdown",
"id": "32e95a60-4906-4b75-ae26-cfd4a330de6e",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 460,
"id": "97a084c1-1864-4c76-9a08-ea90e72dbddc",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.02411266364692964648117373505203433960190574943379017008293212916528749772400713"
]
},
"execution_count": 460,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2pT(BigFloat(ptab[1]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "27b89916-56ef-4d4a-8a1f-051cc7611de5",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 461,
"id": "b253b459-b94e-4dff-9383-0cb741016522",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03011517570248097487490472645887270406055623006918043120607837695502260353485743"
]
},
"execution_count": 461,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2pT(BigFloat(ptab[1001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "5683ffc7-a977-4a0f-816f-0c066457771b",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 462,
"id": "4ce9ea53-7ba2-4ad1-9ff9-7da366bde85e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.03767604699713436367484567897929596041103363588111304781972736813817581470028605"
]
},
"execution_count": 462,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2pT(BigFloat(ptab[2001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "7a8205ca-9ff3-4f1c-83f6-543b7fd465a6",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 463,
"id": "1c5551e2-8e6c-498b-a043-a6257721e00f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.04961651940347419883003901981159847949864951999584535801155480327794897706239042"
]
},
"execution_count": 463,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2pT(BigFloat(ptab[end]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "5b766e01-c523-44ea-aa2f-38aa1b8123a6",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 464,
"id": "b420866d-c88a-4b99-a56d-5c5415d2ed28",
"metadata": {},
"outputs": [],
"source": [
"λn2tab = map(p -> convert(Float64, λn2pT(BigFloat(p), BigFloat(Tcold))), ptab);"
]
},
{
"cell_type": "code",
"execution_count": 465,
"id": "853b4067-51c6-4d74-a840-57c6b8f9a225",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(0.024112663646929648, 0.030115175702480974, 0.037676046997134366, 0.049616519403474196)"
]
},
"execution_count": 465,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"λn2tab[1], λn2tab[1001], λn2tab[2001], λn2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "4942dae9-1ff4-462f-971e-285c8da75931",
"metadata": {},
"source": [
"#### 5.2.8. Thermal Diffusivity"
]
},
{
"cell_type": "markdown",
"id": "a8b8d916-a443-48bd-89d1-9eded1f83be8",
"metadata": {},
"source": [
"Use the thermal diffusivity definition in Ainslie and Leighton [1]."
]
},
{
"cell_type": "code",
"execution_count": 466,
"id": "279a18a4-2208-41a4-8de8-5eb5b9b53bb1",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"α (generic function with 1 method)"
]
},
"execution_count": 466,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"α(ρ1, T1) = ((λ(ρ1, T1) / (ρ1 * cp))(δ => ρ/ρc, τ => Tc/T))(ρ => ρ1, \n",
" T => T1, M => MO2)"
]
},
{
"cell_type": "markdown",
"id": "5c5c324b-5dcb-4664-a1bd-b29a3d161a50",
"metadata": {},
"source": [
"Calculate a value. Recall that the `ρn2tab` array is a mass density. We must divide it by molar mass `MN2` to get molar density."
]
},
{
"cell_type": "code",
"execution_count": 467,
"id": "293e3860-c7fa-4489-a509-c45e22500828",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9.53771380581238216611683959570908533506480226109361649956403874857159298485278e-08"
]
},
"execution_count": 467,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N(α(ρn2tab[end]/MN2, Tcold))"
]
},
{
"cell_type": "markdown",
"id": "fe6d3c16-c2a5-49f3-9680-8f65200a64d2",
"metadata": {},
"source": [
"Define a Julia function."
]
},
{
"cell_type": "code",
"execution_count": 468,
"id": "17015832-e51f-4a82-a7a7-6d6dc62aa785",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"αjl (generic function with 1 method)"
]
},
"execution_count": 468,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αjl(ρ1, T1) = λjl(ρ1, T1) / (ρ1 * cpjl(ρ1, T1))"
]
},
{
"cell_type": "code",
"execution_count": 469,
"id": "b7951eb3-bbb9-4d4d-bacf-16d8545377e6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9.537713805812383382597846633568194286885392932676980953772982349040826645988277e-08"
]
},
"execution_count": 469,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αjl(BigFloat(ρn2tab[end]/MN2), BigFloat(Tcold))"
]
},
{
"cell_type": "code",
"execution_count": 470,
"id": "2e81b57f-9d3f-4268-bbfe-97320e18590f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"αn2pT (generic function with 1 method)"
]
},
"execution_count": 470,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(p1, T1) = αjl(ρn2(p1, T1), T1)"
]
},
{
"cell_type": "code",
"execution_count": 471,
"id": "0c3db512-41bb-4c6f-bd94-7851588800ee",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9.53771380581238389620628978927454593976835927404818426253464594573344068200228e-08"
]
},
"execution_count": 471,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(BigFloat(ptab[end]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "bcf8051c-f3ab-4603-801c-5056da35cdf4",
"metadata": {},
"source": [
"Warm surface value"
]
},
{
"cell_type": "code",
"execution_count": 472,
"id": "13897667-dc49-4656-b653-803eaf60f0f3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2.100004083247022093503946771936644530470311760559136620822034024827056013541225e-05"
]
},
"execution_count": 472,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(BigFloat(ptab[1]), BigFloat(Ts))"
]
},
{
"cell_type": "markdown",
"id": "dc13b187-931c-49b2-937f-33ce075f205c",
"metadata": {},
"source": [
"Cold surface value"
]
},
{
"cell_type": "code",
"execution_count": 473,
"id": "e3dedb36-ea4c-497d-acca-7967783e93d0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.861946262897033998571748386675681825481124421867655633040351932072680469144438e-05"
]
},
"execution_count": 473,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(BigFloat(ptab[1]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "e375999b-c673-49de-ae5b-4d3f99a16694",
"metadata": {},
"source": [
"Value at depth 1000 m (`dvals` index 1001)"
]
},
{
"cell_type": "code",
"execution_count": 474,
"id": "1b6f463c-de63-41b2-9fa1-a7bbba15af37",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.913800129237647329608957909779612257816209851330371210293404763124807863569153e-07"
]
},
"execution_count": 474,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(BigFloat(ptab[1001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "9223cbfa-4c8e-4a75-862a-3465f06a1fb9",
"metadata": {},
"source": [
"Value at depth 2000 m (`dvals` index 2001)"
]
},
{
"cell_type": "code",
"execution_count": 475,
"id": "f968eb12-975a-4631-8876-f21535cf6f47",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1.14299948890961679506500684513208826851235137428382537456727572856169743355277e-07"
]
},
"execution_count": 475,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(BigFloat(ptab[2001]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "4619cefd-6290-4f5a-bb9b-68dcc379b6d3",
"metadata": {},
"source": [
"Deep water value"
]
},
{
"cell_type": "code",
"execution_count": 476,
"id": "c07cbe2d-1ce9-4ea5-b5f6-19f033a2ff21",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"9.53771380581238389620628978927454593976835927404818426253464594573344068200228e-08"
]
},
"execution_count": 476,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2pT(BigFloat(ptab[end]), BigFloat(Tcold))"
]
},
{
"cell_type": "markdown",
"id": "032ca820-151c-4b36-af0b-94bb6d7ff7a8",
"metadata": {},
"source": [
"Calculate values for the depth profile."
]
},
{
"cell_type": "code",
"execution_count": 477,
"id": "d8106dae-5f99-415f-b304-da1b26fa8ba8",
"metadata": {},
"outputs": [],
"source": [
"αn2tab = map(p -> convert(Float64, αn2pT(BigFloat(p), BigFloat(Tcold))), \n",
" ptab);"
]
},
{
"cell_type": "code",
"execution_count": 478,
"id": "db971fc6-b156-4d64-b333-861041eeb10b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.861946262897034e-5, 1.9138001292376474e-7, 1.1429994889096169e-7, 9.537713805812384e-8)"
]
},
"execution_count": 478,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"αn2tab[1], αn2tab[1001], αn2tab[2001], αn2tab[end]"
]
},
{
"cell_type": "markdown",
"id": "7a984d89-3271-4038-af76-99628f5aa663",
"metadata": {},
"source": [
"Add these values to the dataframe."
]
},
{
"cell_type": "code",
"execution_count": 479,
"id": "c338533f-e00d-42a0-9715-c442e12775e1",
"metadata": {},
"outputs": [],
"source": [
"valsn2.thermal_diffusivity = αn2tab;"
]
},
{
"cell_type": "markdown",
"id": "765a7e89-03ed-4ab2-9a3d-f612ae2d8324",
"metadata": {
"tags": []
},
"source": [
"#### 5.2.9. Export Nitrogen Parameters"
]
},
{
"cell_type": "markdown",
"id": "ffb730fa-1ae8-4872-9b4a-616b9937cd02",
"metadata": {},
"source": [
"We have all the needed nitrogen parameters in `valsn2`. Export them to a CSV file."
]
},
{
"cell_type": "markdown",
"id": "eebf0177-e3da-43e7-a055-b9dbf1b65272",
"metadata": {},
"source": [
"Here are the column names."
]
},
{
"cell_type": "code",
"execution_count": 480,
"id": "de54a4d3-7ba0-4234-bb30-ace2c87c89b4",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8-element Vector{String}:\n",
" \"depth\"\n",
" \"pressure\"\n",
" \"water_density\"\n",
" \"water_dyn_viscosity\"\n",
" \"water_surface_tension\"\n",
" \"water_sound_speed\"\n",
" \"gamma\"\n",
" \"thermal_diffusivity\""
]
},
"execution_count": 480,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"names(valsn2)"
]
},
{
"cell_type": "markdown",
"id": "a1699f90-de1a-4dd9-92a0-6ed23ec1f3ab",
"metadata": {},
"source": [
"Reorder the dataframe columns to match the order that the acoustic calculations require."
]
},
{
"cell_type": "code",
"execution_count": 481,
"id": "19ecef44-8e5e-45e8-8837-ba8656afb24e",
"metadata": {},
"outputs": [],
"source": [
"select!(valsn2, [\"depth\", \"water_density\", \"pressure\", \"water_dyn_viscosity\", \n",
" \"water_surface_tension\", \"water_sound_speed\", \n",
" \"thermal_diffusivity\", \"gamma\"]);"
]
},
{
"cell_type": "code",
"execution_count": 482,
"id": "63a9ccba-2c91-464a-bf33-dea626776142",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"DeepWaterPropertiesN2.csv\""
]
},
"execution_count": 482,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"CSV.write(\"DeepWaterPropertiesN2.csv\", valsn2)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.7.2",
"language": "julia",
"name": "julia-1.7"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}