My attempt at fitting a simple energy balance model into an OpenGL compute shader.
Requires NetCDF, GLFW, and OpenGL. It may be necessary to fiddle with LFLAGS
and CFLAGS
inside the Makefile, depending on your system configuration.
TODO: Add and document process switches.
The outgoing long-wave radiation
Where
TODO.
The albedo
Where
The surface temperature
And is then used to compute
Where
Where the depth is a configurable parameter.
TODO.
The moist amplification factor
TODO.
After you have installed the necessary dependencies, simply run:
make
to compile the executable, which will be named glEBM
by default.
The model expects to be fed a NetCDF file with two dimenstions: lat
, and lon
. It uses these to pick grid cell centers and to identify the dimensions of the model. In order for the model to function, the model dimensions must both be multiples of 32.
The following optional parameters (along with their default values) are listed below:
- Initial surface temperature (
T
,Ts
,Temperature
,temperature
). Defaults to 273.15K. - Parameter A for A+BT (
A
,As
). Defaults to 210.0 W/m2. - Parameter B for A+BT (
B
,Bs
). Defaults to 2.0 W/m/K. - Water depth (
depth
,depths
). Defaults to 30.0 m. - Albedo parameter
$a_{0}$ (a0
,a0s
). Defaults to 0.3. - Albedo parameter
$a_{2}$ (a2
,a2s
). Defaults to 0.078. - Albedo parameter
$a_{i}$ (ai
,ais
). Defaults to 0.62.
The model may be executed by running:
glEBM <path_to_input_file.nc> <path_to_output_file.nc>
The results will be placed into a single NetCDF file.