Commit 26d4d5db authored by jouke's avatar jouke
Browse files

This is an attempt to get a maize-farquhar running.

- Several template fixes necessary to even get the model to load
- Several code changes in order to get it to run
- This runs till day 3.52 and then segfaults. The segfault is caused by
a loop in the function calls which causes the stack to fill up with an
endless loop of calls. The problem is that the farquhar model needs a
convergence loop. Somehow the solver for this is missing. Maybe this is
an engine change but normally, but I think changing the templates to
place a convergence solver in the loop, should do it?
parent a125a62b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in lic
		<SimulaConstant name="rubiscoSpecificityActivationEnergy" unit="J/mol">27400</SimulaConstant><!-- https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4861018/ -->
		<SimulaTable name_column1="time since creation" unit_column1="day" name_column2="potentialCropHeightGrowthSpeed" unit_column2="cm/day" garbageCollectionOff="true">0 0 3 0 5 2 10 2 12 4 600 4</SimulaTable>
		<SimulaConstant name="leafWidth" unit="m">0.09</SimulaConstant>
		<SimulaConstant name="extinctionCoefficient" unit="noUnit">0.45</SimulaConstant><!-- 0.45 APSIM and https://acsess.onlinelibrary.wiley.com/doi/abs/10.2134/agronj1996.00021962008800020011x -->
		<SimulaConstant	name="lightUseEfficiency" unit="g/J">1.74E-6</SimulaConstant>
		<SimulaConstant name="extinctionCoefficient" unit="noUnit" replacesPreviousDeclaration="true">0.45</SimulaConstant><!-- 0.45 APSIM and https://acsess.onlinelibrary.wiley.com/doi/abs/10.2134/agronj1996.00021962008800020011x -->
		<SimulaConstant	name="lightUseEfficiency" unit="g/J"  replacesPreviousDeclaration="true">1.74E-6</SimulaConstant>
	</SimulaDirective>
</SimulationModelIncludeFile>
+87 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
	Simulation file for SimRoot version 5. This development version, build July 2007
	Author: Jouke Postma
	Note: 
	
	PLEASE KEEP THIS HEADER UP TO DATE! LIST BELOW WHO YOU ARE, WHEN AND WHAT CHANGES YOU MADE AND WHY. LIST YOUR SOURCE AS MUCH AS POSSIBLE!

	change log: 
	11-july-07 added support for include files. 
	
	
-->
<!--STYLE SHEET SECTION: feel free to attach any stylesheet of your choosing-->
<!--?xml-stylesheet type="text/xsl" href="tree-view2.xsl"?-->
<?xml-stylesheet type="text/xsl" href="XML/treeview.xsl"?>

