marelac: sea water properties

## =========================================================================
## implemented by Karline Soetaert
## =========================================================================
require(marelac)

Sal  <- seq(0, 40, by = 0.5)
Temp <- seq(-5, 40, by = 0.5)

plotFUN <- function(fun, title, units) {
 Val  <- outer(X = Sal, Y = Temp, FUN = function(X, Y) fun(S = X, t = Y))

 image2D(Sal, Temp, z = Val, xlab = "Salinity", ylab = "temperature",
    main = title, nlevel = 20, clab = "units")
}
 par (mfrow = c(3, 2), mar = c(4, 4, 3, 2))
 plotFUN(sw_gibbs,   "Gibbs function", "J/kg")
 plotFUN(sw_cp,      "Heat capacity",  "J/kg/dgC")
 plotFUN(sw_entropy, "Entropy",         "J/kg/dgK")
 plotFUN(sw_enthalpy,"Enthalpy",        "J/kg")
 plotFUN(sw_dens,    "Density",         "kg/m3")
 plotFUN(sw_svel,    "Sound velocity",  "m/s")

Go back