Standard Layers Domains#

Note

See the /examples/domains/standardLayers/ folder for an example of standard layers with domains.

In order to use domains, we create a project of the correct type….

problem = createProject(calcType='domains');
problem = RAT.Project(calculation='domains')

The principle of setting up these calculations relies on firstly grouping the layers into domains, then grouping the defined domains intro contrasts, according to a domain ratio parameter:

../_images/domainsGraph.png

The example (in the examples folder), we define the layers as for conventional Standard Layers projects:

Layer1 = {'Layer 1',...         % Name of the Layer
          'L1 thick',...        % Layer thickness
          'L1 SLD',...          % Layer SLD
          'L1 Rough',...        % Layer roughness
          'L1 Hydr',...         % hydration (percent)
          'bulk out' };

Layer2 = {'Layer 2',...         % Name of the layer
          'L2 thick',...        % Layer thickness
          'L2 SLD',...          % Layer SLD
          'L2 Rough',...        % Layer roughness
          'L2 Hydr',...         % hydration (percent)
          'bulk out' };

Layer3 = {'Layer 3',...         % Name of the layer
          'L3 thick',...        % Layer thickness
          'L3 SLD',...          % Layer SLD
          'L3 Rough',...        % Layer roughness
          'L3 Hydr',...         % hydration (percent)
          'bulk out' };

problem.addLayerGroup({Layer1, Layer2, Layer3});
# Now group these parameters into layers
problem.layers.append(name='Layer 1',
                      thickness='L1 Thickness',
                      SLD='L1 SLD',
                      roughness='L1 Roughness',
                      hydration='L1 Hydration',
                      hydrate_with='bulk out')

problem.layers.append(name='Layer 2',
                      thickness='L2 Thickness',
                      SLD='L2 SLD',
                      roughness='L2 Roughness',
                      hydration='L2 Hydration',
                      hydrate_with='bulk out')

problem.layers.append(name='Layer 3',
                      thickness='L3 Thickness',
                      SLD='L3 SLD',
                      roughness='L3 Roughness',
                      hydration='L3 Hydration',
                      hydrate_with='bulk out')
    p      Name       Thickness       SLD       Roughness     Hydration    Hydrate with
    _    _________    __________    ________    __________    _________    ____________

    1    "Layer 1"    "L1 thick"    "L1 SLD"    "L1 Rough"    "L1 Hydr"     "bulk out" 
    2    "Layer 2"    "L2 thick"    "L2 SLD"    "L2 Rough"    "L2 Hydr"     "bulk out" 
    3    "Layer 3"    "L3 thick"    "L3 SLD"    "L3 Rough"    "L3 Hydr"     "bulk out" 
+-------+---------+--------------+--------+--------------+--------------+--------------+
| index |   name  |  thickness   |  SLD   |  roughness   |  hydration   | hydrate with |
+-------+---------+--------------+--------+--------------+--------------+--------------+
|   0   | Layer 1 | L1 Thickness | L1 SLD | L1 Roughness | L1 Hydration |   bulk out   |
|   1   | Layer 2 | L2 Thickness | L2 SLD | L2 Roughness | L2 Hydration |   bulk out   |
|   2   | Layer 3 | L3 Thickness | L3 SLD | L3 Roughness | L3 Hydration |   bulk out   |
+-------+---------+--------------+--------+--------------+--------------+--------------+

From this point, the model diverges from the usual Standard Layers case, in that the layers are grouped into domain contrasts, which appear in an additional table in the printout of the project class. Domains contrasts consist of only a model containing layers, with no bulk phases etc.

             p                    1        
    ___________________    ________________

    "Name"                 "Domain Test"   
    "Data"                 "Simulation"    
    "Background"           "Background 1"  
    "Background Action"    "add"           
    "Bulk in"              "SLD Air"       
    "Bulk out"             "SLD D2O"       
    "Scalefactor"          "Scalefactor 1" 
    "Resolution"           "Resolution 1"  
    "Resample"             "false"         
    "Domain Ratio"         "Domain Ratio 1"
    "Model"                "Domain1"       
    ""                     "Domain2"       
+-------+-------------+------------+--------------+-------------------+---------+----------+---------------+--------------+----------+----------------+----------+
| index |     name    |    data    |  background  | background action | bulk in | bulk out |  scalefactor  |  resolution  | resample |  domain ratio  |  model   |
+-------+-------------+------------+--------------+-------------------+---------+----------+---------------+--------------+----------+----------------+----------+
|   0   | Domain Test | Simulation | Background 1 |        add        | SLD Air | SLD D2O  | Scalefactor 1 | Resolution 1 |  False   | Domain Ratio 1 | Domain 1 |
|       |             |            |              |                   |         |          |               |              |          |                | Domain 2 |
+-------+-------------+------------+--------------+-------------------+---------+----------+---------------+--------------+----------+----------------+----------+

It is then these that are grouped into the final contrasts model. For each contrast, there must be exactly two (and only two) domain contrasts in the model. In addition, each contrast requires a domain ratio parameter. This is a fittable parameter between 0 and 1, that appears in the domain ratio table:

    p          Name          Min    Value    Max    Fit? 
    _    ________________    ___    _____    ___    _____

    1    "Domain Ratio 1"    0.4     0.5     0.6    false
+-------+----------------+-----+-------+-----+-------+
| index |      name      | min | value | max |  fit  |
+-------+----------------+-----+-------+-----+-------+
|   0   | Domain Ratio 1 | 0.4 |  0.5  | 0.6 | False |
+-------+----------------+-----+-------+-----+-------+

leading to the final contrast structure of two domains, and one domain ratio:

       p           1            2    
    _______    _________    _________

    "Name"     "Domain1"    "Domain2"
    "Model"    "Layer 1"    "Layer 2"
    ""         ""           "Layer 3"
+-------+----------+---------+
| index |   name   |  model  |
+-------+----------+---------+
|   0   | Domain 1 | Layer 1 |
|   1   | Domain 2 | Layer 2 |
|       |          | Layer 3 |
+-------+----------+---------+

Note

For the domain ratio, a value of 0 means 100% Domain 1, whilst conversely a value of 1 means 100% Domain 2.