test¶
The base model test
is intended for implementing small application model
that allow for testing or demonstrating specific features of the HydPy
framework.
Method Features¶
- class hydpy.models.test.test_model.Model[source]¶
Bases:
ELSModel
Test model.
- The following methods define the relevant components of a system of ODE equations (e.g. direct runoff):
Calc_Q_V1
Calculate the actual storage loss.Calc_Q_V2
Calculate the actual storage loss.Calc_QV_V1
Calculate the actual storage losses.
- The following methods define the complete equations of an ODE system (e.g. change in storage of fast water due to effective precipitation and direct runoff):
Calc_S_V1
Calculate the actual storage content.Calc_SV_V1
Calculate the actual storage contenst.
- class hydpy.models.test.test_model.Calc_Q_V1[source]¶
Bases:
Method
Calculate the actual storage loss.
This simple equation is continuous but potentially stiff.
- Basic equation:
\(Q = K \cdot S\)
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> k(0.5) >>> states.s = 2.0 >>> model.calc_q_v1() >>> fluxes.q q(1.0)
- class hydpy.models.test.test_model.Calc_Q_V2[source]¶
Bases:
Method
Calculate the actual storage loss.
This simple equation is discontinuous.
- Basic equation:
\(Q = \Bigl \lbrace { {K \ | \ S > 0} \atop {0 \ | \ S \leq 0} }\)
Examples:
>>> from hydpy.models.test import * >>> parameterstep() >>> k(0.5) >>> states.s = 2.0 >>> model.calc_q_v2() >>> fluxes.q q(0.5) >>> states.s = -1.0 >>> model.calc_q_v2() >>> fluxes.q q(0.0)
- class hydpy.models.test.test_model.Calc_QV_V1[source]¶
Bases:
Method
Calculate the actual storage losses.
Identical with
Calc_Q_V1
, but working on a vector of states.- Basic equation:
\(Q = K \cdot S\)
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> n(2) >>> k(0.5) >>> states.sv = 2.0, 3.0 >>> model.calc_qv_v1() >>> fluxes.qv qv(1.0, 1.5)
- class hydpy.models.test.test_model.Calc_S_V1[source]¶
Bases:
Method
Calculate the actual storage content.
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> states.s.old = 1.0 >>> fluxes.q = 0.8 >>> model.calc_s_v1() >>> states.s s(0.2)
- class hydpy.models.test.test_model.Calc_SV_V1[source]¶
Bases:
Method
Calculate the actual storage contenst.
Identical with
Calc_S_V1
, but working on a vector of fluxes.- Basic equation:
\(\frac{dS}{dt} = Q\)
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> n(2) >>> states.sv.old = 1.0, 2.0 >>> fluxes.qv = 0.8 >>> model.calc_sv_v1() >>> states.sv sv(0.2, 1.2)
Parameter Features¶
Control parameters¶
- class hydpy.models.test.ControlParameters(master: Parameters, cls_fastaccess: Type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
SubParameters
Control parameters of model test.
- class hydpy.models.test.test_control.K(subvars: SubParameters)[source]¶
Bases:
Parameter
Storage coefficient [1/T].
- Required by the methods:
For educational purposes, the actual value of parameter
K
does not depend on the difference between the actual simulation time step and the actual parameter time step.
- class hydpy.models.test.test_control.N(subvars: SubParameters)[source]¶
Bases:
Parameter
Number of storages [-].
- Required by the methods:
Solver parameters¶
- class hydpy.models.test.SolverParameters(master: Parameters, cls_fastaccess: Type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
SubParameters
Solver parameters of model test.
- The following classes are selected:
AbsErrorMax()
Absolute numerical error tolerance [mm/T].RelErrorMax()
Relative numerical error tolerance [1/T].RelDTMin()
Smallest relative integration time step size allowed [-].RelDTMax()
Largest relative integration time step size allowed [-].
- class hydpy.models.test.test_solver.AbsErrorMax(subvars)[source]¶
Bases:
SolverParameter
Absolute numerical error tolerance [mm/T].
- class hydpy.models.test.test_solver.RelErrorMax(subvars)[source]¶
Bases:
SolverParameter
Relative numerical error tolerance [1/T].
- class hydpy.models.test.test_solver.RelDTMin(subvars)[source]¶
Bases:
SolverParameter
Smallest relative integration time step size allowed [-].
- class hydpy.models.test.test_solver.RelDTMax(subvars)[source]¶
Bases:
SolverParameter
Largest relative integration time step size allowed [-].
Sequence Features¶
Flux sequences¶
- class hydpy.models.test.FluxSequences(master: Sequences, cls_fastaccess: Type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
FluxSequences
Flux sequences of model test.
- class hydpy.models.test.test_fluxes.Q(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FluxSequence
Storage loss [mm/T]
- class hydpy.models.test.test_fluxes.QV(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FluxSequence
Storage loss vector [mm/T]
- Calculated by the method:
- Required by the method:
State sequences¶
- class hydpy.models.test.StateSequences(master: Sequences, cls_fastaccess: Type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
StateSequences
State sequences of model test.
- class hydpy.models.test.test_states.S(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
StateSequence
Storage content [mm].
- class hydpy.models.test.test_states.SV(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
StateSequence
Storage content vector[mm].
- Updated by the method:
- Required by the method:
- class hydpy.models.test.ControlParameters(master: Parameters, cls_fastaccess: Type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
SubParameters
Control parameters of model test.
- class hydpy.models.test.FluxSequences(master: Sequences, cls_fastaccess: Type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
FluxSequences
Flux sequences of model test.
- class hydpy.models.test.SolverParameters(master: Parameters, cls_fastaccess: Type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
SubParameters
Solver parameters of model test.
- The following classes are selected:
AbsErrorMax()
Absolute numerical error tolerance [mm/T].RelErrorMax()
Relative numerical error tolerance [1/T].RelDTMin()
Smallest relative integration time step size allowed [-].RelDTMax()
Largest relative integration time step size allowed [-].
- class hydpy.models.test.StateSequences(master: Sequences, cls_fastaccess: Type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
StateSequences
State sequences of model test.