Skip to content

Commit

Permalink
Added notebooks for week 3 (FlorisCalkoen#84)
Browse files Browse the repository at this point in the history
* Add files via upload

* coastal kernel

---------

Co-authored-by: floriscalkoen <[email protected]>
  • Loading branch information
ChristiaanDHoogervorst and floriscalkoen authored Feb 29, 2024
1 parent 54c50d8 commit 79b26ba
Show file tree
Hide file tree
Showing 2 changed files with 622 additions and 0 deletions.
148 changes: 148 additions & 0 deletions notebooks/3b_wave_transformation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "a57196e5-eb53-4eab-8bb2-b11c2a313e56",
"metadata": {},
"source": [
"<figure>\n",
" <IMG SRC=\"https://raw.githubusercontent.com/mbakker7/exploratory_computing_with_python/master/tudelft_logo.png\" WIDTH=250 ALIGN=\"right\">\n",
"</figure>"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fcad68ab-a006-40c5-93ad-5eb0a10e41e8",
"metadata": {},
"outputs": [],
"source": [
"%run Initialize/init_3b.ipynb"
]
},
{
"cell_type": "markdown",
"id": "9a3b7540-f1c8-4188-9321-c162619892e7",
"metadata": {},
"source": [
"# 1) Wave asymmetry and skewness "
]
},
{
"cell_type": "markdown",
"id": "9c61dd36-8df2-48f7-b54e-a4f2f5af06a2",
"metadata": {},
"source": [
"Wave asymmetry and skewness can be demonstrated by using a second order wave, as in equation 1. The phase difference between the wave componets influences the shape of the combined wave. You can assess the impact of phase differences and the amplitudes on the assymetry on skewness in the interactive graph below. The figures 5.13 and 5.16 of the book can be reproduced with this figure, without scaling the y-axis. What are the amplitudes and the phases of wave component 1 and 2 to reproduce these figures? You can check it below the graph.\n",
"\n",
"\\begin{equation}\n",
"\\tag{1}\n",
"\\eta = \\eta_1 cos(wt-kx-\\phi_1) + \\eta_2 cos(2(wt-kx)-\\phi_2)\n",
"\\end{equation}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d0ce79ef-1e0f-4a72-b152-4b71b46f5ab8",
"metadata": {},
"outputs": [],
"source": [
"second_order_waves()"
]
},
{
"cell_type": "markdown",
"id": "67ead777-88c0-4389-9998-f117368fae50",
"metadata": {},
"source": [
"Can you make the left panel of figure 5.15, without scaling to (dividing by) $\\eta_1$? You can rewrite equation 1 such that the surface elevation is a function of x/L. You may assume that t=0 to simplify the process. You can put this equation in the formula below to check your outcome, which will automatically be plotted for 3 wave lenghts."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c1f2816b-95f2-4e6a-8606-5fb329f8b81f",
"metadata": {},
"outputs": [],
"source": [
"x_L = 1 # The ratio of x/L (an arbitrary value can be usefull to check your code)\n",
"eta1 = 1\n",
"eta2 = ...\n",
"phi1 = ...\n",
"phi2 = ...\n",
"\n",
"\n",
"def second_order_waves_x_L(x_L, eta1, eta2, phi1, phi2):\n",
" ...\n",
" return eta\n",
"\n",
"show_second_order_waves_x_L()"
]
},
{
"cell_type": "markdown",
"id": "6cdff687-6362-43c1-834b-ab569f4d017c",
"metadata": {},
"source": [
"Can you rewrite equation 1 now so that the surface elavation is a function of t/T. You may assume that x=0 to simplify the process. You can put this equation in the formula below to check your outcome.\n",
"figuur 5.15 right panel, x-axis etc."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ee83ee3c-a7fa-4f7a-80cb-cfb6fbdc3758",
"metadata": {},
"outputs": [],
"source": [
"t_T = 1# t/T, an arbitrary value for testing\n",
"\n",
"def second_order_waves_t_T(t_T, more_arguments):\n",
" ...\n",
" return eta\n",
"\n",
"show_second_order_waves_t_T()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8a4143ae-5b9c-4011-86de-4f9a4ed9d646",
"metadata": {},
"outputs": [],
"source": [
"Skewed_assymetric_waves()"
]
},
{
"cell_type": "markdown",
"id": "d34dd514-32ab-4a9b-9932-d39c47547dfb",
"metadata": {},
"source": [
"A final thought provocing question on this section, what is the influence on the time/space averaged value of $\\eta^3$ when the amplitudes and phases of the wave components change?"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:coastal] *",
"language": "python",
"name": "conda-env-coastal-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 79b26ba

Please sign in to comment.