/
crop.C
133 lines (111 loc) · 3.41 KB
/
crop.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// crop.C -- Generic crop interface.
//
// Copyright 1996-2007 KVL, Per Abrahamsen and Søren Hansen
//
// This file is part of Daisy.
//
// Daisy is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// Daisy is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser Public License for more details.
//
// You should have received a copy of the GNU Lesser Public License
// along with Daisy; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define BUILD_DLL
#include "crop.h"
#include "om.h"
#include "block_model.h"
#include "mathlib.h"
#include "librarian.h"
const double Crop::DSremove = -5001.0;
const char *const Crop::component = "crop";
symbol
Crop::library_id () const
{
static const symbol id (component);
return id;
}
double
Crop::minimum_light_fraction () const
{ return 0.0; }
double
Crop::rs_min () const
{ return 100.0; }
double
Crop::rs_max () const
{ return 1.0e5; }
double
Crop::shadow_stomata_conductance () const
{ return LAI () / rs_max(); }
double
Crop::sunlit_stomata_conductance () const
{ return LAI () / rs_max(); }
double
Crop::leaf_width () const
{ return 3.0; }
double
Crop::SimLAI () const
{ return LAI (); }
double
Crop::albedo () const
{ return 0.20; }
const Harvest&
Crop::pluck (const symbol, const Time&, const Geometry&,
const double, const double, const double,
std::vector<AM*>& residuals,
double& residuals_DM,
double& residuals_N_top,
double& residuals_C_top,
std::vector<double>& residuals_N_soil,
std::vector<double>& residuals_C_soil,
Treelog&)
{ throw objid + " is unpluckable"; }
void
Crop::kill (const symbol name, const Time& time, const Geometry& geo,
std::vector<AM*>& residuals, double& residuals_DM,
double& residuals_N_top, double& residuals_C_top,
std::vector<double>& residuals_N_soil,
std::vector<double>& residuals_C_soil,
Treelog& out)
{
harvest (name, time, geo,
0.0, 0.0, 0.0, 0.0, true, residuals,
residuals_DM, residuals_N_top, residuals_C_top,
residuals_N_soil, residuals_C_soil, false, out);
}
void
Crop::force_production_stress (double)
{ }
void
Crop::find_stomata_conductance (const Units&, const Time& time,
const Bioclimate&,
double dt, Treelog&)
{ }
bool
Crop::ds_remove (const Crop* crop)
{ return approximate (crop->DS (), Crop::DSremove); }
Crop::Crop (const BlockModel& al)
: ModelFramed (al)
{ }
Crop::~Crop ()
{ }
static struct CropInit : public DeclareComponent
{
CropInit ()
: DeclareComponent (Crop::component, "\
The 'crop' component simulates a specific crop on the field, typically\n\
averaged over one square meter, not individual plants. Of particular\n\
interest is water and nitrogen uptake at different depths, and the\n\
vertical leaf area distribution, which are used for competition with\n\
other crops.")
{ }
void load_frame (Frame& frame) const
{ Model::load_model (frame); }
} Crop_init;
// crop.C ends here.