{"id":22930543,"url":"https://github.com/continuum3416/chladni-patterns-generator","last_synced_at":"2025-04-01T17:20:16.282Z","repository":{"id":242182036,"uuid":"808904902","full_name":"Continuum3416/Chladni-Patterns-Generator","owner":"Continuum3416","description":"Generate an unlimited number of Chladni patterns by solving the rectangular and polar wave equation via separation of variables and eigenvalues.","archived":false,"fork":false,"pushed_at":"2025-03-25T02:34:27.000Z","size":45166,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T03:27:36.250Z","etag":null,"topics":["matplotlib","numpy","partial-differential-equations","python","scientific-computing","scipy","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Continuum3416.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-01T05:52:25.000Z","updated_at":"2025-03-25T02:34:30.000Z","dependencies_parsed_at":"2024-06-01T06:54:54.481Z","dependency_job_id":"143ef533-37e6-4c5d-9a35-d99ba28ff382","html_url":"https://github.com/Continuum3416/Chladni-Patterns-Generator","commit_stats":null,"previous_names":["continuum3416/physics_4c_project","continuum3416/chladni-patterns-generator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Continuum3416%2FChladni-Patterns-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Continuum3416%2FChladni-Patterns-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Continuum3416%2FChladni-Patterns-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Continuum3416%2FChladni-Patterns-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Continuum3416","download_url":"https://codeload.github.com/Continuum3416/Chladni-Patterns-Generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246679068,"owners_count":20816402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["matplotlib","numpy","partial-differential-equations","python","scientific-computing","scipy","simulation"],"created_at":"2024-12-14T10:28:41.624Z","updated_at":"2025-04-01T17:20:16.276Z","avatar_url":"https://github.com/Continuum3416.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chladni Pattern Generator\nGenerating patterns made by particles on a vibrating plate, also known as Chladni patterns, using square and polar wave equation models. A project for Physics 4C, under the Department of Physics and Engineering. Link to the report here: \u003ca href = 'https://don-le.vercel.app/Chladni_Plate.pdf' target=\"_blank\"\u003e Chladni_Report \u003c/a\u003e (or you can just view the pdf in the docs directory).\n\n#### Python and Packages:\n* Python 3.13.1\n* Numpy 2.2.0\n* Matplotlib 3.10.0\n* Scipy 1.15.2\n* Itertools\n\n\n#### Main Project Files\n* [The Cartesian Model](square_wave_equation.py)\n* [The Polar Model](polar_wave_equation.py)\n* [Plotting Specified Indexes for the Square Plate](specified_indexes.py)\n\n## Introduction\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"70k-objects\" src=\"assets/media/chladniarray.jpg\" width = \"650\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cem\u003eChladni Patterns created in a modern lab environment (thin plates).\u003c/em\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"70k-objects\" src=\"assets/media/ChladniG.gif\" width = \"300\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003cem\u003eChladni Patterns on a thick aluminum plate.\u003c/em\u003e\n\u003c/p\u003e\n\n## Code Preview\n\nFor the first and second figures right below, patterns of the same consecutive color are patterns of the same modes.\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"70k-objects\" src=\"images/dark_chladni.png\" width = \"650\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"70k-objects\" src=\"images/dark_chladni_2.png\" width = \"650\"\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"70k-objects\" src=\"images/dark_polar.png\" width = \"650\"\u003e\n\u003c/p\u003e\n\n\n## Advanced Wave Mechanics: A Brief Overview\n\n### The Wave Equation On Cartesian Coordinates\nThe multi-dimensional wave equation on $\\Omega  = \\\\{(x,y)\\in\\mathbb{R}^2 | -a\\leq x,y\\leq a\\\\}$,\n\n$$\\frac{\\partial^2u}{\\partial t^2} = c^2\\left(\\frac{\\partial^2u}{\\partial x^2}  + \\frac{\\partial^2u}{\\partial y^2} \\right) + Q(x, y, t),\\quad\\quad \\mathbf{x}\\in\\Omega$$\n\nor written more compactly as\n\n$$u_{tt} = c^2\\nabla^2u + Q,\\quad \\mathbf{x}\\in\\Omega $$\n\ncan be used in certain cases to approximate Chladni patterns using the clamped boundary-initial conditions \n\n$$u_x(\\pm a, y, t) = u_y(x, \\pm a, t) = 0, \\quad u(x,y,0) = f(x,y), \\quad u_t(x,y,0) = g(x,y).$$\n\nThe solution to this equation can be expressed as a double Fourier Series,\n\n$$u(x,y,t) = \\frac{1}{4}A_{00} + \\sum_{n=1}^{\\infty}\\sum_{m=1}^{\\infty}X_n(x)Y_n(y)W_{nm}(t),$$\n\nwhere\n\n$$\n\\begin{align}\n    X_n(x) \u0026= a_n\\cos\\left(\\frac{n\\pi x}{L}\\right) + \\overline{a_n}\\sin\\left(\\frac{n\\pi x}{L}\\right),\\\\\n    Y_m(y) \u0026= a_m\\cos\\left(\\frac{m\\pi y}{L}\\right) + \\overline{a_m}\\sin\\left(\\frac{m\\pi y}{L}\\right),\\\\\n    T_{nm}(t) \u0026= A_{nm}\\cos(\\omega t) + B_{nm}\\sin(\\omega t) + \\int_{0}^{t}q_{nm}(\\tau)\\frac{\\sin(\\omega t-\\omega\\tau)}{\\omega}d\\tau,\\\\\n    \\omega \u0026= \\frac{\\pi}{L}c\\sqrt{n^2+m^2}.\n\\end{align}\n$$\n\nand,\n\n$$\n\\begin{alignat}{2}\n    A_{nm} \u0026= \\frac{4}{L^2}\\int_{-L/2}^{L/2}\\int_{-L/2}^{L/2} f(x, y)X_n(x)Y_m(y) dxdy,\\quad \u0026\u0026 n, m= 0, 1, 2,\\ldots\\\\\n    B_{nm} \u0026= \\frac{4}{L^2} \\int_{-L/2}^{L/2}\\int_{-L/2}^{L/2} \\frac{g(x, y)}{\\omega}X_n(x)Y_m(y) dxdy,\\quad \u0026\u0026 n, m= 1, 2, 3\\ldots\n\\end{alignat}\n$$\n\nHere, $q_{nm}$ is a function defined on the disk of radius $r$ — the radius of the tip of the wave generator,\n\n$$q_{nm}(\\tau)=\\frac{4\\alpha}{L^2} \\cos(\\omega_0 \\tau) \\iint_{U(r)}X_n(x)Y_m(y)dx dy,$$\n\nwhere $U(r)=\\\\{(x,y)\\in \\mathbb{R}^2 | x^2+y^2\\leq r^2\\\\}$.\n\n\u003e [!NOTE]\n\u003e For more details on how these solutions are obtained, please spend some time to read the \u003ca href = 'https://don-le.vercel.app/Chladni_Plate.pdf' target=\"_blank\"\u003eproject report\u003c/a\u003e.\n\n### The Wave Equation On Polar Coordinates\n\nSimilarly for the wave equation on polar coordinates, \n\n$$u_{tt} = c^2\\left( u_{rr} + \\frac{1}{r}u_r + \\frac{1}{r^2}u_{\\theta\\theta}\\right) + Q, \\quad (r,\\theta)\\in\\Omega,$$\n\nthe solution for the equation in this case is\n\n$$u(r,\\theta, t) = \\sum_{n=0}^{\\infty}\\sum_{m=0}^{\\infty}J_n\\left( kr\\right)[\\Psi_{nm}(\\theta)y_1(t) + \\Phi_{nm}(\\theta)y_2(t)],$$\n\nwhere\n\n$$\n\\begin{aligned}\n    \\Psi_{nm}(\\theta) \u0026= a_{nm}\\cos(n\\theta) + b_{nm}\\sin(n\\theta),\\\\\n    \\Phi_{nm}(\\theta) \u0026= c_{nm}\\cos(n\\theta) + d_{nm}\\sin(n\\theta),\\\\\n    y_1(t) \u0026= \\alpha\\cos(\\omega t) + \\beta\\sin(\\omega t) + \\int_{0}^{t}p_{nm}(\\tau)\\frac{\\sin(\\omega(t-\\tau))}{\\omega}d\\tau,\\\\\n    y_2(t) \u0026= \\gamma\\cos(\\omega t) + \\sigma\\sin(\\omega t) +  \\int_{0}^{t}q_{nm}(\\tau)\\frac{\\sin(\\omega(t-\\tau))}{\\omega}d\\tau,\\\\\n    \\omega \u0026= \\frac{cz_{nm}}{a} = ck.\n\\end{aligned}\n$$\n \nHere, $z_{nm}$ are the zeros of the m-th derivative of the n-th order Bessel function $J_n(x)$. $\\alpha, \\beta, \\gamma, \\sigma$ are arbitrary constants that satisfies $\\alpha + \\gamma = 1,$ $\\beta + \\sigma = 1$, where $\\alpha^2 + \\gamma^2 \\neq 0$, $\\beta^2 + \\sigma^2 \\neq 0$, and,\n\n$$\n\\begin{align}\na_{nm} \u0026= \\frac{\\langle J_0\\cos(n\\theta), f \\rangle_w}{\\langle J_0, J_0 \\rangle_w} = \\frac{\\int_{0}^{a}\\int_{0}^{2\\pi}J_n\\left( kr\\right)\\cos(n\\theta) f(r,\\theta)r drd\\theta}{2\\pi\\int_{0}^{a}J_n^2\\left( kr\\right) rdr},\\quad n, m = 0, 1, \\ldots\\\\\nb_{nm} \u0026= \\frac{\\langle J_0\\sin(n\\theta), f \\rangle_w}{\\langle J_0, J_0 \\rangle_w} = \\frac{\\int_{0}^{a}\\int_{0}^{2\\pi}J_n\\left( kr\\right)\\sin(n\\theta) f(r,\\theta)r drd\\theta}{2\\pi\\int_{0}^{a}J_n^2\\left( kr\\right) rdr},\\quad n, m = 0, 1, \\ldots\\\\\nc_{nm} \u0026= \\frac{\\langle J_0\\cos(n\\theta), g \\rangle_w}{\\omega\\langle J_0, J_0 \\rangle_w} = \\frac{\\int_{0}^{a}\\int_{0}^{2\\pi}J_n\\left( kr\\right)\\cos(n\\theta) g(r,\\theta)r drd\\theta}{2\\pi\\omega\\int_{0}^{a}J_n^2\\left( kr\\right) rdr},\\quad n, m = 0, 1, \\ldots\\\\\nd_{nm} \u0026= \\frac{\\langle J_0\\sin(n\\theta), g \\rangle_w}{\\omega\\langle J_0, J_0 \\rangle_w} = \\frac{\\int_{0}^{a}\\int_{0}^{2\\pi}J_n\\left( kr\\right)\\sin(n\\theta) g(r,\\theta)r drd\\theta}{2\\pi\\omega\\int_{0}^{a}J_n^2\\left( kr\\right) rdr},\\quad n, m = 0, 1, \\ldots\n\\end{align}\n$$\n\n\n\u003e [!NOTE]\n\u003e All derivations above is only an approximation of the true model. The actual equation that governs the behavior of Chladni patterns is something called the Biharmonic Wave Equation, written fully as\n\u003e \n\u003e $$\\rho h\\frac{\\partial^2w}{\\partial t^2} = - D\\nabla^4 w + T\\nabla^2 w -K_0w -K_1\\frac{\\partial w}{\\partial t} + T_1\\nabla^2\\frac{\\partial w}{\\partial t} + F(\\textbf{x}, t),$$ \n\u003e \n\u003e Here, $\\rho$ is the density, $K_0$ is the linear stiffness coefficient, representing the linear storing force, $T$ is the tension coefficient, $K_1$ is the linear damping term, $T_1$ is the visco-elastic damping coefficient, $F(\\mathbf{x}, t)$ is the forcing function, and $D$ is defined as \n\u003e \n\u003e $$D = \\frac{Eh^3}{12(1-\\nu^2)},$$\n\u003e \n\u003e which includes the flexural rigidity constant $\\nu$, $E$ is young's modulus, and $h$ is the thickness of the plate.\n\u003e \n\u003e Read more about this topic in this [paper](https://arxiv.org/abs/2008.01693).\n\n\n## Contribution\n\nThis code is distributed under the MIT license. Feel free to modify it and submit a pull request.\n\n\u003e [!IMPORTANT]\n\u003e What I'm looking for: Please ensure accuracy with respect to the mathematical model.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontinuum3416%2Fchladni-patterns-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontinuum3416%2Fchladni-patterns-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontinuum3416%2Fchladni-patterns-generator/lists"}