Skip to content

Instantly share code, notes, and snippets.

@jklymak
Created May 26, 2017 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jklymak/156c30b5344a9cf63e8aebc429fee1c6 to your computer and use it in GitHub Desktop.
Save jklymak/156c30b5344a9cf63e8aebc429fee1c6 to your computer and use it in GitHub Desktop.
Pressure in the MITgcm
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "# Pressure in the `MITgcm`\n\nI use the linear equation of state in the ocean. Hopefully things are consistent for other equations of state.\n\nThe variable written in the files `PH.*.data` is `totPhiHyd`. This is set in `diags_phi_hyd.F` as the sum of `phyHydC` at the local level and the surface pressure calculated from `EtaN` and the surface buoynacy anomaly.\n\nThe variable `phyHydC` is calculated in `calc_phi_hyd.F` and is calculated from \n```fortran\n phiHydC(i,j) = phiHydF(i,j)\n & + dRlocM*gravity*alphaRho(i,j)*recip_rhoConst\n```\nSo the units are $m^2s^{-2}$. `alphaRho(i,j)` is filled before this as: `alphaRho(i,j) = rhoInSitu(i,j,k,bi,bj)`, and `rhoInSitu` is set in `do_ocean_physics.F`. There it is set by calling `calc_rho_2d`:\n```fortran\n DO k=1,Nr\n CALL FIND_RHO_2D(\n I iMin, iMax, jMin, jMax, k,\n I theta(1-OLx,1-OLy,k,bi,bj),\n I salt (1-OLx,1-OLy,k,bi,bj),\n O rhoInSitu(1-OLx,1-OLy,k,bi,bj),\n I k, bi, bj, myThid )\n ENDDO\n```\nHere the first `k` is `kref` in `find_rho_2d` and the actual calculation for a linear EOS is simply:\n```fortran\n refTemp=tRef(kRef)\n refSalt=sRef(kRef)\n\n dRho = rhoNil-rhoConst\n\n DO j=jMin,jMax\n DO i=iMin,iMax\n rhoLoc(i,j)=rhoNil*(\n & sBeta*(sFld(i,j)-refSalt)\n & -tAlpha*(tFld(i,j)-refTemp) )\n & + dRho\n ENDDO\n ENDDO\n```\n\nSo what does this mean in math? It means that `PH` is:\n\n$$ Ph = \\frac{1}{\\rho_0}\\int_z^{\\eta} (\\rho(x,y,z,t)-\\rho_R(z)) g\\ dz$$ \n\nIf `tRef` is a constant with depth, the $\\rho_R(z)$ is a constant, but if `tRef` is a profile (as I usually do) then it depends on $z$.\n\n\n\n\n\n"
},
{
"metadata": {},
"cell_type": "markdown",
"source": "## `PHrefC`\n\nThis variable, in my setup, is just $\\int_z^0 g\\ dz$ Why the model saves this, I don't understand. It is written in `write_grid.F` from `phiRef`, which is a `2Nr` long variable with all the pressures. This indeed does not include the reference density \"anomally\"\n\n\n\n\n"
},
{
"metadata": {
"collapsed": true,
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.6.0",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"toc": {
"threshold": 4,
"number_sections": true,
"toc_cell": false,
"toc_window_display": false,
"toc_section_display": "block",
"sideBar": true,
"navigate_menu": true,
"moveMenuLeft": true,
"widenNotebook": false,
"colors": {
"hover_highlight": "#DAA520",
"selected_highlight": "#FFD700",
"running_highlight": "#FF0000"
},
"nav_menu": {
"height": "51px",
"width": "252px"
}
},
"gist": {
"id": "",
"data": {
"description": "Pressure in the MITgcm",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment