{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.5/project/ground.schema.json",
  "$comment": "OpenEik 0.5: folded by tools/fold-schemas-0.5.mjs from the proposal ground, which 0.5 makes a rule (open questions, 132). Written by hand, not generated.",
  "title": "project/ground.json",
  "description": "The ground a building stands on (Part XIX: its soil profiles, its ground level and groundwater level where nothing else gives them, the pits a project digs and the loads on the ground. Places, levels and lengths in mm in the model's axes; heights absolute from the project's zero (Part XIX, 3); stresses and moduli in kPa, unit weights in kN/m³, angles in degrees, cv in m²/year and kv in m/year.",
  "type": "object",
  "properties": {
    "ground": {
      "type": "object",
      "properties": {
        "groundLevel": {
          "$ref": "#/$defs/height",
          "description": "The ground level where no terrain gives one (Part XIX, 5.5, item 2): a height."
        },
        "groundwater": {
          "$ref": "#/$defs/height",
          "description": "The groundwater level where no profile gives one (Part XIX, 5.4): a height."
        },
        "profiles": {
          "type": "array",
          "minItems": 1,
          "maxItems": 1000,
          "items": {
            "$ref": "#/$defs/profile"
          },
          "description": "The soil profiles (Part XIX, 4)."
        },
        "pits": {
          "type": "array",
          "minItems": 1,
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/pit"
          },
          "description": "The pits the project digs (Part XIX, 6)."
        },
        "loads": {
          "type": "array",
          "minItems": 1,
          "maxItems": 1000,
          "items": {
            "$ref": "#/$defs/load"
          },
          "description": "The loads on the ground (Part XIX, 7)."
        }
      },
      "x-eik-closed": true
    }
  },
  "required": [
    "ground"
  ],
  "x-eik-closed": true,
  "$defs": {
    "height": {
      "type": "number",
      "description": "A height: absolute z in mm from the project's zero (±0), not relative to a level (Part XIX, 3, rule 2)."
    },
    "point": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "prefixItems": [
        {
          "type": "number"
        },
        {
          "type": "number"
        }
      ],
      "description": "A point in plan, [x, y] in mm."
    },
    "polygon": {
      "type": "array",
      "minItems": 3,
      "maxItems": 64,
      "items": {
        "$ref": "#/$defs/point"
      },
      "description": "A simple polygon in plan, 3 to 64 points, not repeating its first (Part XIX, 6, rule 1)."
    },
    "id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "pattern": "^[^/\\s]+$",
      "description": "An id, unique among its list's (Part XIX, 2, rule 3)."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "profile": {
      "type": "object",
      "description": "A soil profile: a column of layers at a point in plan (Part XIX, 4.1).",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "at": {
          "$ref": "#/$defs/point",
          "description": "Its point in plan (rule 1)."
        },
        "source": {
          "enum": [
            "borehole",
            "stated"
          ],
          "description": "Where it comes from (rule 2)."
        },
        "top": {
          "$ref": "#/$defs/height",
          "description": "The ground level at the profile, the top of its first layer (rule 3): a height."
        },
        "groundwater": {
          "$ref": "#/$defs/height",
          "description": "The groundwater level at the profile (rule 4): a height."
        },
        "diameter": {
          "type": "number",
          "exclusiveMinimum": 0,
          "description": "The diameter of the bore that gave the profile, or of a sounding's probe, in mm (rule 6); a borehole's profile alone gives it."
        },
        "layers": {
          "type": "array",
          "minItems": 1,
          "maxItems": 40,
          "items": {
            "$ref": "#/$defs/layer"
          },
          "description": "Its layers, from the top down (rule 5)."
        }
      },
      "required": [
        "id",
        "at",
        "source",
        "layers"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "source": {
                "const": "stated"
              }
            },
            "required": [
              "source"
            ]
          },
          "then": {
            "not": {
              "required": [
                "diameter"
              ]
            }
          }
        }
      ],
      "x-eik-closed": true
    },
    "layer": {
      "type": "object",
      "description": "A layer of a profile (Part XIX, 4.2).",
      "properties": {
        "name": {
          "$ref": "#/$defs/name",
          "description": "Its stratum (rule 1)."
        },
        "soil": {
          "enum": [
            "clay",
            "silt",
            "sand",
            "gravel",
            "till",
            "organic",
            "fill",
            "rock"
          ],
          "description": "Its soil (rule 2)."
        },
        "bottom": {
          "$ref": "#/$defs/height",
          "description": "Its bottom level, a height; or thickness (rule 3)."
        },
        "thickness": {
          "type": "number",
          "description": "Its thickness under the layer above, in mm: a length (rule 3).",
          "exclusiveMinimum": 0
        },
        "gamma": {
          "type": "number",
          "description": "Its unit weight above the groundwater, kN/m³ (rule 5).",
          "exclusiveMinimum": 0,
          "maximum": 30
        },
        "gammaPrime": {
          "type": "number",
          "description": "Its effective (submerged) unit weight under it, kN/m³ (rule 5).",
          "exclusiveMinimum": 0,
          "maximum": 30
        },
        "law": {
          "$ref": "#/$defs/law"
        },
        "phi": {
          "type": "number",
          "description": "The drained friction angle φ′, characteristic, degrees (rule 7).",
          "minimum": 0,
          "maximum": 50
        },
        "c": {
          "type": "number",
          "description": "The drained cohesion c′, characteristic, kPa (rule 7).",
          "minimum": 0
        },
        "cu": {
          "type": "number",
          "description": "The undrained shear strength c_u, characteristic, kPa (rule 7).",
          "exclusiveMinimum": 0
        },
        "drains": {
          "type": "boolean",
          "description": "Whether it drains the fine layers next to it; by default sand, gravel, till and fill do and rock does not; not given on clay, silt or organic soil (rule 8)."
        },
        "pore": {
          "type": "object",
          "description": "A stated pore pressure, kPa at the layer's top and bottom, linear between (rule 9).",
          "properties": {
            "top": {
              "type": "number",
              "description": "kPa at its top.",
              "minimum": 0
            },
            "bottom": {
              "type": "number",
              "description": "kPa at its bottom.",
              "minimum": 0
            }
          },
          "required": [
            "top",
            "bottom"
          ],
          "x-eik-closed": true
        }
      },
      "required": [
        "name",
        "soil",
        "gamma",
        "gammaPrime",
        "law"
      ],
      "oneOf": [
        {
          "required": [
            "bottom"
          ],
          "not": {
            "required": [
              "thickness"
            ]
          }
        },
        {
          "required": [
            "thickness"
          ],
          "not": {
            "required": [
              "bottom"
            ]
          }
        }
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "soil": {
                "enum": [
                  "clay",
                  "silt",
                  "organic"
                ]
              }
            },
            "required": [
              "soil"
            ]
          },
          "then": {
            "not": {
              "required": [
                "drains"
              ]
            }
          }
        }
      ],
      "x-eik-closed": true
    },
    "law": {
      "description": "Its compression law (Part XIX, 4.3): law names it.",
      "type": "object",
      "properties": {
        "law": {
          "enum": [
            "elastic",
            "tangent",
            "clay",
            "incompressible"
          ]
        }
      },
      "required": [
        "law"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "law": {
                "const": "elastic"
              }
            },
            "required": [
              "law"
            ]
          },
          "then": {
            "properties": {
              "law": true,
              "E": {
                "type": "number",
                "description": "Young's modulus, kPa.",
                "exclusiveMinimum": 0
              },
              "nu": {
                "type": "number",
                "description": "Poisson's ratio.",
                "minimum": 0,
                "maximum": 0.5
              }
            },
            "required": [
              "E",
              "nu"
            ],
            "x-eik-closed": true
          }
        },
        {
          "if": {
            "properties": {
              "law": {
                "const": "tangent"
              }
            },
            "required": [
              "law"
            ]
          },
          "then": {
            "properties": {
              "law": true,
              "m": {
                "type": "number",
                "description": "The modulus number.",
                "exclusiveMinimum": 0
              },
              "j": {
                "type": "number",
                "description": "The stress exponent: 0.5 sand, 0 an overconsolidated clay, 1 a constant M.",
                "minimum": 0,
                "maximum": 1
              },
              "sigmaRef": {
                "type": "number",
                "description": "σ_a, kPa; 100 where not given.",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "m",
              "j"
            ],
            "x-eik-closed": true
          }
        },
        {
          "if": {
            "properties": {
              "law": {
                "const": "clay"
              }
            },
            "required": [
              "law"
            ]
          },
          "then": {
            "properties": {
              "law": true,
              "M0": {
                "type": "number",
                "description": "The modulus below σ′c, kPa.",
                "exclusiveMinimum": 0
              },
              "ML": {
                "type": "number",
                "description": "The modulus from σ′c to σ′L, kPa.",
                "exclusiveMinimum": 0
              },
              "sigmaL": {
                "type": "number",
                "description": "σ′L, kPa, at or above σ′c.",
                "exclusiveMinimum": 0
              },
              "Mprime": {
                "type": "number",
                "description": "M′: the rise of the modulus above σ′L per kPa, without a unit.",
                "minimum": 0
              },
              "sigmaC": {
                "type": "number",
                "description": "σ′c, kPa.",
                "exclusiveMinimum": 0
              },
              "OCR": {
                "type": "number",
                "description": "σ′c/σ′v0.",
                "minimum": 1
              },
              "POP": {
                "type": "number",
                "description": "σ′c − σ′v0, kPa.",
                "minimum": 0
              },
              "cv": {
                "type": "number",
                "description": "The coefficient of consolidation c_v, m²/year (Part XIX, 3, rule 4).",
                "exclusiveMinimum": 0
              },
              "kv": {
                "type": "number",
                "description": "The permeability k_v, m/year (Part XIX, 3, rule 4).",
                "exclusiveMinimum": 0
              },
              "alphaS": {
                "type": "number",
                "description": "The secondary compression index α_s.",
                "exclusiveMinimum": 0
              },
              "rs": {
                "type": "number",
                "description": "The creep number r_s.",
                "exclusiveMinimum": 0
              },
              "Eu": {
                "type": "number",
                "description": "The undrained Young's modulus, kPa.",
                "exclusiveMinimum": 0
              }
            },
            "required": [
              "M0",
              "ML",
              "sigmaL",
              "Mprime"
            ],
            "oneOf": [
              {
                "required": [
                  "sigmaC"
                ],
                "not": {
                  "anyOf": [
                    {
                      "required": [
                        "OCR"
                      ]
                    },
                    {
                      "required": [
                        "POP"
                      ]
                    }
                  ]
                }
              },
              {
                "required": [
                  "OCR"
                ],
                "not": {
                  "anyOf": [
                    {
                      "required": [
                        "sigmaC"
                      ]
                    },
                    {
                      "required": [
                        "POP"
                      ]
                    }
                  ]
                }
              },
              {
                "required": [
                  "POP"
                ],
                "not": {
                  "anyOf": [
                    {
                      "required": [
                        "sigmaC"
                      ]
                    },
                    {
                      "required": [
                        "OCR"
                      ]
                    }
                  ]
                }
              }
            ],
            "not": {
              "anyOf": [
                {
                  "required": [
                    "cv",
                    "kv"
                  ]
                },
                {
                  "required": [
                    "alphaS",
                    "rs"
                  ]
                }
              ]
            },
            "x-eik-closed": true
          }
        },
        {
          "if": {
            "properties": {
              "law": {
                "const": "incompressible"
              }
            },
            "required": [
              "law"
            ]
          },
          "then": {
            "properties": {
              "law": true
            },
            "x-eik-closed": true
          }
        }
      ]
    },
    "pit": {
      "type": "object",
      "description": "A pit the project digs: a basement, a lift pit or a sump (Part XIX, 6).",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "outline": {
          "$ref": "#/$defs/polygon",
          "description": "Its outline in plan (rule 1)."
        },
        "bottom": {
          "$ref": "#/$defs/height",
          "description": "Its bottom level, a height (rule 1)."
        }
      },
      "required": [
        "id",
        "outline",
        "bottom"
      ],
      "x-eik-closed": true
    },
    "load": {
      "type": "object",
      "description": "A load on the ground: it loads the soil, not the structure (Part XIX, 7).",
      "properties": {
        "id": {
          "$ref": "#/$defs/id"
        },
        "name": {
          "$ref": "#/$defs/name"
        },
        "use": {
          "enum": [
            "fill",
            "building",
            "goods"
          ],
          "description": "What lies there (rule 1)."
        },
        "region": {
          "$ref": "#/$defs/polygon",
          "description": "Where it lies, in plan (rule 2)."
        },
        "q": {
          "type": "number",
          "description": "Its pressure on the ground, kPa (rule 3).",
          "exclusiveMinimum": 0
        },
        "fill": {
          "type": "object",
          "description": "A fill's thickness, a length in mm, and unit weight, kN/m³ (rule 3).",
          "properties": {
            "thickness": {
              "type": "number",
              "description": "mm.",
              "exclusiveMinimum": 0
            },
            "gamma": {
              "type": "number",
              "description": "kN/m³.",
              "exclusiveMinimum": 0
            }
          },
          "required": [
            "thickness",
            "gamma"
          ],
          "x-eik-closed": true
        },
        "level": {
          "$ref": "#/$defs/height",
          "description": "The level it acts at, a height; the ground level where not given (rule 4)."
        },
        "nature": {
          "enum": [
            "permanent",
            "variable"
          ],
          "description": "Permanent or variable (rule 5)."
        },
        "category": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80,
          "description": "A variable load's category in the design code the project uses, a plain string (rule 5)."
        }
      },
      "required": [
        "id",
        "use",
        "region",
        "nature"
      ],
      "oneOf": [
        {
          "required": [
            "q"
          ],
          "not": {
            "required": [
              "fill"
            ]
          }
        },
        {
          "required": [
            "fill"
          ],
          "not": {
            "required": [
              "q"
            ]
          }
        }
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "nature": {
                "const": "permanent"
              }
            },
            "required": [
              "nature"
            ]
          },
          "then": {
            "not": {
              "required": [
                "category"
              ]
            }
          }
        }
      ],
      "x-eik-closed": true
    }
  }
}
