Git Product home page Git Product logo

nichollsh / socrates Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 63.29 MB

Redistributed on GitHub from the original TRAC repository, with modifications and additions.

Home Page: https://code.metoffice.gov.uk/trac/socrates

License: BSD 3-Clause "New" or "Revised" License

Shell 1.03% Fortran 90.78% OpenEdge ABL 0.09% q 1.78% Terra 1.78% HiveQL 0.11% Raku 0.11% IDL 0.54% Makefile 0.08% Julia 0.72% Perl 0.04% Python 2.83% C 0.12%

socrates's Introduction

SOCRATES

Suite Of Community RAdiative Transfer codes based on Edwards and Slingo.

Rehosted from the original MetOffice source [1] with modifications by Harrison Nicholls.

Contents:

  1. Licence
  2. What's included?
  3. [Omitted in this redistribution of the code]
  4. Compiling the source code externally
  5. Compilation of scripts in sbin
  6. Running the code
  7. Tested compilers
  8. Contributors

0) BSD 3-Clause licence

(C) Crown copyright Met Office. All rights reserved. For further details please refer to the file COPYRIGHT.txt which you should have received as part of this distribution.

1) What's included?

src/ contains the source code in Fortran 95 (.f90) and a few remaining in Fortran 77 (.f).

make/ contains the Makefile which then accesses the various Mk_* files.

sbin/ contains scripts that can be used to run the fortran routines.

man/ contains man pages for scripts in sbin/. For example, running man Cl_run_cdf will give options for that script.

examples/ and data/ provide test input for the radiation code. See the CONTENTS in each directory under examples/ for instructions.

idl/ and python/ contain scripts to generate atmospheric profiles etc in netCDF format to be used as input for the radiation code (l_run_cdf).

docs/ contain the user guide and technical guide for the ES code.

spectraltools/ contains new addons to the code which allow for streamlined and flexible creation of spectral files from precomputed cross-sections.

3) Compiling the source code externally

For external users it should only be necessary to edit the file make/Mk_cmd to allow compilation of the code on your system. FORTCOMP and LINK can be changed to your local Fortran compiler. To use the netCDF routines you must also change INCCDF_PATH and LIBCDF_PATH to point to your local netCDF installation.

The following commands can then be run to build the suite and setup your path to the executables and man pages:

./configure ./build_code
source ./set_rad_env

4) Compilation of scripts in sbin

There are a small number of utilities in sbin/ which are written in C and require compilation. A Makefile has been provided:

cd $RAD_SCRIPT make

5) Running the code

Once you have set your path to the man pages (see section 2/3) you can find up-to-date instructions for running the following routines:

Two-stream and spherical harmonics radiance codes using netCDF or text CDL input files:

man Cl_run_cdf man Cl_run_cdl

A Mie scattering code for determining optical properties of aerosol and cloud particles:

man Cscatter

A correlated-k code for the calculation of gaseous absorption coefficients for the spectral files either directly from HITRAN .par or .xsc databases or line-by-line absorption coefficients in a netCDF input file:

man Ccorr_k

Auxillary routines for format conversion, interpolation etc:

man Ccdf2cdl man Ccdl2cdf man Cinterp

These scripts are a command line interface to interactive routines in the bin/ directory. These routines may be run directly if desired (eg. l_run_cdf).

It is very useful to study the examples/ directory for common usage of the code.

6) Tested compilers

The full suite has been tested with the following compilers:

  • Intel ifort 17.0.7
  • GCC gfortran 9.4.0

7) Contributors

Significant contributors include:

  • J. Edwards
  • A. Slingo
  • J. Manners

References

socrates's People

Contributors

lsoucasse avatar nichollsh avatar stefsmeets avatar

Watchers

 avatar

Forkers

formingworlds

socrates's Issues

Make the code more portable

The portable builds fail on my machine (Fedora) with Program received signal SIGSEGV: Segmentation fault - invalid memory reference. It appears that the code is not statically compiled

Currently the code is compiled with -march=native, if we want portable builds we should change this to -march=x86-64.

  • Compile with -march=x86-64
  • Static compilation (-static)
  • Dump backtraces to find exact reason for segfaults (-fbacktrace)

Spectral surface emission

It would be interesting to explore how spectral surface emission changes the energy balance, particularly in the context of exoplanet emission spectroscopy.

There are spectra here: https://dspace.mit.edu/handle/1721.1/74201

In SOCRATES, surface emission is calculated according to the Planck function by default, although a grey albedo can be passed. However, there are seemingly also routines for setting this spectrally. This should be explored further.

Add water ice scattering data to spectral files

SOCRATES contains data for including the scattering properties of water ice clouds. These could be added to the spectral files in the spectraltools pipeline.

See script below...

#!/bin/bash
# Ryan Boukrouche

name="miniSuran"

socrates_data="/proj/bolinc/users/x_ryabo/SOCRATES/data"
path_sp_sw="/proj/bolinc/users/x_ryabo/spectral_files/Suran/${name}_sw.sf"
path_sp_lw="/proj/bolinc/users/x_ryabo/spectral_files/Suran/${name}_lw.sf"

ver="2022"

rm -f fit_thick_ice_casim_${ver}_${name}_sw.sf mon_thick_ice_casim_${ver}_${name}_sw.sf
Cscatter_average \
-s $path_sp_sw -P 1 -t -S ${socrates_data}/solar/trappist1 \
-f 20 fit_thick_ice_casim_${ver}_${name}_sw.sf \
mon_thick_ice_casim_${ver}_${name}_sw.sf 917 \
${socrates_data}/cloud/scatter_ice_casim_${ver}

echo "Cscatter_average on $path_sp_sw completed."

rm -f fit_thick_ice_casim_${ver}_${name}_lw.sf mon_thick_ice_casim_${ver}_${name}_lw.sf
Cscatter_average -s $path_sp_lw -P 1 -t -p 250 \
-f 20 fit_thick_ice_casim_${ver}_${name}_lw.sf \
mon_thick_ice_casim_${ver}_${name}_lw.sf 917 \
${socrates_data}/cloud/scatter_ice_casim_${ver}

echo "Cscatter_average on $path_sp_lw completed."

prep_spec <<EOF 
${name}_sw.sf
a
12
13
fit_thick_ice_casim_${ver}_${name}_sw.sf
-1
EOF

echo "prep_spec on $path_sp_sw completed."

prep_spec <<EOF 
${name}_lw.sf
a
12
13
fit_thick_ice_casim_${ver}_${name}_lw.sf
-1
EOF

echo "prep_spec on $path_sp_lw completed."

Which will need to be translated into Python.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.