-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'a8be0927229a9a06804fc841d68e522a6545c838'
- Loading branch information
Showing
23 changed files
with
468 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/*! | ||
\name hydrall.cpp | ||
\brief | ||
\authors Antonio Volta, Caterina Toscano | ||
*/ | ||
|
||
|
||
//#include <stdio.h> | ||
#include <math.h> | ||
#include "crit3dDate.h" | ||
#include "commonConstants.h" | ||
#include "hydrall.h" | ||
|
||
|
||
bool computeHydrall(Crit3DDate myDate, double myTemperature, double myElevation, int secondPerStep) | ||
{ | ||
getCO2(myDate, myTemperature, myElevation); | ||
double actualLAI = getLAI(); | ||
/* necessaria per ogni specie: | ||
* il contenuto di clorofilla (g cm-2) il default è 500 | ||
* lo spessore della foglia 0.2 cm default | ||
* un booleano che indichi se la specie è anfistomatica oppure no | ||
* parametro alpha del modello di Leuning | ||
* | ||
*/ | ||
// la temperatura del mese precedente arriva da fuori | ||
|
||
|
||
|
||
return true; | ||
} | ||
|
||
double getCO2(Crit3DDate myDate, double myTemperature, double myElevation) | ||
{ | ||
double atmCO2 ; //https://www.eea.europa.eu/data-and-maps/daviz/atmospheric-concentration-of-carbon-dioxide-5/download.table | ||
double year[24] = {1750,1800,1850,1900,1910,1920,1930,1940,1950,1960,1970,1980,1990,2000,2010,2020,2030,2040,2050,2060,2070,2080,2090,2100}; | ||
double valueCO2[24] = {278,283,285,296,300,303,307,310,311,317,325,339,354,369,389,413,443,473,503,530,550,565,570,575}; | ||
|
||
// exponential fitting Mauna Loa | ||
if (myDate.year < 1990) | ||
{ | ||
atmCO2= 280 * exp(0.0014876*(myDate.year -1840));//exponential change in CO2 concentration (ppm) | ||
} | ||
else | ||
{ | ||
atmCO2= 353 * exp(0.00630*(myDate.year - 1990)); | ||
} | ||
atmCO2 += 3*cos(2*PI*getDoyFromDate(myDate)/365.0); // to consider the seasonal effects | ||
return atmCO2*getPressureFromElevation(myTemperature, myElevation)/1000000 ; // [Pa] in +- ppm/10 | ||
} | ||
|
||
double getPressureFromElevation(double myTemperature, double myElevation) | ||
{ | ||
return SEA_LEVEL_PRESSURE * exp((- GRAVITY * M_AIR * myElevation) / (R_GAS * myTemperature)); | ||
} | ||
|
||
double getLAI() | ||
{ | ||
// TODO | ||
return 4; | ||
} | ||
/* | ||
double meanLastMonthTemperature(double previousLastMonthTemp, double simulationStepInSeconds, double myInstantTemp) | ||
{ | ||
double newTemperature; | ||
double monthFraction; | ||
monthFraction = simulationStepInSeconds/(2592000.0); // seconds of 30 days | ||
newTemperature = previousLastMonthTemp * (1 - monthFraction) + myInstantTemp * monthFraction ; | ||
return newTemperature; | ||
}*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef HYDRALL_H | ||
#define HYDRALL_H | ||
|
||
#ifndef COMMONCONSTANTS_H | ||
#include "commonConstants.h" | ||
#endif | ||
#ifndef CRIT3DDATE_H | ||
#include "crit3dDate.h" | ||
#endif | ||
|
||
#define UPSCALINGFUNC(z,LAI) ((1.0 - exp(-(z)*(LAI))) / (z)) | ||
|
||
// Tree-plant properties | ||
#define FORM 0.5 // stem form factor | ||
#define RHOF 0.1 // [KgDM m-3] foliage density | ||
#define RHOS 750 // [KgDM m-3] wood-stem density | ||
|
||
// Hydraulic properties | ||
#define H50 0.4 // height for 50% maturation of xylem cells (m) [not relevant] | ||
#define KR 4.0E-7 // root specific conductance (m3 MPa-1 s-1 kg-1) [not relevant] | ||
#define KSMAX 2.5E-3 // max. sapwood specific conductivity (m2 MPa-1 s-1) [not relevant] | ||
#define PSITHR -2.5 // water potential threshold for cavitation (MPa) [not relevant] | ||
|
||
|
||
#define NOT_INITIALIZED_VINE -1 | ||
|
||
bool computeHydrall(Crit3DDate myDate, double myTemperature, double myElevation, int secondPerStep); | ||
double getCO2(Crit3DDate myDate, double myTemperature, double myElevation); | ||
double getPressureFromElevation(double myTemperature, double myElevation); | ||
double getLAI(); | ||
double meanLastMonthTemperature(double previousLastMonthTemp, double simulationStepInSeconds, double myInstantTemp); | ||
|
||
#endif // HYDRALL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#--------------------------------------------------- | ||
# | ||
# hydrall library | ||
# This project is part of CRITERIA3D distribution | ||
# | ||
#--------------------------------------------------- | ||
|
||
QT -= core gui | ||
|
||
TEMPLATE = lib | ||
CONFIG += staticlib | ||
|
||
CONFIG += debug_and_release | ||
CONFIG += c++11 c++14 c++17 | ||
|
||
#DEFINES += _CRT_SECURE_NO_WARNINGS | ||
|
||
|
||
unix:{ | ||
CONFIG(debug, debug|release) { | ||
TARGET = debug/hydrall | ||
} else { | ||
TARGET = release/hydrall | ||
} | ||
} | ||
win32:{ | ||
TARGET = hydrall | ||
} | ||
|
||
INCLUDEPATH += ../crit3dDate ../mathFunctions ../soil ../crop | ||
|
||
SOURCES += hydrall.cpp | ||
|
||
|
||
HEADERS += hydrall.h | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.