<!--SIMULATION MODEL-->
<SimulationModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="https://rootmodels.gitlab.io/opensimroot/XML/SimulaXMLSchema.xsd"
    defaultStartingTimeStep="0.02"
	synchronizationTimeStep="0.02" 
	defaultMaximumTimeStep="0.02"
	defaultMinimumTimeStep="0.02">

	<SimulaBase name="atmosphere">
	</SimulaBase>	
	<SimulaBase name="soil">
	</SimulaBase>	

	
	<SimulaBase name="plants">
		<SimulaBase name="maize" objectGenerator="seedling">
			<SimulaConstant name="plantType" type="string">
			<!-- 	H99 w64a 36H56 noRCAinLaterals maize-aerenchyma--> 
				maize-aerenchyma
			</SimulaConstant>	
			<SimulaConstant name="plantingTime"  unit="day" type="time">
				0
			</SimulaConstant>	
			<SimulaConstant name="plantPosition" type="coordinate">
					0 -2 0
			</SimulaConstant>
		</SimulaBase>	
	</SimulaBase>	

	<SimulaIncludeFile fileName="plantParameters/Maize/Maize/simulationControlParameters.xml"/>
	<SimulaIncludeFile fileName="templates/plantTemplateFullModel.xml"/>
	<!-- SimulaIncludeFile fileName="environments/Rocksprings/Rocksprings-maize.xml"/-->
	<SimulaIncludeFile fileName="environments/WageningseBovenBuurt/WageningseBovenBuurt-maize.xml"/>
	
	<!--  for faster testing purposes -->
    <SimulaDirective path="/environment/dimensions">
      <SimulaConstant name="resolution" type="coordinate" replacesPreviousDeclaration="true"> 3 3 3 </SimulaConstant>
    </SimulaDirective>
	

	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeGeometry.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeDryweight.xml" />

	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludePhosphorusBC.xml" /-->
	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludePhosphorus3D.xml" /-->
	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludeNitrateBasic.xml"/-->
	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludeWaterModule.xml"/>
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeNitrate3D.xml"/-->
	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludePotassium3D.xml" /-->

	<!--SimulaIncludeFile fileName="templates/configurationCarbon.xml"/-->
	
	<!--note that this pulls in the drought and evaporation -->
	<SimulaIncludeFile fileName="templates/configurationCarbonC3C4.xml"/>

	
	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludeStress.xml"/>
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeRootHairs.xml"/>
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeAerenchyma.xml"/>
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeRootLengthProfile.xml"/-->
	<!--SimulaIncludeFile fileName="templates/plantTemplate.IncludeLocalNutrientResponses.xml"/-->

	<SimulaBase name="rootTypeParameters" >
		<SimulaIncludeFile fileName="plantParameters/Maize/Maize/maize.xml"/>
		<SimulaDirective path="maize-aerenchyma">
		<SimulaIncludeFile fileName="plantParameters/Maize/C3C4PhotosynthesisParameters.xml"/>
		</SimulaDirective>
	</SimulaBase>
</SimulationModel>

+5 −3
Original line number Diff line number Diff line
@@ -22,11 +22,10 @@ You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in lic

 -->
<SimulationModelIncludeFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../scripts/XML/SimulaXMLSchema.xsd">
<!-- these modules are listed by dependency. You can turn them off one by one, startin at the top
but carbonsinks and carbon module are mutually dependen -->

	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeCarbonBalance.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeCarbonModule.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeCarbonAllocation.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.C3C4Photosynthesis.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeCarbonSinks.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeCarbonSecondaryGrowth.xml" />
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeRespirationC3C4.xml"/>
@@ -34,4 +33,7 @@ but carbonsinks and carbon module are mutually dependen -->
	
	<SimulaIncludeFile fileName="templates/plantTemplate.IncludeDroughtC3C4.xml"/>
	<SimulaIncludeFile fileName="templates/environmentTemplate.IncludeEvapotranspirationC3C4.xml"/>

	<SimulaIncludeFile fileName="templates/plantTemplate.C3C4Photosynthesis.xml" />

</SimulationModelIncludeFile>
+44 −15
Original line number Diff line number Diff line
@@ -26,9 +26,9 @@ You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in lic
<!--ShootTemplate-->
	<SimulaDirective path="/shootTemplate">
		<SimulaVariable name="photosynthesisLintul" function="photosynthesisLintulV2" unit="g" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="lightInterception" function="farquharLightInterception" unit="W/m2" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitLightInterception" function="sunlitLightInterception" unit="W/m2"/>
		<SimulaDerivative name="shadedLightInterception" function="shadedLightInterception" unit="W/m2"/>
		<SimulaDerivative name="lightInterception" function="meanLightInterception" unit="W/m2" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitLightInterception" function="meanLightInterception" unit="W/m2"/>
		<SimulaDerivative name="shadedLightInterception" function="meanLightInterception" unit="W/m2"/>
		<SimulaVariable name="photosynthesis" function="sumOfSunlitAndShaded" unit="g" replacesPreviousDeclaration="true"/>
		<SimulaVariable name="sunlitPhotosynthesis" function="integratePhotosynthesisRate" unit="g"/>
		<SimulaVariable name="shadedPhotosynthesis" function="integratePhotosynthesisRate" unit="g"/>
