LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
ld_som_spinup.h
1/*
2 * SPDX-FileCopyrightText: Karlsruhe Institute of Technology (KIT)
3 * SPDX-License-Identifier: LicenseRef-LandscapeDNDC
4 * This file is part of LandscapeDNDC. See LICENSE.
5 */
21
22#ifndef LD_SOM_SPINUP_H_
23#define LD_SOM_SPINUP_H_
24
25#include "ld_modelsconfig.h"
26#include <vector>
27
28namespace ldndc {
29
30class LDNDC_API SomSpinup
31{
32public:
33 SomSpinup();
34
36 void configure( size_t /* pools */, size_t /* layers */, int /* years */);
37
38 bool on() const { return this->on_; }
39 int years() const { return this->years_; }
40
42 inline void loss( size_t _p, size_t _l, double _loss, double _pool)
43 {
44 if ( this->on_ && ( _pool > 0.0) && ( _loss > 0.0))
45 {
46 size_t const i( _l * this->pools_ + _p);
47 this->loss_step_[i] += _loss;
48 this->k_[this->bin_][i] += _loss / _pool;
49 }
50 }
51
53 void close( size_t /* pool */, size_t /* layer */, double /* pool size */);
54
56 void reset( size_t /* pool */, size_t /* layer */, double /* pool size */);
57
59 double equilibrium( size_t /* pool */, size_t /* layer */) const;
60
63 double relaxation() const;
64
66 void next_month();
67
68private:
69 bool on_;
70 int years_;
71 size_t pools_, layers_;
72 size_t bin_;
73 int months_;
74 std::vector< double > prev_, loss_step_;
75 std::vector< char > have_prev_;
76 std::vector< double > in_[12], k_[12];
77};
78
79} /* namespace ldndc */
80
81#endif /* !LD_SOM_SPINUP_H_ */
Spatially explicit groundwater model.
Definition airchemistryput.h:21