Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.41 KB

README.md

File metadata and controls

48 lines (32 loc) · 1.41 KB

GSW-FreePascal

GSW-FreePascal is a FreePascal/Lazarus wrapper for GSW-C, which is the C implementation of the Thermodynamic Equation of Seawater 2010 (TEOS-10).

Installation

This module is just a wrapper so you have to have a binary version of GSW-C installed on your machine.

There are two ways of getting it:

1). Build it yourself following GSW-C instructions. This way is highly recommended;

2). Use precompiled binaries. This approach is experimental and may not work on your system.

To use the module in your code simply copy 'gibbsseawater.pas' into your project folder and add it to the 'uses' section.

uses GibbsSeaWater; 

If you work on Windows just put 'libgswteos-10.dll' next to your executable.

Example

Procedure GSW_test;
Var
  sa, ct, t, p: double; //initial data
  res1, res2, res3:double; //results
Begin
  sa:=36;
  ct:=28;
  t:= 20;
  p:= 1023;
 
  res1:=gsw_adiabatic_lapse_rate_from_ct(sa, ct, p);
  res2:=gsw_c_from_sp(sp, t, p);
  res3:=gsw_cp_ice(t, p);

  writeln(res1+#9+res2+#9+res3);
End;

More information on the functions can be found here.

About TEOS-10

Comprehensive info on TEOS-10 can be found on the official site and official repository.