@@ -65,9 +65,19 @@ You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in lic
		<SimulaDerivative name="stomatalConductance" function="weighedAverageOfSunlitAndShaded" unit="mol/m2/s" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitStomatalConductance" function="stomatalConductance" unit="mol/m2/s"/>
		<SimulaDerivative name="shadedStomatalConductance" function="stomatalConductance" unit="mol/m2/s"/>
		<!--SimulaConstant name="leafTemperature" unit="degreesC"> 20 </SimulaConstant>
		<SimulaConstant name="sunlitLeafTemperature" unit="degreesC"> 20 </SimulaConstant>
		<SimulaConstant name="shadedLeafTemperature" unit="degreesC"> 20 </SimulaConstant-->

		<SimulaDerivative name="leafTemperature" function="weighedAverageOfSunlitAndShaded" unit="degreesC" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitLeafTemperature" function="leafTemperature" unit="degreesC"/>
		<SimulaDerivative name="shadedLeafTemperature" function="leafTemperature" unit="degreesC"/>
		
		<SimulaDerivative name="leafIrradiation" function="leafIrradiation" unit="W/m2"/>
		<SimulaDerivative name="sunlitLeafIrradiation" function="sunlitLeafIrradiation" unit="W/m2"/>
		<SimulaDerivative name="shadedLeafIrradiation" function="leafIrradiation" unit="W/m2"/>
		
		
		<SimulaVariable name="cropHeight" function="cropHeight" unit="cm"/>
		<SimulaVariable name="potentialCropHeight" function="cropHeight" unit="cm"/>
		<SimulaVariable name="sunlitLeafArea" unit="cm2" function="sunlitLeafArea"/>
