/**
* Populates the <code>LayeredMaterial</code> according to the ABM
* model from the model parameters.
*/
private synchronized void build() {
ColorModel cm = colorModel;
subsurface.clear();
// Function1 iorMesophyll = new AXpBFunction1(
// (1.0 - scattererFractionInMesophyll),
// 1.5608 * scattererFractionInMesophyll,
// IOR_WATER);
double iorMesophyll = 1.415;
double iorAntidermalWall = (1.0 - scattererFractionInAntidermalWall)
* MathUtil.mean(IOR_WATER_VALUES) + 1.535
* scattererFractionInAntidermalWall;
double concDryMatter = dryBulkDensity / (1.0 - airVolumeFraction);
double concProtein = concDryMatter * proteinFraction;
double concCellulose = concDryMatter * celluloseFraction;
double concLignin = concDryMatter * ligninFraction;
double absProtein = concProtein * SAC_PROTEIN;
double absCellulose = concCellulose * SAC_CELLULOSE_LIGNIN;
double absLignin = concLignin * SAC_CELLULOSE_LIGNIN;
Function1 mesophyllAbsorptionCoefficient = new SumFunction1()
.addChild(new ScaledFunction1(
concChlorophyllAInMesophyll + concChlorophyllBInMesophyll,
SAC_CHLOROPHYLL_AB))
.addChild(new ScaledFunction1(
concCarotenoidsInMesophyll,
SAC_CAROTENOIDS))
.addChild(new ConstantFunction1(absProtein + absCellulose + absLignin))
.addChild(SAC_WATER);
// try {
// OutputStream file = new FileOutputStream("/Users/brad/mesosac.csv");
// PrintStream out = new PrintStream(new CompositeOutputStream()
// .addChild(System.out)
// .addChild(file));
// for (int i = 400; i <= 700; i += 5) {
// out.println(mesophyllAbsorptionCoefficient.evaluate(1e-9 * (double) i));
// }
// out.flush();
// file.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
double mesophyllFraction = bifacial ? 0.5 : 0.8;
mesophyllThickness = mesophyllFraction * wholeLeafThickness;
double lambda = 550e-9;
System.out.printf("mesophyllAbsorptionCoefficient=%f", mesophyllAbsorptionCoefficient.evaluate(lambda));
System.out.println();
System.out.printf("mesophyllThickness=%f", mesophyllThickness);
System.out.println();
System.out.printf("mesophyllOpticalDepth=%f", mesophyllAbsorptionCoefficient.evaluate(lambda) * mesophyllThickness);
System.out.println();
System.out.printf("nCuticle=%f", IOR_CUTICLE.evaluate(lambda));
System.out.println();
System.out.printf("nWater=%f", IOR_WATER.evaluate(lambda));
System.out.println();
System.out.printf("sacWater=%f", SAC_WATER.evaluate(lambda));
System.out.println();
System.out.printf("nWall=%f", iorAntidermalWall);
System.out.println();
System.out.printf("nMesophyll=%f", iorMesophyll);
System.out.println();
System.out.printf("dryBulkDensity=%f", dryBulkDensity);
System.out.println();
double iorCuticle = MathUtil.mean(IOR_CUTICLE_VALUES);
double iorWater = MathUtil.mean(IOR_WATER_VALUES);
if (bifacial) {
subsurface
.addLayerToBottom(new ABMInterfaceMaterial(
iorCuticle, 1.0,
cuticleUndulationsAspectRatio,
epidermisCellCapsAspectRatio,
Double.POSITIVE_INFINITY,
epidermisCellCapsAspectRatio))
.addLayerToBottom(new ABMInterfaceMaterial(
iorMesophyll, iorCuticle,
epidermisCellCapsAspectRatio,
palisadeCellCapsAspectRatio,
epidermisCellCapsAspectRatio,
palisadeCellCapsAspectRatio))
.addLayerToBottom(new ABMSieveAbsorbingMaterial(
cm.getContinuous(mesophyllAbsorptionCoefficient),
mesophyllThickness))
.addLayerToBottom(new ABMInterfaceMaterial(
1.0, iorMesophyll,
palisadeCellCapsAspectRatio,
spongyCellCapsAspectRatio,
palisadeCellCapsAspectRatio,
spongyCellCapsAspectRatio))
.addLayerToBottom(new ABMInterfaceMaterial(
iorAntidermalWall, 1.0,
Double.POSITIVE_INFINITY,
Double.POSITIVE_INFINITY,
Double.POSITIVE_INFINITY,
Double.POSITIVE_INFINITY))
.addLayerToBottom(new ABMInterfaceMaterial(
iorCuticle, iorAntidermalWall,
Double.POSITIVE_INFINITY,
epidermisCellCapsAspectRatio,
Double.POSITIVE_INFINITY,
epidermisCellCapsAspectRatio))
.addLayerToBottom(new ABMInterfaceMaterial(
1.0, iorCuticle,
epidermisCellCapsAspectRatio,
Double.POSITIVE_INFINITY,
epidermisCellCapsAspectRatio,
cuticleUndulationsAspectRatio));
} else { // unifacial
topSpongyMesophyllLayer = new VariableThicknessAbsorbingMaterial(
cm.getContinuous(mesophyllAbsorptionCoefficient));
bottomSpongyMesophyllLayer = new VariableThicknessAbsorbingMaterial(
cm.getContinuous(mesophyllAbsorptionCoefficient));
subsurface
.addLayerToBottom(new ABMInterfaceMaterial(
iorCuticle, 1.0,
cuticleUndulationsAspectRatio, // \/
epidermisCellCapsAspectRatio, // \