Skip to content
GitLab
    • Explore Projects Groups Topics Snippets
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • R Rsic2
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

La forge institutionnelle d'INRAE étant en production depuis le 10 juin 2025, nous vous invitons à y créer vos nouveaux projets.

  • SIC2SIC2
  • Rsic2
  • Merge requests
  • !9
An error occurred while fetching the assigned milestone of the selected merge_request.

Resolve "Importation of stage-discharge law at downstream boundary condition"

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Dorchies David requested to merge 12-importation-of-stage-discharge-law-at-downstream-boundary-condition into main 3 years ago
  • Overview 0
  • Commits 2
  • Pipelines 3
  • Changes 3

Closes #12 (closed)

Edited 3 years ago by Dorchies David
Compare
  • version 1
    70a33af0
    3 years ago

  • main (base)

and
  • latest version
    b68350b3
    2 commits, 3 years ago

  • version 1
    70a33af0
    1 commit, 3 years ago

3 files
+ 66
− 0

    Preferences

    File browser
    Compare changes
R/set_boundary_ZQ.R 0 → 100644
+ 31
− 0
  • View file @ b68350b3

  • Edit in single-file editor

  • Open in Web IDE

#' Set stage-discharge curve at an offtake of the model
#'
#' @description
#' Update the existing stage-discharge boundary condition.
#'
#' @inheritParams sic_run_mesh
#' @param nd [numeric], node number in SIC model
#' @param pr [numeric], offtake number in the node
#' @param mZQ [matrix], stage-discharge relation with first column the water elevation in meters
#' and the second column the discharge in cubic meters per seconds
#'
#' @return This function is only used for side effect on the XML file of the SIC project.
#' @export
#'
#' @examples
#' \dontrun{
#' cfg <- cfg_tmp_project()
#' z <- seq(5, 20, 1)
#' Q <- (z-5)^1.5
#' set_boundary_ZQ(cfg, scenario = 1, nd = 3, mZQ = matrix(c(z, Q), ncol = 2))
#' }
set_boundary_ZQ <- function(cfg, scenario, nd, pr = 1, mZQ) {
x <- read_xml(cfg$project$path)
xPath <- "/Reseau/Liste_Noeuds/Noeud[@Num=%d]/Flu[@nScenario=%d]/Prise[@Num=%d]/ConditionLim/TLoi"
xPath <- sprintf(xPath, nd, scenario, pr)
sZQ <- capture.output(write.table(t(mZQ), sep = "\t", quote = FALSE, col.names = FALSE, row.names = FALSE))
sZQ <- paste(sZQ, collapse = "\n")
xLoi <- x %>% xml_find_first(xPath)
xml_text(xLoi) <- sZQ
write_xml(x, cfg$project$path)
}
man/set_boundary_ZQ.Rd 0 → 100644
+ 34
− 0
  • View file @ b68350b3

  • Edit in single-file editor

  • Open in Web IDE

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/set_boundary_ZQ.R
\name{set_boundary_ZQ}
\alias{set_boundary_ZQ}
\title{Set stage-discharge curve at an offtake of the model}
\usage{
set_boundary_ZQ(cfg, scenario, nd, pr = 1, mZQ)
}
\arguments{
\item{cfg}{a \link{config} object. Configuration to use. See \link{loadConfig} for details}
\item{scenario}{\link{numeric}, the scenario to use}
\item{nd}{\link{numeric}, node number in SIC model}
\item{pr}{\link{numeric}, offtake number in the node}
\item{mZQ}{\link{matrix}, stage-discharge relation with first column the water elevation in meters
and the second column the discharge in cubic meters per seconds}
}
\value{
This function is only used for side effect on the XML file of the SIC project.
}
\description{
Update the existing stage-discharge boundary condition.
}
\examples{
\dontrun{
cfg <- cfg_tmp_project()
z <- seq(5, 20, 1)
Q <- (z-5)^1.5
set_boundary_ZQ(cfg, scenario = 1, nd = 3, mZQ = matrix(c(z, Q), ncol = 2))
}
}
NAMESPACE
+ 1
− 0
  • View file @ b68350b3

  • Edit in single-file editor

  • Open in Web IDE


@@ -21,6 +21,7 @@ export(get_section_centers)
export(loadConfig)
export(merge_reaches)
export(read_bin_result_matrix)
export(set_boundary_ZQ)
export(set_initial_conditions)
export(sic_import_reaches)
export(sic_run_export)
Assignee
Dorchies David's avatar
Dorchies David
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 Participants
Reference:
Source branch: 12-importation-of-stage-discharge-law-at-downstream-boundary-condition

Menu

Explore Projects Groups Topics Snippets