@@ -78,27 +88,46 @@ You should have received the GNU GENERAL PUBLIC LICENSE v3 with this file in lic
		<SimulaVariable name="shadedLeafRespiration" unit="g" function="useDerivative"/>
		<SimulaVariable name="sunlitLeafRespiration" unit="g" function="useDerivative"/>
		<SimulaDerivative name="leafRespirationRate" unit="g/day" function="weighedAverageOfSunlitAndShaded" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitLeafRespirationRate" unit="g/day" function="leafRespirationRateFarquhar"/>
		<SimulaDerivative name="shadedLeafRespirationRate" unit="g/day" function="leafRespirationRateFarquhar"/>
		<SimulaVariable name="potentialTranspiration" unit="cm3" function="useDerivative"/>
		<SimulaVariable name="shadedPotentialTranspiration" unit="cm3" function="useDerivative"/>
		<SimulaVariable name="sunlitPotentialTranspiration" unit="cm3" function="useDerivative"/>
		<SimulaDerivative name="potentialTranspirationRate" unit="cm3/day" function="sumOfSunlitAndShaded"/>
		<SimulaDerivative name="sunlitPotentialTranspirationRate" unit="cm3/day" function="simplePotentialTranspirationRate"/>
		<SimulaDerivative name="shadedPotentialTranspirationRate" unit="cm3/day" function="simplePotentialTranspirationRate"/>
		<SimulaDerivative name="sunlitLeafRespirationRate" unit="g/day" function="leafRespirationRateFarquhar" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="shadedLeafRespirationRate" unit="g/day" function="leafRespirationRateFarquhar"replacesPreviousDeclaration="true"/>
		<SimulaVariable name="potentialTranspiration" unit="cm3" function="useDerivative" replacesPreviousDeclaration="true"/>
		<SimulaVariable name="shadedPotentialTranspiration" unit="cm3" function="useDerivative" replacesPreviousDeclaration="true"/>
		<SimulaVariable name="sunlitPotentialTranspiration" unit="cm3" function="useDerivative" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="potentialTranspirationRate" unit="cm3/day" function="sumOfSunlitAndShaded" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitPotentialTranspirationRate" unit="cm3/day" function="simplePotentialTranspirationRate" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="shadedPotentialTranspirationRate" unit="cm3/day" function="simplePotentialTranspirationRate"replacesPreviousDeclaration="true"/>
	</SimulaDirective>

	<SimulaDirective path="plants">
		<SimulaDerivative name="sunlitMeanLeafAreaIndex" function="meanLeafAreaIndex" unit="cm2/cm2"/>
		<SimulaDerivative name="shadedMeanLeafAreaIndex" function="meanLeafAreaIndex" unit="cm2/cm2"/>
   				
		<SimulaDerivative name="meanSunlitLeafAreaIndex" function="meanLeafAreaIndex" unit="cm2/cm2"/>
		<SimulaDerivative name="meanShadedLeafAreaIndex" function="meanLeafAreaIndex" unit="cm2/cm2"/>
		<SimulaDerivative name="sunlitLeafArea" function="sumOverAllPlantShoots" unit="cm2"/>
		<SimulaDerivative name="shadedLeafArea" function="sumOverAllPlantShoots" unit="cm2"/>
		<SimulaDerivative name="stomatalResistance" function="weighedAverageOfSunlitAndShaded" unit="s/m" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="sunlitStomatalResistance" function="stomatalResistance" unit="s/m"/>
		<SimulaDerivative name="shadedStomatalResistance" function="stomatalResistance" unit="s/m"/>
		<SimulaDerivative name="meanStomatalConductance" function="weighedAverageOfSunlitAndShaded" unit="mol/m2/s"/>
		<SimulaDerivative name="meanStomatalConductance" function="weighedAverageOfSunlitAndShaded" unit="mol/m2/s" replacesPreviousDeclaration="true"/>
		<SimulaDerivative name="meanSunlitStomatalConductance" function="meanStomatalConductance" unit="mol/m2/s"/>
		<SimulaDerivative name="meanShadedStomatalConductance" function="meanStomatalConductance" unit="mol/m2/s"/>
		<SimulaDerivative name="canopyHeight" function="maximumCanopyHeight" unit="cm"/>
		<SimulaDerivative name="canopyHeight" function="maximumCanopyHeight" unit="cm" replacesPreviousDeclaration="true"/>
	</SimulaDirective>
	
	<SimulaDirective path="/environment/atmosphere">
		<SimulaDerivative name="sineSolarElevationAngle" function="sineSolarElevationAngle" unit="cm" replacesPreviousDeclaration="true"/>
		<!--SimulaDerivative name="solarElevationAngle" function="solarElevationAngle"/-->
			<SimulaDerivative name="irradiation" function="diurnalRadiationSimulator" unit="W/m2"/>
			<SimulaDerivative name="beamIrradiation" function="beamRadiationSimulator" unit="W/m2"/>
			<SimulaDerivative name="diffuseIrradiation" function="diffuseRadiationSimulator" unit="W/m2"/>
			<SimulaDerivative name="dayLightHours" function="photoPeriod" unit="hour"/>
			<!--SimulaConstant name="solarRadiationAt1AU" unit="W/m2">800</SimulaConstant-->
			<SimulaDerivative name="netRadiation" function="diurnalRadiationSimulator" unit="W/m2"/>
			<SimulaDerivative name="netRadiationSoil" function="diurnalRadiationSimulator" unit="W/m2">
				<SimulaDerivative name="multiplier" function="soilRadiationFactor"/>
			</SimulaDerivative>
			<SimulaConstant name="referenceVapourPressureDeficit" prettyName="reference Vapour Pressure Deficit" type="double" unit="hPa">16.4</SimulaConstant>
			<SimulaConstant name="CO2Concentration" prettyName="CO2 Concentration" type="double" unit="umol/mol">402.9</SimulaConstant>
			<SimulaConstant name="O2Concentration" prettyName="O2 Concentration" type="double" unit="mmol/mol">209.46</SimulaConstant>
			<SimulaConstant name="atmosphericTransmissionCoefficient">0.72</SimulaConstant>
	</SimulaDirective>
</SimulationModelIncludeFile>
+132 −53

File changed.

Preview size limit exceeded, changes collapsed.

Loading