OptimalBalance#

class fridom.framework.projection.optimal_balance.OptimalBalance(mset: fr.ModelSettingsBase, base_proj: fr.projection.Projection, ramp_period: np.timedelta64 | float | int | None, update_parameters: Callable[[fr.ModelSettings, float, str], None] = None, mset_backwards: fr.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.

update_parametersCallable[[ModelSettings, float, str], None], optional

A method that updates the model parameters based on the ramped value. It should take the model settings and the ramped value which is between 0 and 1.

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: fr.ModelSettingsBase, base_proj: fr.projection.Projection, ramp_period: np.timedelta64 | float | int | None, update_parameters: Callable[[fr.ModelSettings, float, str], None] = None, mset_backwards: fr.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()

update_parameters(mset, ramped_value, mode)

calc_base_coord(z: VectorField) None[source]#
update_parameters(mset: fr.ModelSettings, ramped_value: float, mode: Literal['forward', 'backward']) None[source]#
forward_to_nonlinear(z: VectorField) VectorField[source]#

Perform forward ramping from linear model to nonlinear model.

backward_to_linear(z: VectorField) VectorField[source]#

Perform backward ramping from nonlinear model to linear model.

forward_to_linear(z: VectorField) VectorField[source]#

Perform forward ramping from nonlinear model to linear model.

backward_to_nonlinear(z: VectorField) VectorField[source]#

Perform backward ramping from linear model to nonlinear model.

get_ramp_func()[source]#