Iterative_process
Iterative_process
Iterative_process(x_0, tol=1e-05, lambda_min=0.1, lambda_max=1.0, n_ini_relax=2, rel_vel=0.9)
Iterative process using the fixed-point method with adaptive relaxation coefficient
Used by the components to converge a value coupled with other components (e.g. the temperature or humidity of a space) within the iterations of a time step:
it = Iterative_process(x_0, tol=0.01)
# in each iteration, with the value proposed by the component's equations
x = it.estimate_next_x(proposed_x)
converged = it.converged()
Create new iterative process
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_0
|
float
|
Initial value |
required |
tol
|
float
|
convergence tolerance of the residual. Defaults to 1e-5. |
1e-05
|
lambda_min
|
float
|
minimum relaxation coefficient. Defaults to 0.1. |
0.1
|
lambda_max
|
float
|
maximum (and initial) relaxation coefficient. Defaults to 1.0. |
1.0
|
n_ini_relax
|
int
|
Number of iterations in which adaptive relaxation is initiated, must be greater than 1. Defaults to 2. |
2
|
rel_vel
|
float
|
factor that reduces (or, divided, recovers) the relaxation coefficient. Defaults to 0.9. |
0.9
|
converged
converged()
The residual of the last iteration is below the tolerance
Returns:
| Type | Description |
|---|---|
bool
|
converged |
estimate_next_x
estimate_next_x(proposed_x)
Relaxed next value from the value proposed by the fixed-point equation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
proposed_x
|
float
|
value given by the equations from the last value |
required |
Returns:
| Type | Description |
|---|---|
float
|
next value, |
set_next_x
set_next_x(next_x)
Set the next value directly, without relaxation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
next_x
|
float
|
next value |
required |