diff --git a/cmf/cmf_core_src/water/adsorption.h b/cmf/cmf_core_src/water/adsorption.h index b6cb0c28..0590a49c 100644 --- a/cmf/cmf_core_src/water/adsorption.h +++ b/cmf/cmf_core_src/water/adsorption.h @@ -116,7 +116,7 @@ namespace cmf { /// The eq. above can not be rearanged to get \f$x_{free}\f$ from \f$x_{tot}\f$. Instead, the value is iterated /// using [regula falsi](http://en.wikipedia.org/wiki/False_position_method). If n is near to 1, /// using LinearAdsorption will speed up your calculations. - /// @TODO Check if an analytical solution is available + /// @todo Check if an analytical solution is available /// The simplest physically based adsorption model by Langmuir (LangmuirAdsorption) has also a analytical solution /// and is hence calculated faster then Freundlich. class FreundlichAdsorbtion: public Adsorption { diff --git a/documentation/media/CmfTutAbstractFluxes.png b/documentation/media/CmfTutAbstractFluxes.png new file mode 100644 index 00000000..739619c4 Binary files /dev/null and b/documentation/media/CmfTutAbstractFluxes.png differ diff --git a/documentation/tutorial/conceptual/CmfTutAbstractFluxes.md b/documentation/tutorial/conceptual/CmfTutAbstractFluxes.md index 2603aebe..b4383cf9 100644 --- a/documentation/tutorial/conceptual/CmfTutAbstractFluxes.md +++ b/documentation/tutorial/conceptual/CmfTutAbstractFluxes.md @@ -3,11 +3,15 @@ Depending on your model design, you might need to use rather abstract concepts can help to realize your model - but not every model needs these connections. +The class names of these connections are not very good and **will be changed** +in CMF 2.0. Starting with cmf 1.4 the new names are already available + ## Balancing water flux at one node ### What does it mean? -The [waterbalance_connection](@ref cmf::water::waterbalance_connection) is +The [waterbalance_connection](@ref cmf::water::waterbalance_connection) +(or WaterBalanceFlux for CMF 1.4+) is a connection to route the water balance of a node somewhere else. The connection checks the flux over all other connections of the *left* node and routes any surplus to the *right* node, or in case of a negative water balance @@ -102,16 +106,49 @@ between these different model domains. ## Keeping a flux constant as long as water is available +![](@ref CmfTutAbstractFluxes.png) + For some processes a constant flux from one water storage to another or a boundary condition is needed. These constant (but externally changeable) fluxes can be anthropogenic water fluxes, like the regulation of a dam or a pump rate, or some other process that has a flux limit. Eg. the model HBVlight assumes a constant percolation from the 1st to the 2nd groundwater storage. However, -when the source becomes empty, the flux stops. +when the source becomes empty, the flux stops. To avoid a hard stop, the fluxes +decreases linear to zero, when only volume for `decrease time` is left in the source +storage. Currently, this type of connection is called "TechnicalFlux" -but will be renamed to [ConstantFlux](@ref cmf::water::TechnicalFlux). +but will be renamed to [ConstantFlux](@ref cmf::water::TechnicalFlux) starting with CMF 1.4. +The old name will stay in the C++ code and the docs until CMF 2.0. + +~~~~~~~~~~ {.py} +p = cmf.project() +w = p.NewStorage('source') +o = p.NewOutlet('out') +import pylab as plt +# Add a constant flux +constflux = cmf.ConstantFlux(w, o, 1.0, flux_decrease_time=cmf.day) +w.volume = 2.0 +solver = cmf.RKFIntegrator(p) +vol, flux = zip(*[(w.volume, w.flux_to(o, t)) + for t in solver.run(cmf.Time(), cmf.day * 4, cmf.h)]) +plt.subplot(1, 2, 1) +plt.plot(vol,color='r', label='Volume') +plt.plot(flux,color='b', label='flux') +plt.yticks([1], ['$q_{max}$']) +plt.xticks([24, 48, 72],[1, 2, 3]) +plt.xlabel('days') +plt.legend() +plt.subplot(1, 2, 2) +plt.plot(vol, flux, 'kx') +plt.ylabel('flux $m^3/day$') +plt.xlabel('volume $m^3$') +~~~~~~~~~~ ## Keeping a state constant as long as water is available -[ConstantState](@ref cmf::water::statecontrol_connection) \ No newline at end of file +This connection holds the state of a water storage constant getting or releasing water +to the other node of the connection. The flux between the nodes is proportional to +the difference between the state of the storage and the defined target state of the +storage. This connection will be renamed in CMF 2.0 to [ConstantState](@ref cmf::water::statecontrol_connection) +and is in CMF 1.3 and below only available as `statecontrol_connection`. \ No newline at end of file diff --git a/documentation/tutorial/conceptual/conceptual.md b/documentation/tutorial/conceptual/conceptual.md index b5360e77..d83f19ad 100644 --- a/documentation/tutorial/conceptual/conceptual.md +++ b/documentation/tutorial/conceptual/conceptual.md @@ -5,8 +5,7 @@ - @subpage cmfTutKinematicWave "Kinematic waves" as swiss army knife for conceptual model building - @subpage simple_infiltration "Infiltration" - - @subpage cmfTutTechnical "Technical Flux" - - @subpage cmfTutWaterbalance "Waterbalance Connection" + - @subpage cmfTutAbstractFluxes "Abstract fluxes" ## Lumped Model diff --git a/documentation/tutorial/gettingstarted/CmfTutBoundary.md b/documentation/tutorial/gettingstarted/CmfTutBoundary.md index 04e8003e..32fee7d3 100644 --- a/documentation/tutorial/gettingstarted/CmfTutBoundary.md +++ b/documentation/tutorial/gettingstarted/CmfTutBoundary.md @@ -64,7 +64,7 @@ condition ([NeumannBoundary](@ref cmf::water::NeumannBoundary)) as a second boundary. This type of boundary condition is not triggered by the state of a water storage in the system, but by a defined flux given by the user. Since the flux should change over time, the flux is given as a -[timeseries](@ref CmfTutSpaceTime). In this tutorial you will +[timeseries](@ref cmfTutSpaceTime). In this tutorial you will create a timeseries with daily alternating flux values between 0 and 1. The setup code needs to be extended with the following: diff --git a/documentation/tutorial/gettingstarted/CmfTutFirstModel.md b/documentation/tutorial/gettingstarted/CmfTutFirstModel.md index 94ed18ab..750e9e02 100644 --- a/documentation/tutorial/gettingstarted/CmfTutFirstModel.md +++ b/documentation/tutorial/gettingstarted/CmfTutFirstModel.md @@ -11,7 +11,7 @@ it is to introduce some of the elements of cmf. ## The model The model is a simple linear storage equation to transport water from -one water storage (@f$W_1@fS) to another water storage (@f$W_2@f$). +one water storage (@f$W_1@f$) to another water storage (@f$W_2@f$). @f[