GithubHelp home page GithubHelp logo

rodrigo-caballero / climt-legacy Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 11.0 23.59 MB

Climate modelling and diagnostics toolkit

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

Python 1.32% C 0.43% Fortran 98.00% C++ 0.08% Perl 0.04% Shell 0.03% Objective-C 0.09%

climt-legacy's Introduction

**** CAUTION: 
THIS IS THE LEGACY BRANCH OF CLIMT.
DEVELOPMENT HAS BEEN DISCONTINUED AS OF MID-2017
PLEASE GO TO THE CURRENT BRANCH https://github.com/CliMT/climt 
****


CliMT: Climate Modeling and Diagnostics Toolkit

CliMT is a Python-based software component toolkit which provides a
 flexible, multi-purpose problem-solving environment geared to climate
 science problems.

See http://people.su.se/~rcaba/climt for further details.

Requirements:
Python 2.4 or higher
Numpy 1.0 or higher
GNU gcc and a Fortran compiler

Installation:
Make sure that numpy is installed, and that the version of f2py 
on your path is the one installed by numpy. Then:

python setup.py build

will build the package using the default fortran compiler. For
information on the compilers available on your platform:
f2py -c --help-fcompiler

To build with a different compiler:

python setup.py build --fcompiler=<compiler>

where <compiler> is one of the choices offered by f2py above.

When the build is complete:

python setup.py install --prefix=<dir where you want climt to live>

You can also install the "lite" version of CliMT, used in 
Ray Pierrehumbert's book "Principles of Planetary Climate",
by doing

python setup.py install --lite 

Rodrigo Caballero ([email protected])
Feb 2012


climt-legacy's People

Contributors

brian-rose avatar rodrigo-caballero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

climt-legacy's Issues

trouble installing - OS X

I'm trying to install this library on my mac using the gnu95 compiler and running into this error:
ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status error: Command "/usr/local/bin/gfortran -Wall -g -L/opt/boxen/homebrew/lib /var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/src.macosx-10.10-x86_64-2.7/_gridmodule.o /var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/src.macosx-10.10-x86_64-2.7/fortranobject.o /var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/src/grid/Driver.o /var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/src/grid/src/dimensions.o /var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/var/folders/r5/qd2yr2tx55gf5sn_29hkz63c0000gn/T/tmpuYUrO2/src.macosx-10.10-x86_64-2.7/_grid-f2pywrappers.o -L/usr/local/Cellar/gcc/5.3.0/lib/gcc/5/gcc/x86_64-apple-darwin14.5.0/5.3.0 -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -lgfortran -o ./_grid.so" failed with exit status 1 +++ Compilation failed

Bug in units of heating rates in CAM3 radiation driver

The file crm.F90 converts the output from subroutines radcswmx and radclwmx from CGS to MKS units, e.g. on line 346:

qrl = qrl*1.e-3

Two problems:

  1. I don't think this is the right conversion factor. The heating rates have dimensions energy/mass/time or (length)^2 / (time)^3. So to convert from CGS to MKS should be a factor of 1.E-4, not 1.E-3.
  2. The heating rates qrl and qrs are actually already converted to MKS units (J/kg/s).
    See line 1041 of radlw.F90 and line 2422 of radsw.F90, where the factor 1.E-4 is applied.

So in the Python module, the heating rates swhr, lwhr and TdotRad seem to be a factor of 1000 too small. Also the Tinc temperature increment for the atmosphere, same problem.

If I'm right, then the fix is very simple -- just removing the lines that apply the incorrect conversion in crm.F90. I did this on my master branch of the CliMT code. Can't figure out how to submit a pull request for just this change without all the other stuff I've done recently.

Asselin Filter

I think there may be some issue with the Asselin filter, at least if an external time increment is imposed. I'm not sure what exactly is going on, but it may arise from the leapfrog step and filter being called for each component consecutively? (Sorry, I'm not good at python...)

Here is an example script which illustrates the issue. The results here are significantly dependent on the Asselin filter constant - even though a steady state is reached, in which case one would hope that the latter shouldn't do anything. Moreover, the radiative cooling rate does not agree with the externally applied heating rate (which it should in steady state), and there is a pretty clear relationship between the mismatch and the Asselin filter constant (seee comments in the script).

Maybe this is just an issue of understanding what the actual "effective" model time-step is. But it seems a bit funny that the latter should depend on the Asselin filter constant.

Cheers,
Malte

#!/usr/bin/env python

from numpy import *
import climt

### Initialize parameters
kwargs                          = {}
kwargs['lev']           = (arange(climt.get_nlev())+1)*(1000.-0.)/climt.get_nlev() ### Set pressure levels to what was modified above
kwargs['solin']         = 100 ### Solar insolation
kwargs['afc']                   = 0.2 
kwargs['dt']                    = 60.*60. ### Timestep
kwargs['Hslab']                 = 2. 
kwargs['tau_inf']       = 2.0 ### Tau
kwargs['Ts']                    = 250. ### Surface temperature init
kwargs['T']                     = ones((climt.get_nlev()))*250. ### Temperature profile init

NSteps = int( 1000*86400./kwargs['dt'] ) ## Number of steps (1000 days)

# Prescribe vertically constant heating rate of (supposedly) 1K/day
dTa = kwargs['dt']*2.*1./86400.+0.0*kwargs['lev'] 

rad = climt.radiation(scheme = 'grey', **kwargs) ### Radiation component
ocn = climt.ocean() ### ML Ocean
fed = climt.federation(rad,ocn,**kwargs) ### Coupler

### Run model
for i in range(NSteps): 

    # This formulation appears to give an effective heating rate of 1K *(1-afc) per day
    fed.step(Inc={'T':dTa})

    # This formulation appears to give an effective heating rate of 1K *(1-2*afc) per day
    #fed.step()
    #fed['T']=fed['T']+dTa

    print 'Ts: %10.5f' % (fed['Ts']-273.15)

# Print radiative temperature tendency by level - this should be -1K per day in equilibrium     
print(fed['TdotRad'])

grid dimensions

In grid.py, shouldn't the dimensions for latitude and longitude be set as
self.value['nlat'] = self.Shape3D[1]
self.value['nlon'] = self.Shape3D[2]
At the moment they all get set to self.Shape3D[0].

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.