Commit 67086e9f authored by jouke's avatar jouke
Browse files

Code improvements and fixes for stomatal conductance

parent 40e06f22
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<!--?xml-stylesheet type="text/xsl" href="tree-view2.xsl"? -->
<!--
Copyright © 2022, Ernst Schäfer, Ishan Ajmera
All rights reserved.

Copyright © 2016, The Pennsylvania State University
All rights reserved.

Copyright © 2016 Forschungszentrum Jülich GmbH
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted under the GNU General Public License v3 and provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

Disclaimer
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in license.txt but can also be found at http://www.gnu.org/licenses/gpl-3.0.en.html

 -->

<SimulationModelIncludeFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../scripts/XML/SimulaXMLSchema.xsd">

	<SimulaDirective path="environment">
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in lic
		<!-- Find literature references to properly parametrise this and the stress effects on leaf elongation rate and stomatal conductance. See: https://doi.org/10.1007/BF02370385 https://doi.org/10.1093/jxb/25.6.1085 https://doi.org/10.1093/jxb/25.6.1085-->
		<SimulaTable name_column1="collarPotential" unit_column1="hPa" name_column2="waterStressResponseCurve" unit_column2="noUnit" garbageCollectionOff="true">10000 1 -3000 1 -8000 0.4 -12000 0 -999999999999 0</SimulaTable>
		<SimulaConstant name="residualConductance" prettyName="residual Conductance" type="double" unit="mol/m2/s">0.017</SimulaConstant><!-- https://mountainscholar.org/bitstream/handle/10217/176672/Miner_colostate_0053A_13706.pdf?sequence=1 https://sci-hub.do/10.1078/0176-1617-00177-->
		<SimulaConstant name="BBSlope" prettyName="Ball Berry Slope" type="double" unit="#">4.53</SimulaConstant>	<!-- https://mountainscholar.org/bitstream/handle/10217/176672/Miner_colostate_0053A_13706.pdf?sequence=1 https://sci-hub.do/10.1078/0176-1617-00177-->
		<SimulaConstant name="BBSlope" prettyName="Ball Berry Slope" type="double" unit="noUnit">4.53</SimulaConstant>	<!-- https://mountainscholar.org/bitstream/handle/10217/176672/Miner_colostate_0053A_13706.pdf?sequence=1 https://sci-hub.do/10.1078/0176-1617-00177-->
		<!-- https://naldc.nal.usda.gov/download/37614/PDF-->
		<SimulaConstant name="RubiscoCO2MichaelisConstantAt25C" unit="umol/mol">485</SimulaConstant><!-- https://onlinelibrary.wiley.com/doi/epdf/10.1111/j.1365-3040.2009.02095.x-->
		<SimulaConstant name="RubiscoCO2MichaelisActivationEnergy" unit="J/mol">35600</SimulaConstant><!-- https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4861018/ -->
+155 −151

File changed.

Preview size limit exceeded, changes collapsed.

+15 −8
Original line number Diff line number Diff line
@@ -55,14 +55,21 @@ public:
	std::string getName()const;
