implicit¶

class
climlab.process.implicit.
ImplicitProcess
(**kwargs)[source]¶ Bases:
climlab.process.time_dependent_process.TimeDependentProcess
A parent class for modules that use implicit time discretization.
During initialization following attributes are intitialized:
 Variables
 Attributes
depth
Depth at grid centers (m)
depth_bounds
Depth at grid interfaces (m)
diagnostics
Dictionary access to all diagnostic variables
input
Dictionary access to all input variables
lat
Latitude of grid centers (degrees North)
lat_bounds
Latitude of grid interfaces (degrees North)
lev
Pressure levels at grid centers (hPa or mb)
lev_bounds
Pressure levels at grid interfaces (hPa or mb)
lon
Longitude of grid centers (degrees)
lon_bounds
Longitude of grid interfaces (degrees)
timestep
The amount of time over which
step_forward()
is integrating in unit seconds.
Methods
add_diagnostic
(self, name[, value])Create a new diagnostic variable called
name
for this process and initialize it with the givenvalue
.add_input
(self, name[, value])Create a new input variable called
name
for this process and initialize it with the givenvalue
.add_subprocess
(self, name, proc)Adds a single subprocess to this process.
add_subprocesses
(self, procdict)Adds a dictionary of subproceses to this process.
compute
(self)Computes the tendencies for all state variables given current state and specified input.
compute_diagnostics
(self[, num_iter])Compute all tendencies and diagnostics, but don’t update model state.
declare_diagnostics
(self, diaglist)Add the variable names in
inputlist
to the list of diagnostics.declare_input
(self, inputlist)Add the variable names in
inputlist
to the list of necessary inputs.integrate_converge
(self[, crit, verbose])Integrates the model until model states are converging.
integrate_days
(self[, days, verbose])Integrates the model forward for a specified number of days.
integrate_years
(self[, years, verbose])Integrates the model by a given number of years.
remove_diagnostic
(self, name)Removes a diagnostic from the
process.diagnostic
dictionary and also delete the associated process attribute.remove_subprocess
(self, name[, verbose])Removes a single subprocess from this process.
set_state
(self, name, value)Sets the variable
name
to a new statevalue
.set_timestep
(self[, timestep, …])Calculates the timestep in unit seconds and calls the setter function of
timestep()
step_forward
(self)Updates state variables with computed tendencies.
to_xarray
(self[, diagnostics])Convert process variables to
xarray.Dataset
format.
_compute
(self)[source]¶ Computes the state variable tendencies in time for implicit processes.
To calculate the new state the
_implicit_solver()
method is called for daughter classes. This however returns the new state of the variables, not just the tendencies. Therefore, the adjustment is calculated which is the difference between the new and the old state and stored in the object’s attribute adjustment.Calculating the new model states through solving the matrix problem already includes the multiplication with the timestep. The derived adjustment is divided by the timestep to calculate the implicit subprocess tendencies, which can be handeled by the
compute()
method of the parentTimeDependentProcess
class. Variables
adjustment (dict) – holding all state variables’ adjustments of the implicit process which are the differences between the new states (which have been solved through matrix inversion) and the old states.