{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Doinikov Rigid (1994): Sandstone in Glycerin\n6.b.ii. Doinikov compute the acoustic radiation force on a sandstone\nparticle in water and in glycerin. Doinikov shows that the acoustic\nradiation force will change sign in the case $|x| \\ll |x_v| \\ll 1$,\ni.e. if the particle and the viscous boundary layer are small compared to\nthe wavelength and the boundary layer is much larger than the particle.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "First we need to get an instance of our solution class. In this case\n``osaft.king1934.ARF()`` and ``osaft.doinikov1994rigid.ARF()``. The steps are\nthe same as in the earlier examples.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport numpy as np\n\nimport osaft\n\n# --------\n# Geometry\n# --------\n# Radius\nR_0 = 1e-6  # [m]\n\n# -----------------------\n# Properties of Sandstone\n# -----------------------\n# Density\nrho_sandstone = 7.8e3  # [kg/m^3]\n\n# ----------------------\n# Properties of Glycerin\n# ----------------------\n# Speed of sound\nc_glycerin = 1_964  # [c/m]\n# Density\nrho_glycerin = 1.26e3  # [kg/m^3]\n# dynamic viscosity\neta_glycerin = 0.950  # [Pa s]\n\n\n# -------------------\n# Properties of Water\n# -------------------\n# Speed of sound\nc_water = 1_492  # [m/s]\n# Density\nrho_water = 997  # [kg/m^3]\n# dynamic viscosity\neta_water = 8.9e-4  # [Pa s]\n\n# --------------------------------\n# Properties of the Acoustic Field\n# --------------------------------\n# Frequency\nf = 1e6  # [Hz]\n# Pressure\np_0 = 1e5  # [Pa]\n# Wave type\nwave_type = osaft.WaveType.STANDING\n\n# Theory of Doinikov with glycerin as medium\nD_glycerin = osaft.doinikov1994rigid.ARF(\n    f=f,\n    R_0=R_0,\n    rho_s=rho_sandstone,\n    rho_f=rho_glycerin,\n    c_f=c_glycerin,\n    eta_f=eta_glycerin,\n    zeta_f=0,\n    p_0=p_0,\n    wave_type=wave_type,\n    position=0,\n    long_wavelength=True,\n    large_boundary_layer=True,\n)\nD_glycerin.name = \"Doinikov: Glycerin\"\n\n# Theory of Doinikov with water as medium\nD_water = osaft.doinikov1994rigid.ARF(\n    f=f,\n    R_0=R_0,\n    rho_s=rho_sandstone,\n    rho_f=rho_water,\n    c_f=c_water,\n    eta_f=eta_water,\n    zeta_f=0,\n    p_0=p_0,\n    wave_type=wave_type,\n    position=0,\n)\nD_water.name = \"Doinikov: Water\"\n\n# Theory of King with glycerin as medium\nK_glycerin = osaft.king1934.ARF(\n    f=f,\n    R_0=R_0,\n    rho_s=rho_sandstone,\n    rho_f=rho_glycerin,\n    c_f=c_glycerin,\n    p_0=p_0,\n    wave_type=wave_type,\n    position=0,\n    small_particle_limit=True,\n)\nK_glycerin.name = \"King: Glycerin\"\n\n# Theory of King with water as medium\nK_water = K_glycerin.copy()\nK_water.rho_f = rho_water\nK_water.c_f = c_water\nK_water.name = \"King: Water\""
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "We plot the acoustic radiation force by initializing an instance of\n``osaft.ARFPlot()`` and adding our solutions using ``add_solutions()``.\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# create the x values we want to use for plotting\nx_values = np.linspace(0, np.pi, num=500)\n\n# Plotting the solutions\nplotter = osaft.ARFPlot(\"position\", x_values)\nplotter.add_solutions(D_water, D_glycerin, K_water, K_glycerin)\nplotter.plot_solutions()\n\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "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.9.15"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}