protected:
	void calculate(const Time &t,double &var);
	SimulaBase *pPhotosynthesis, *pPhotosynthesisRate, *pLeafRespiration, *pLeafRespirationRate, *pSaturatedVapourPressure, *pActualVaporPressure, *pLeafTemperature, *pLeafArea, *pWaterStressFactor, *pMesophyllO, *pReferenceMaxCarboxylationEfficiency, *pMaxPEPCarboxylationAt25C, *pLeafNitrogenConcentration;
	bool C4Photo;
	double vapourPressureDeficitReference, residualConductance, mConstant, CO2Concentration;
	double referenceMichaelisCO2, referenceMichaelisO2, referenceDayRespiration, activationEnergyCO2, activationEnergyO2, activationEnergyDayRespiration;
	double carboxylationActivationEnergy, carboxylationDeactivationEnergy, carboxylationEntropyTerm, CO2CompensationPointNoDayRespirationref, activationEnergyCO2CompensationPointNoDayRespiration;
	double referenceRubiscoSpecificity, rubiscoSpecificityActivationEnergy, michaelisPEPAt25C, michaelisPEPActivationEnergy, pepCarboxylationActivationEnergy, pepCarboxylationDeactivationEnergy, pepCarboxylationEntropyTerm;
	double sheathConductanceAt25C, sheathConductanceActivationEnergy, sheathConductanceDeactivationEnergy, sheathConductanceEntropyTerm, dayRespirationMesophyllFraction;
	double michaelisCO2, michaelisO2, referenceMaxCarboxylationEfficiency, temperatureScalingFactor, CO2CompensationPointNoDayRespiration, rubiscoSpecificityReciprocal, michaelisPEP, sheathConductance, maxPEPCarboxylation, maxCarboxylationNitrogenProportionalityConstant, nitrogenLimit, leafArea, vapourPressureDeficit, maxRefPEP;
	SimulaBase *pLeafArea, *pWaterStressFactor, *pLeafRespirationRate, *pLeafRespiration, *pLeafTemperature, *pPhotosynthesisPerLA, *pPhotosynthesis,
	*pMesophyllO, *pActualVaporPressure, *pLeafNitrogenConcentration, *pSaturatedVapourPressure;

	const double residualConductance, maxCarboxylationNitrogenProportionalityConstant;
	const double carboxylationActivationEnergy, carboxylationDeactivationEnergy, carboxylationEntropyTerm, CO2CompensationPointNoDayRespirationref, activationEnergyCO2CompensationPointNoDayRespiration;
	const double referenceRubiscoSpecificity, rubiscoSpecificityActivationEnergy, michaelisPEPAt25C, michaelisPEPActivationEnergy, pepCarboxylationActivationEnergy, pepCarboxylationDeactivationEnergy, pepCarboxylationEntropyTerm;
	const double sheathConductanceAt25C, sheathConductanceActivationEnergy, sheathConductanceDeactivationEnergy, sheathConductanceEntropyTerm, dayRespirationMesophyllFraction;
	//const double michaelisCO2, michaelisO2, referenceMaxCarboxylationEfficiency, temperatureScalingFactor, CO2CompensationPointNoDayRespiration, rubiscoSpecificityReciprocal, michaelisPEP, sheathConductance, maxPEPCarboxylation, maxCarboxylationNitrogenProportionalityConstant, nitrogenLimit, leafArea, vapourPressureDeficit, maxRefPEP;
	const double activationEnergyCO2, activationEnergyO2;//todo
	const double referenceMichaelisCO2, referenceMichaelisO2;
	const double CO2Concentration, maxRefPEP, mConstant, referenceMaxCarboxylationEfficiency;
	const double vapourPressureDeficitReference;
	const bool C4Photo;
	double estimatedConductance;
	bool callBack;
};
class MeanStomatalConductance:public DerivativeBase{
public:
+71 −0
Original line number Diff line number Diff line
/*
Copyright © 2016 Forschungszentrum Jülich GmbH
All rights reserved.

Licensed to you under the GPL.v3 license

You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in license.txt but can also be found at http://www.gnu.org/licenses/gpl-3.0.en.html
*/


#include "PlantType.hpp"
#include "../cli/Messages.hpp"

//todo sunlit and shaded should really become nested like for the nutrients. and single roots etc, rather than by naming.
SimulaBase * initiateReference(SimulaBase * pSD, const std::string & name, const Unit & u){
	SimulaBase * p = initiateOptionalReference(pSD,name,u);
	if(!p) msg::error("initiateRerence: "+name+" not found but requested by "+pSD->getPath());
	return(p);
}
SimulaBase * initiateOptionalReference(SimulaBase * pSD, const std::string & name, const Unit & u){
	std::string label = pSD->getName().substr(0, 6); // name = sunlit or shaded
	const bool isPath=(name.find('/') != std::string::npos);
	if(isPath){
		return(pSD->existingPath(name , u));
	}else{
		if (label=="sunlit" || label=="shaded"){
			label+=name;
		}else{
			label=name;
			if (!isPath) label[1]=std::tolower(label[1]);
		}
		SimulaBase *p= pSD->existingSibling(label , u);
		if(!p) p= pSD->existingChild(label , u);
		return(p);
	}
}

double initiateParameterConstant(SimulaBase * pSD, const std::string & path, const double defaultValue, const Unit & u){
	SimulaBase *probe = pSD->existingPath(path,u);
	double v(defaultValue);
	if(probe) probe->get(v);
	return v;
}
double initiateShootParameterConstant(SimulaBase * pSD, const std::string & name, const double defaultValue, const Unit & u){
	std::string plantType;
	PLANTTYPE(plantType,pSD);
	SimulaBase *shootParameters = GETSHOOTPARAMETERS(plantType);
	SimulaBase *probe = shootParameters->existingChild(name, u);
	double v(defaultValue);
	if(probe) {
		probe->get(v);
		if(defaultValue !=0 && std::abs((v-defaultValue)/defaultValue)>1)
			msg::warning("inititateShootParameterConstant: Reading "+std::to_string(v)+" from "+probe->getPath()+" which deviates strongly from the default value of "+std::to_string(defaultValue));
	}else{
		msg::warning("inititateShootParameterConstant: "+name+" not found. Using the default value of "+std::to_string(defaultValue)+u.name);
	}
	return v;
}
bool initiateShootParameterBoolean(SimulaBase * pSD, const std::string & name, const bool defaultValue){
	std::string plantType;
	PLANTTYPE(plantType,pSD);
	SimulaBase *shootParameters = GETSHOOTPARAMETERS(plantType);
	SimulaBase *probe = shootParameters->existingChild(name);
	bool v(defaultValue);
	if(probe) probe->get(v);
	return v;
}



Loading