{"id":19270669,"url":"https://github.com/emanuelhuber/cbrdm","last_synced_at":"2025-04-21T20:33:50.215Z","repository":{"id":97063632,"uuid":"75111323","full_name":"emanuelhuber/CBRDM","owner":"emanuelhuber","description":"3D object-based model of braided river deposits (marked point process), an open-source software package (R language)","archived":false,"fork":false,"pushed_at":"2020-02-24T21:00:40.000Z","size":3755,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T16:07:52.512Z","etag":null,"topics":["3d-model","braided-river","heterogneity","marked-point-process","modeling","object-based-model","point-process","subsurface"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emanuelhuber.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-11-29T18:46:36.000Z","updated_at":"2020-02-24T21:00:42.000Z","dependencies_parsed_at":"2023-03-13T16:19:47.457Z","dependency_job_id":null,"html_url":"https://github.com/emanuelhuber/CBRDM","commit_stats":{"total_commits":124,"total_committers":2,"mean_commits":62.0,"dds":0.008064516129032251,"last_synced_commit":"e8d519a59dd67785ad9e1133fc704afb1b5a6755"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelhuber%2FCBRDM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelhuber%2FCBRDM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelhuber%2FCBRDM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelhuber%2FCBRDM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emanuelhuber","download_url":"https://codeload.github.com/emanuelhuber/CBRDM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250128514,"owners_count":21379529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-model","braided-river","heterogneity","marked-point-process","modeling","object-based-model","point-process","subsurface"],"created_at":"2024-11-09T20:26:24.904Z","updated_at":"2025-04-21T20:33:49.696Z","avatar_url":"https://github.com/emanuelhuber.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: CBRDM - Coarse Braided River Deposit Model\nauthor: \"Emanuel Huber\"\ndate: \"2018-03-06\"\noutput:\n  html_document:\n    keep_md: true\n---\n\n\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n\n\n\nThere is a critical need in hydrogeological modeling for geologically more realistic representation of the subsurface. Indeed, widely-used representations of the subsurface heterogeneity based on smooth basis functions such as cokriging or the pilot-point approach fail at reproducing the connectivity of high permeable geological structures that control subsurface solute transport. To realistically model the connectivity of high permeable structures of coarse, braided river deposits, multiple-point statistics and object-based models are promising alternatives. We therefore propose a new object-based model that, according to a sedimentological model, mimics the dominant processes of floodplain dynamics. Contrarily to existing models, this object-based model possesses the following properties: (1) it is consistent with field observations (outcrops, ground-penetrating radar data, etc.), (2) it allows different sedimentological dynamics to be modeled that result in different subsurface heterogeneity patterns, (3) it is light in memory and computationally fast, and (4) it can be conditioned to geophysical data. In this model, the main sedimentological elements (scour fills with open-framework–bimodal gravel cross-beds, gravel sheet deposits, open-framework and sand lenses) and their internal structures are described by geometrical objects. Several spatial distributions are proposed that allow to simulate the horizontal position of the objects on the floodplain as well as the net rate of sediment deposition. The model is grid-independent and any vertical section can be computed algebraically. Furthermore, model realizations can serve as training images for multiple-point statistics.\n\nSee also: [PDF presentation: A 3D object-based model to simulate highly-heterogeneous,\ncoarse, braided river deposits](https://emanuelhuber.github.io/publications/2016_huber-et-al_AGU_3D-object-based-model-braided-deposits.pdf)\n\n\n![CBRDM: vertical sections](06_highAg_section_light.png)\n\n## How to cite\n\nHuber E., Huggenberger P., Caers J. (2016) Presentation: A 3D object-based model to simulate highly-heterogeneous, coarse, braided river deposits. AGU 2016 Fall Meeting, San Francisco, California, USA, 12–16 December 2016. DOI: [10.13140/RG.2.2.29333.32489](http://dx.doi.org/10.13140/RG.2.2.29333.32489)\n\n\n## How to install/load\n\n```{r install, message=FALSE, results='hold'}\nif(!require(\"devtools\")) install.packages(\"devtools\")\ndevtools::install_github(\"emanuelhuber/CBRDM\")\nlibrary(CBRDM)\n```\n\n## Notes\nThis is an ongoing project. If you have any questions, don't hesitate to contact me:\n\nemanuel.huber@alumni.ethz.ch\n\nThank you!\n\n## Related publications\n\n- E. Huber, P. Huggenberger (2016) Subsurface flow mixing in coarse, braided river deposits. Hydrology and Earth System Sciences, 20:2035–2046. DOI: [10.5194/hess-20-2035-2016](http://dx.doi.org/10.5194/hess-20-2035-2016)\u003cbr/\u003e\n[PDF file](https://emanuelhuber.github.io/publications/2016_huber-and-huggenberger_subsurface-flow-mixing.pdf)\n\n- Huber E. and Huggenberger P. (2015) Morphological perspective on the sedimentary characteristics of a coarse, braided reach: Tagliamento River (NE Italy) . Geomorphology, 248: 111–124. DOI: [10.1016/j.geomorph.2015.07.015](http://dx.doi.org/10.1016/j.geomorph.2015.07.015)\u003cbr/\u003e\n[PDF file](https://emanuelhuber.github.io/publications/2015_huber-and-huggenberger_morphological-perspective-sedimentology.pdf)\n\n- Huggenberger, P., Regli, C., 2006. A sedimentological model to characterize braided river deposits for hydrogeological applications. In: Sambrook Smith, G.H., Best, J.L., Bristow, C.S., Petts, G.E. (Eds.), Braided Rivers: Process, Deposits, Ecology and Management. Blackwell Publishing Ltd, Oxford, UK, pp. 51–74. DOI: [10.1002/9781444304374.ch3](http://dx.doi.org/10.1002/9781444304374.ch3).\n\n- Beres, M., Huggenberger, P., Green, A.G., Horstmeyer, H., 1999. Using two- and three-dimensional georadar methods to characterize glaciofluvial architecture. Sediment. Geol. 129 (1–2), 1–24. DOI: [10.1016/S0037-0738(99)00053-6](http://dx.doi.org/10.1016/S0037-0738(99)00053-6).\n\n- Siegenthaler, C., Huggenberger, P., 1993. Pleistocene Rhine gravel: deposits of a braided river system with dominant pool preservation. Geol. Soc. Lond., Spec. Publ. 75, 147–162. DOI: [10.1144/GSL.SP.1993.075.01.09](http://dx.doi.org/10.1144/GSL.SP.1993.075.01.09).\n\n\n\n## Short tutorial\n### Trough fill simulation\nThis model simulates trough fills with cross-bedding and horizontal layers. The trough fills are approximated by a series of truncated ellipsoids.\nWe create an instance of the class `Trough` using the constructor function `trough()`. The objects properties and positions are drawn from random distribution:\n\n\n```{r TF}\n# Trough Fills\nTF \u003c- trough(pos   = matrix(runif(9, 10,90), nrow=3, ncol=3),\n             size  = cbind(rnorm(3, 40, 5), rnorm(3, 20,2), \n                          rnorm(3, 2, 0.5)),\n             theta = runif(3,0,3.14),\n             rH    = rep(6, 3))\n```\n\nTo visualise this trough fills, use the function `plotTopView()`:\n\n```{r TF_plot1}\nplotTopView(TF, border = \"blue\", col = \"grey\", asp = 1)\n```\n\nTo plot one specific trough fill:\n```{r TF_plot2}\nplotTopView(TF, border = \"blue\", col = \"grey\", asp = 1)\nplotTopView(TF[2], border = \"blue\", col = \"green\", asp = 1, add = TRUE)\n```\n\nAdd cross-bedding:\n\n```{r TF_xb}\npara \u003c- list(nF   = 10,      # nF cross-beds\n             rpos = 0.75,    # 0 \u003c= rpos \u003c=1\n             phi  = 2.2)     # orientation angle\nTF \u003c- crossBedding(TF, para)\nplotTopView(TF, border = \"blue\", col = \"grey\", asp = 1)\n```\n\nDifferent cross-bedding for each trough fills:\n```{r TF_xb_plot}\npara \u003c- list(nF   = c(10, 3, 30),      # nF cross-beds\n             rpos = c(0, 0.75, 1),     # 0 \u003c= rpos \u003c=1\n             phi  = c(0, -1, 2.2))     # orientation angle\nTF \u003c- crossBedding(TF, para)\nplotTopView(TF, border = \"blue\", col = \"grey\", asp = 1)\n```\n\n### Braided river deposit simulation\nThe object properties (`L` = length, `rLW`= length-width ratio, `rLH` = length-height ratio, `theta` = orientation angle, `rH` = truncation ratio ) are defined by probability distributions (here the uniform probability distribution). \n\nThe vertical position of the layers is defined by a Poisson process with parameter `ag` (the rate of sediment deposition = mean thickness of sediment deposited per event).\n\nThe horizontal distribution of trough fills on each layers is defined by a Strauss process with parameters `bet` (beta), `gam` (gamma) and `d` interaction distance (the function `rStrauss` in the `spatstat` R-package). Warning: a bad parameter choice may lead to extremely long computations.\n\nThe cross-bedding parameters are also defined according probability distribution. Note that here `nF` defines the cross-bed thickness (I will change that next time).\n\n\n```{r para}\npara \u003c- list(\"L\"      = list(type = \"runif\", min = 40, max = 70),\n             \"rLW\"    = list(type = \"runif\", min = 3, max = 4),\n             \"rLH\"    = list(type = \"runif\", min = 45, max = 66),\n             \"theta\"  = list(type = \"runif\", min = -20 * pi / 180, \n                                            max = 20 * pi / 180),\n             \"rH\"     = 2,\n             \"vpp\"    = list(type = \"poisson\",\n                             lambda = 0.05),\n             \"hpp\"    = list(type = \"strauss\",\n                             bet = 1e-2,\n                             gam = 0.2,\n                             d = 100,\n                             fd = c(5, 1),\n                             nit = 5000, n0 = 3),\n             \"nF\"     = list(type = \"rint\", min = 2, max = 5),\n             \"rpos\"   = list(type = \"runif\", min = 0.65, max = 1), \n             \"phi\"    = list(type = \"runif\", min = -1.5, max = 1.5)\n             )\n```\n\nNow we define the simulation box:\n```{r modbox}\nmodbox \u003c- list(\"x\" = c(0,200),\n               \"y\" = c(0,100),\n               \"z\" = c(0,10)\n             )\n```\n\nAnd run the simulation:\n```{r sim}\nmod \u003c- sim(modbox, hmodel = \"strauss\", para)  # takes some times...\n```\n\nTop view (the layers are \"transparent\") and show the vertical section lines:\n```{r sim_topview}\nplotTopView(mod, border = \"red\", col = \"grey\", asp = 1)\nlv \u003c- c(1, 0,  -50)\nlh \u003c- c(0, 1,  -50)\nl  \u003c- c(1, 2, -250)\nRConics::addLine(lv, col = \"blue\",  lwd = 3)\nRConics::addLine(lh, col = \"black\", lwd = 4)\nRConics::addLine(l,  col = \"green\", lwd = 4)\n```\n\n#### Vertical sections\n\n* Vertical section along the line `lv`:\n\n    ```{r vsec}\n    smod \u003c- section(mod, lv)\n    plotSection(smod, border = \"red\", col = \"grey\", asp = 2, ylim = c(0, 10),\n                xlim = c(0,100), ylab = \"z (m)\", xlab = \"x (m)\")\n    title(\"Vertical section along 'lv' (blue line)\")\n    ```\n\n* Vertical section along the line `lh`:\n\n    ```{r vsec_lh}\n    smod \u003c- section(mod, lh)\n    plotSection(smod, border = \"red\", col = \"grey\", asp = 2, ylim = c(0, 10),\n                xlim = c(-50, 150), ylab = \"z (m)\", xlab = \"y (m)\")\n    title(\"Vertical section along 'lh' (black line)\")\n    ```\n\n* Vertical section along the line `l`:\n\n    ```{r vsec_l}\n    smod \u003c- section(mod, l)\n    plotSection(smod, border = \"red\", col = \"grey\", asp = 2, ylim = c(0, 10),\n                xlim = c(-20, 170), ylab = \"z (m)\", xlab = \"x' (m)\")\n    title(\"Vertical section along 'l' (green line)\")\n    ```\n\n#### Discretisation/pixelisation 3D\n\n1. Define the pixelisation box (`x`, `y`, `z`) as well as the pixel resolution \n(`dx`, `dy`, `dz`).\n\n    ```{r mbox}\n    mbox \u003c- list(x = modbox$x, y = modbox$y, z = modbox$z, \n                dx = 1, \n                dy = 1, \n                dz = 0.1)\n    ```\n\n2. Pixelise\n\n    ```{r pix}\n    PIX \u003c- pixelise(mod, mbox)\n    ```\n    \n    The function `pixelise()` maps the object on the grid and attributes unique\n    identifier (integer) to the pixels belonging to the same object. The layers \n    have negative values while the throughs have positive values.\n    \n    ```{r plot3D, results='hold'}\n    library(plot3D)\n    # horizontal section\n    plot3D::image2D(PIX$XYZ[,, 50], x = PIX$x, y = PIX$y, asp = 1)\n    \n    # vertical section at x = 50.5\n    plot3D::image2D(PIX$XYZ[which(PIX$x == 50.5),,], x = PIX$y, y = PIX$z,\n                    asp = 2)\n    ```\n    \n#### Set hydraulic properties and plot section (pixels)\n\n1. Set the facies identifier to the pixels:\n    - 0 = layers\n    - 1 = bimodal gravel (trough)\n    - 2 = open-framework gravel\n    \n    ```{r FAC, results='hold'}\n    FAC \u003c- setProp(PIX$XYZ, type = c(\"facies\"))\n    \n    # horizontal section\n    plot3D::image2D(FAC[,, 50], x = PIX$x, y = PIX$y, asp = 1)\n    \n    # vertical section at x = 50.5\n    plot3D::image2D(FAC[which(PIX$x == 50.5),,], x = PIX$y, y = PIX$z, \n                    asp = 2)\n    ```\n    \n    The hydraulic properties of the facies are given by the data `faciesProp`:\n    ```{r faciesprop}\n    data(faciesProp)\n    faciesProp # the facies hydraulic properties\n    ```\n    \n2. set hydraulic conductivity    \n    \n    ```{r HK, results='hold'}\n    HK \u003c- setProp(PIX$XYZ, type = c(\"K\"), fprop = faciesProp)\n    \n    # horizontal section\n    plot3D::image2D(HK[,, 50], x = PIX$x, y = PIX$y, asp = 1)\n    \n    # vertical section at x = 50.5\n    plot3D::image2D(HK[which(PIX$x == 50.5),,], x = PIX$y, y = PIX$z,\n                    asp = 2)\n    ```\n\n3. vertical anisotropy of the hydraulic conductivity\n\n    ```{r VANI, results='hold'}\n    VANI \u003c- setProp(PIX$XYZ, type = c(\"Kvani\"), fprop = faciesProp)\n    \n    # horizontal section\n    plot3D::image2D(VANI[,, 50], x = PIX$x, y = PIX$y, asp = 1)\n    \n    # vertical section at x = 50.5\n    plot3D::image2D(VANI[which(PIX$x == 50.5),,], x = PIX$y, y = PIX$z, \n                    asp = 2)\n    ```\n    \n4.  porosity\n    ```{r PORO, results='hold'}\n    PORO \u003c- setProp(PIX$XYZ, type = c(\"p\"), fprop = faciesProp)\n    \n    # horizontal section\n    plot3D::image2D(PORO[,, 50], x = PIX$x, y = PIX$y, asp = 1)\n    \n    # vertical section at x = 50.5\n    plot3D::image2D(PORO[which(PIX$x == 50.5),,], x = PIX$y, y = PIX$z, \n                    asp = 2)\n    ```\n\n\n#### Plot a cube of hydraulic conductivity:\n\n```{r HK_cube, results='hold'}\nrnxyz \u003c- dim(PIX$XYZ)\nnx \u003c- rnxyz[1]\nny \u003c- rnxyz[2]\nnz \u003c- rnxyz[3]\n\n# x-side: x x z (200 x 100) at y = 0\n\nvx \u003c- (PIX$x)\nvy \u003c- rep(0, nz)\nvz \u003c- matrix(rep(PIX$z, each = nx), ncol = nz, \n             nrow = nx, byrow = FALSE)\nM1 \u003c- plot3D::mesh(vx, vy)\n\nplot3D::surf3D(M1$x, M1$y, vz, colvar = (HK[,1,]), \n              col = plot3D::jet2.col(201),\n              bty = \"f\", cex = 0.01, pch = 20,  clim = range(HK),\n              clab = \"hydraulic conductivity (m/s)\", ticktype = \"detailed\",\n              theta = 40 , expand = 5, scale = FALSE, resfac = 0, clog = TRUE,\n              xlim = modbox$x, ylim = modbox$y, \n              zlim = modbox$z, #extent3D(gwMod)[5:6],\n              xlab = \"x\", ylab = \"y\", shade = TRUE, ltheta = -125, lphi = 45,\n              colkey = list(plot = TRUE, width = 0.5, length = 0.5,\n              cex.axis = 0.8, side = 1),\n              col.axis = \"black\", col.panel = \"white\", col.grid = \"grey\",\n              lwd.panel = 1, lwd.grid = 2, box = TRUE)\n\n\n# y-side: y x z (100 x 100) at x = \nvx \u003c- rep(max(PIX$x), ny)\nvy \u003c- PIX$y\nvz \u003c- matrix(rep(PIX$z, ny), ncol = nz, \n             nrow = ny, byrow = TRUE)\nM1 \u003c- plot3D::mesh(vy, vx)\n\nplot3D::surf3D(M1$y, M1$x, vz, colvar = HK[nx,,], \n               col = plot3D::jet2.col(201), add = TRUE, expand = 5, scale = FALSE, \n                     resfac = 0, clog = TRUE,  clim = range(HK),\n              colkey = list(plot = FALSE))\n      \n\n# z-side: x x y (200 x 100) at z = 10\nvx \u003c- rev(PIX$x)\nvy \u003c- PIX$y\nvz \u003c- matrix(rep(rep(max(PIX$z), nz), each = ny), \n              ncol = ny, nrow = nx, byrow = TRUE)\nM1 \u003c- plot3D::mesh(vx, vy)\n\nplot3D::surf3D(M1$x, M1$y, vz, colvar = (HK[,,nz]), \n        col = plot3D::jet2.col(201), add = TRUE, expand = 5, scale = FALSE, \n        resfac = 0, clog = TRUE,  clim = range(HK), \n        colkey = list(plot = FALSE))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelhuber%2Fcbrdm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femanuelhuber%2Fcbrdm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelhuber%2Fcbrdm/lists"}