Class SlimAlfaTransformer

java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.resources.FWSimInputAdapter
net.simplace.sim.io.resources.FWSimResourceTransformer
net.simplace.sim.transformers.SlimAlfaTransformer
All Implemented Interfaces:
net.simplace.sim.util.FWSimFieldContainer

public class SlimAlfaTransformer extends net.simplace.sim.io.resources.FWSimResourceTransformer
WIKI_START Extension of the !SoilLayerTransformer that calculates additionally the parameter ALFA for !SlimWater model. == Description == For rescaling layers see the description of the !SoilLayerTransformer. Here we add only information regarding the additional calculation of !SlimAlfa. The parameter ALFA is used by !SlimWater to determine the fraction of mobile water that moves from one layer to the next layer. It can be derived from clay content (in %) by the empirical formula from Addiscott and Whitmore: WIKI_END \[ \alpha_{ref}=\begin{cases} 1.0 & \text{when } clay \le 9.5 \\ 1.0271 - 0.000302(clay)^2 &\text{when } 9.5 \le clay \le 58.3 \\ 0 &\text{when } clay \ge 58.3 \end{cases} \] WIKI_START This formula is valid for a layer thickness of 5cm=0.05m. For different layer thickness, the ALFA should be rescaled because otherwise the seeping will be underestimated for thinner layers and overestimated for thicker layers compared to 5cm. Actually the ALFA depends on the number of layers, but if the number of layers is above 6, then one can simplify the rescaling formula and make it dependend only on the layer thickness `thick` (in meter) of the transformed layers. WIKI_END \[ \alpha_{thick} \approx 2 \frac{ \frac{0.05}{thick}}{\frac{2}{\alpha_{ref}} - 1 + \frac{0.05}{thick}} \] WIKI_START This transformer takes the `ClayPercentage` values for each layer, calculates the reference ALFA for 5 cm (`SlimAlfaReference5cm`), the unbound rescaled ALFA (`SlimAlfaUnbound`) for the thickness of transformed layers and the ALFA that limits the unbound rescaled ALFA (`SlimAlfa`) to values between 0 and 1 by setting higher values to 1. === Notice === Changing layer thickness in SLIM has an impact on the results. Using a rescaled ALFA tries to maintain the overall soil water content and seeping at comparable ranges. There is also an interaction with the aliquot WALIQ which may lead to bigger differences especially on days with high rainfall. As !SlimWater moves the mobile water in two steps, it uses in each step ALFA/2. For thinner layers the required ALFA could then be above 1. Nevertheless, !SlimWater has not been specified to use ALFA values bigger than 1, although it might work technically. The transformer delivers therefore the unbound rescaled ALFA which could be higher than 1, as well as the ALFA limited to 1. So the user may decide, which ALFA to use in !SlimWater. Rescaling ALFA does not solve the problem of changing the layer thickness, but it may mitigate it. == Configuration == {{{
... ... ...
depth clay 0.03
}}} The variable `depth` contains the depth information for the initial layers, therefore the input `depthfieldid` is set to `depth`. The variable `clay` contains the clay information for the initial layers, therefore the input `claypercentagefieldid` is set to `clay`. Scalar values like `drainagerate` are not transformed, they are just passed unchanged to the transformer's output. The variable `nitrogen` contains amounts (absolute values), therefore the values from overlapping layers have to be summed up / partitioned. The resource variables to be transformed have to be all in the transformed resource `soil` except `SlimAlfaReference5cm`, `SlimAlfaUnbound`, `SlimAlfa`. Only those variables mentioned in the transformer will be transformed. ==References:== - Addiscott, T.M., Heys, P.J., Whitmore, A.P., 1986. Application of simple leaching models in heterogeneous soils. Geoderma 38, 185-194. - Addiscott, T.M., Whitmore, A.P., 1991. Simulation of solute leaching in soils with different permeabilities. Soil Use Manage. 7, 94-102. WIKI_END
Author:
Gunther Krauss
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.simplace.sim.io.FWSimIOAdapter

    net.simplace.sim.io.FWSimIOAdapter.FREQUENCE
  • Field Summary

    Fields inherited from class net.simplace.sim.io.resources.FWSimResourceTransformer

    iFieldMap, iIntColumnMap, iLastInputValuesMap, iLastProjectID, iLastUniqueID, iPoolName, iSourceName

    Fields inherited from class net.simplace.sim.io.resources.FWSimInputAdapter

    iJexlScript, iShouldCacheToDB

    Fields inherited from class net.simplace.sim.io.FWSimIOAdapter

    iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey
  • Constructor Summary

    Constructors
    Constructor
    Description
    SlimAlfaTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber)
     
    SlimAlfaTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.simplace.sim.io.resources.FWSimResourceCache
    calculateSlimAlfa(net.simplace.sim.util.FWSimVariable<Double> aThicknessOfLayers, net.simplace.sim.util.FWSimVariable<Integer> aLayerCount, net.simplace.sim.util.FWSimVariable<String> aDepthFieldName, net.simplace.sim.util.FWSimVariable<String> aClayFieldName, String aProjectID, net.simplace.sim.io.resources.FWSimResourceCache aCache)
    Rescales the soil layer
    HashMap<String,net.simplace.sim.util.FWSimVariable<?>>
     
    double
    getAlfa(double clay, double thickness)
     
    net.simplace.sim.io.resources.FWSimResourceCache
    getData(net.simplace.sim.util.FWSimVarMap aVarMap)
    standard method from outside
    net.simplace.sim.io.resources.FWSimResourceCache
    getData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache)
    used by test cases
    double
    getReferenceAlfa(double clay)
     
    double
    getRescaledAlfa(double alfa, double thicknesssold, double thicknessnew)
     
    void
    updateFields(net.simplace.core.FWObservable aObservable)
     

    Methods inherited from class net.simplace.sim.io.resources.FWSimResourceTransformer

    addVariable, createFormFields, createResourceTransformer, createResourceTransformer, createResourceTransformer, fillVarMap, getCreateFormXML, getEditFormXML, getSourceResourceCache, getVariable, isUpdated, toXML

    Methods inherited from class net.simplace.sim.io.resources.FWSimInputAdapter

    getContentType, getInputVariables, getJexlScript, getOutputVariables, getVarMap, isTransformer, shouldCacheToDB, toHTMLTablestring

    Methods inherited from class net.simplace.sim.io.FWSimIOAdapter

    addProcessTime, checkCondition, createFormFields, finalize, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getInterface, getJexlRule, getKeyMap, getName, getOrderNumber, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderList

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SlimAlfaTransformer

      public SlimAlfaTransformer(net.simplace.sim.FWSimSession aSession, org.jdom2.Element aResourceElement, Integer aOrderNumber)
      Parameters:
      aSession -
      aResourceElement -
      aOrderNumber -
    • SlimAlfaTransformer

      public SlimAlfaTransformer(net.simplace.sim.FWSimSession aSession, Integer aOrderNumber)
      Parameters:
      aSession -
      aOrderNumber -
  • Method Details

    • createVariables

      public HashMap<String,net.simplace.sim.util.FWSimVariable<?>> createVariables()
      Specified by:
      createVariables in interface net.simplace.sim.util.FWSimFieldContainer
      Overrides:
      createVariables in class net.simplace.sim.io.FWSimIOAdapter
    • getData

      public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap) throws net.simplace.sim.exceptions.MissingSimResourceException
      standard method from outside
      Specified by:
      getData in class net.simplace.sim.io.resources.FWSimInputAdapter
      Throws:
      net.simplace.sim.exceptions.MissingSimResourceException
      See Also:
      • FWSimInputAdapter.getData(net.simplace.sim.util.FWSimVarMap)
    • getData

      public net.simplace.sim.io.resources.FWSimResourceCache getData(net.simplace.sim.util.FWSimVarMap aVarMap, net.simplace.sim.io.resources.FWSimResourceCache aResourceCache) throws net.simplace.sim.exceptions.MissingSimResourceException
      used by test cases
      Parameters:
      aVarMap - variable map
      aResourceCache - Cached resources (soil data)
      Returns:
      delivered new data from transformer
      Throws:
      net.simplace.sim.exceptions.MissingSimResourceException
    • getReferenceAlfa

      public double getReferenceAlfa(double clay)
    • getRescaledAlfa

      public double getRescaledAlfa(double alfa, double thicknesssold, double thicknessnew)
    • getAlfa

      public double getAlfa(double clay, double thickness)
    • calculateSlimAlfa

      public net.simplace.sim.io.resources.FWSimResourceCache calculateSlimAlfa(net.simplace.sim.util.FWSimVariable<Double> aThicknessOfLayers, net.simplace.sim.util.FWSimVariable<Integer> aLayerCount, net.simplace.sim.util.FWSimVariable<String> aDepthFieldName, net.simplace.sim.util.FWSimVariable<String> aClayFieldName, String aProjectID, net.simplace.sim.io.resources.FWSimResourceCache aCache) throws net.simplace.sim.exceptions.MisconfiguredTransformerException
      Rescales the soil layer
      Parameters:
      aThicknessOfLayers - thickness of the layers
      aLayerCount - total number of layers
      aDepthFieldName - name of the depth field
      aProjectID - id of the project
      aCache - original soil info stored
      Returns:
      the new created FWSimResourceCache
      Throws:
      net.simplace.sim.exceptions.MisconfiguredTransformerException
    • updateFields

      public void updateFields(net.simplace.core.FWObservable aObservable)
      Specified by:
      updateFields in class net.simplace.sim.io.resources.FWSimResourceTransformer
      See Also:
      • FWSimResourceTransformer.updateFields(net.simplace.core.FWObservable)