OptimalBalance#

class fridom.framework.projection.optimal_balance.OptimalBalance(mset: ModelSettingsBase, base_proj: Projection, ramp_period: timedelta64 | float | int | None, mset_backwards: ModelSettingsBase = None, ramp_type: str = 'exp', update_base_point: bool = True, max_it: int = 3, stop_criterion: float = 1e-09, disable_diagnostic: bool = True, return_details: bool = False)[source]#

Bases: Projection

Nonlinear balancing using the optimal balance method.

Parameters#

msetModelSettings

The model settings.

base_projProjection

The projection onto the base point.

ramp_periodnp.timedelta64 | float | int (default: None)

The ramping period.

mset_backwardsModelSettings

The model settings for the backward ramping. If None, the forward model settings are used. This option is useful when the backwards ramping should be done with a different setup (e.g. negative viscosity).

ramp_typestr

The ramping type. Choose from “exp”, “pow”, “cos”, “lin”.

disable_diagnosticbool

Whether to disable the diagnostic tendencies during the iterations.

update_base_pointbool

Whether to update the base point after each iteration. This has no effect on OB. But it matters for OBTA. Should be True for OBTA.

max_itint

Maximum number of iterations.

stop_criterionfloat

The stopping criterion.

__init__(mset: ModelSettingsBase, base_proj: Projection, ramp_period: timedelta64 | float | int | None, mset_backwards: ModelSettingsBase = None, ramp_type: str = 'exp', update_base_point: bool = True, max_it: int = 3, stop_criterion: float = 1e-09, disable_diagnostic: bool = True, return_details: bool = False) None[source]#

Methods

__init__(mset, base_proj, ramp_period[, ...])

backward_to_linear(z)

Perform backward ramping from nonlinear model to linear model.

backward_to_nonlinear(z)

Perform backward ramping from linear model to nonlinear model.

calc_base_coord(z)

forward_to_linear(z)

Perform forward ramping from nonlinear model to linear model.

forward_to_nonlinear(z)

Perform forward ramping from linear model to nonlinear model.

get_ramp_func()

calc_base_coord(z: StateBase) None[source]#
forward_to_nonlinear(z: StateBase) StateBase[source]#

Perform forward ramping from linear model to nonlinear model.

backward_to_linear(z: StateBase) StateBase[source]#

Perform backward ramping from nonlinear model to linear model.

forward_to_linear(z: StateBase) StateBase[source]#

Perform forward ramping from nonlinear model to linear model.

backward_to_nonlinear(z: StateBase) StateBase[source]#

Perform backward ramping from linear model to nonlinear model.

get_ramp_func()[source]#