Skip to content

Commit

Permalink
New ExternalEnergySource process to add simple constant source/sink t…
Browse files Browse the repository at this point in the history
…erms. Version number incremented to 0.2.9
  • Loading branch information
brian-rose committed Apr 21, 2015
1 parent cc0bb27 commit 752f0f5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion climlab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.2.8'
__version__ = '0.2.9'

# This list defines all the modules that will be loaded if a user invokes
# from climLab import *
Expand Down
2 changes: 2 additions & 0 deletions climlab/model/ebm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
class EBM(EnergyBudget):
def __init__(self,
num_lat=90,
S0=const.S0,
A=210.,
B=2.,
D=0.555, # in W / m^2 / degC, same as B
Expand All @@ -39,6 +40,7 @@ def __init__(self,
lat = sfc.axes['lat'].points
initial = 12. - 40. * legendre.P2(np.sin(np.deg2rad(lat)))
self.set_state('Ts', Field(initial, domain=sfc))
self.param['S0'] = S0
self.param['A'] = A
self.param['B'] = B
self.param['D'] = D
Expand Down
13 changes: 13 additions & 0 deletions climlab/process/energy_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,16 @@ def _temperature_tendencies(self):
def compute(self):
'''Update all diagnostic quantities using current model state.'''
self._temperature_tendencies()


class ExternalEnergySource(EnergyBudget):
'''A fixed energy source or sink to be specified by the user.
The user should modify the fields in the heating_rate dictionary,
which contain heating rates in W / m**2 for all state variables.'''
def __init__(self, **kwargs):
super(ExternalEnergySource, self).__init__(**kwargs)
for varname in self.state.keys():
self.heating_rate[varname] = np.zeros_like(self.state[varname])

def _compute_heating_rates(self):
pass

0 comments on commit 752f0f5

Please sign in to comment.