Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/cran/ReacTran
06 February 2020, 06:27:10 UTC
  • Code
  • Branches (31)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    • refs/tags/1.1
    • refs/tags/1.2
    • refs/tags/1.3
    • refs/tags/1.3.1
    • refs/tags/1.3.2
    • refs/tags/1.4.1
    • refs/tags/1.4.2
    • refs/tags/1.4.3.1
    • refs/tags/R-2.10.0
    • refs/tags/R-2.10.1
    • refs/tags/R-2.11.0
    • refs/tags/R-2.11.1
    • refs/tags/R-2.12.0
    • refs/tags/R-2.12.1
    • refs/tags/R-2.12.2
    • refs/tags/R-2.13.0
    • refs/tags/R-2.13.1
    • refs/tags/R-2.13.2
    • refs/tags/R-2.14.0
    • refs/tags/R-2.14.1
    • refs/tags/R-2.14.2
    • refs/tags/R-2.15.0
    • refs/tags/R-2.15.1
    • refs/tags/R-2.15.2
    • refs/tags/R-2.15.3
    • refs/tags/R-2.9.2
    • refs/tags/R-3.0.0
    • refs/tags/R-3.0.1
    • refs/tags/R-3.0.2
    • refs/tags/R-3.0.3
    No releases to show
  • aeab7a2
  • /
  • R
  • /
  • tran.polar.R
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:dd30157ee204c10e616c8bf6b4747e0e3ee72457
origin badgedirectory badge Iframe embedding
swh:1:dir:809b8b8ba6376b1f9a293a09ccc47a6c531543b9
origin badgerevision badge
swh:1:rev:72984f188f682cc270e18126009c8e56b7aab80d
origin badgesnapshot badge
swh:1:snp:bbc0b94b1c0463480b615c86f1ae2df3fcc700c0
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 72984f188f682cc270e18126009c8e56b7aab80d authored by Karline Soetaert on 10 August 2011, 00:00:00 UTC
version 1.3.2
Tip revision: 72984f1
tran.polar.R

##==============================================================================
## Diffusive transport in polar coordinates (r, theta)
##==============================================================================

tran.polar <- function(C, C.r.up=NULL,    C.r.down=NULL, 
                        C.theta.up=NULL,  C.theta.down=NULL, 
                        
                        flux.r.up=NULL,   flux.r.down=NULL, 
                        flux.theta.up=NULL, flux.theta.down=NULL, 
                        
                        cyclicBnd = NULL,
                                                
                        D.r=1, D.theta=D.r,

                        r=NULL, theta=NULL,
                        
                        full.output = FALSE )
											
{
# ------------------------------------------------------------------------------
# Initialisation
# ------------------------------------------------------------------------------

# a function to check the dimensionality of the system
  checkDim <- function (dr, dtheta, nx="dr", ntheta="dtheta") {
    if (length(dr) != 1 )
      stop (nx,", should have length 1")
    if (length(dtheta) != 1)
       stop (ntheta,", should have length 1")
  }

  checkDim2 <- function (dr,dtheta,nx="dr",ntheta="dtheta") {
    if (length(dr) != dimC[1]+1)
      stop (nx,", should have length equal to dim(C)[1]+1 = ",dimC[1]+1," it is ",length(dr))
 
    if (length(dtheta) != dimC[2]+1)
       stop (ntheta,", should have length equal to dim(C)[2]+1 = ",dimC[2]+1," it is ",length(dtheta))
  }

  dimC <- dim (C) 
  Type <- 2
  
  if (max(theta)> 2*pi)
     stop ("theta should be < 2pi")
  if (min(theta)< 0)
     stop ("theta should be > 0 ")
  
  checkDim2(r, theta,"r, the grid in x-direction",
                   "theta, the grid in theta-direction") 
  # central values
  Nr       <- dimC[1]
  r.c      <- 0.5*(r[-1]+r[-(Nr+1)])
  dr       <- diff(r)
  drint    <- c(r.c[1]-r[1],diff(r.c),r[Nr+1]-r.c[Nr])
  divr     <- 1/r
  divr[is.na(divr)] <- 0
  
  Ntheta     <- dimC[2]
  theta.c    <- 0.5*(theta[-1]+theta[-(Ntheta +1)])
  dtheta     <- diff(theta)
  dthetaint  <- c(theta.c[1]-theta[1],diff(theta.c),theta[Ntheta+1]-theta.c[Ntheta])

  checkDim (D.r,D.theta,"D.r, the diffusion in x-direction ",
                      "D.theta, the diffusion in theta-direction ")
  
# check the dimensionality of the boundaries  
    if (! is.null(cyclicBnd)) {
# check if other boundaries not prescribed in this direction
    }
    if (! is.null(C.r.up)){ 
     if( length(C.r.up) != 1 && length(C.r.up) != Ntheta)
       stop ("'C.r.up' should have length 1 or equal to ", Ntheta)
    } else if (! is.null(flux.r.up)) { 
     if( length(flux.r.up) != 1 && length(flux.r.up) != Ntheta)
      stop ("'flux.r.up' should have length 1 or equal to ", Ntheta)
    } else if (!1 %in% cyclicBnd) 
      C.r.up = C[1,]

    if (! is.null(C.r.down)) {
     if( length(C.r.down) != 1 && length(C.r.down) != Ntheta)
      stop ("'C.r.down' should have length 1 or equal to ", Ntheta)
    } else if (! is.null(flux.r.down)){
     if(length(flux.r.down) != 1 && length(flux.r.down) != Ntheta)
      stop ("'flux.r.down' should have length 1 or equal to ", Ntheta)
    } else if (!1 %in% cyclicBnd)
      C.r.down = C[Nr,]

    if (! is.null(C.theta.up)) {
     if ( length(C.theta.up) != 1 && length(C.theta.up) != Nr)
      stop ("'C.theta.up' should have length 1 or equal to ", Nr)
    } else if (! is.null(flux.theta.up)){
     if (length(flux.theta.up) != 1 && length(flux.theta.up) != Nr)
       stop ("'flux.theta.up' should have length 1 or equal to ", Nr)
    } else if (!2 %in% cyclicBnd) 
      stop ("'flux.theta.up' OR 'C.theta.up' should be specified")

    if (! is.null(C.theta.down)) { 
     if(length(C.theta.down) != 1 && length(C.theta.down) != Nr)
      stop ("'C.theta.down' should have length 1 or equal to ", Nr)
    } else if (! is.null(flux.theta.down)) {
      if( length(flux.theta.down) != 1 && length(flux.theta.down) != Nr)
       stop ("'flux.theta.down' should have length 1 or equal to ", Nr)
    } else if (!2 %in% cyclicBnd) 
      stop ("'flux.theta.down' OR 'C.theta.down' should be specified")


# ------------------------------------------------------------------------------
# Function body: calculation
# ------------------------------------------------------------------------------

## Initialise 'fluxes' in all directions
  Flux.r <- 0
  Flux.theta <- 0

## First rewrite boundary values as "concentration"
## then perform diffusive transport
   if (1 %in% cyclicBnd) {
     C.r.up   <- (C[1,]*drint[Nr+1] + C[Nr,]*drint[1]) /(drint[1]+drint[Nr+1])
     C.r.down <- C.r.up
   }
   if (is.null(C.r.up))
     C.r.up <-  flux.r.up / D.r * drint[1]+ C[1,]
   if (is.null(C.r.down))
     C.r.down <- - flux.r.down / D.r * drint[Nr+1] + C[Nr,]
  
   Flux.r <- D.r * (rbind(C.r.up,C, deparse.level = 0) -
                    rbind(C,C.r.down, deparse.level = 0))/drint  

   if (2 %in% cyclicBnd) {
     C.theta.up   <- (C[,1]*dthetaint[Ntheta+1] + C[,Ntheta]*dthetaint[1]) /
        (dthetaint[1]+dthetaint[Ntheta+1])
     C.theta.down <- C.theta.up
   }
   if (is.null(C.theta.up))
     C.theta.up <- flux.theta.up/D.theta * dthetaint[1]*r.c + C[,1]
   if (is.null(C.theta.down))
     C.theta.down <- - flux.theta.down /D.theta * dthetaint[Ntheta+1]*r.c + C[,Ntheta]

   
   Flux.theta <- D.theta * (cbind(C.theta.up,C,deparse.level = 0) - 
                        cbind(C,C.theta.down, deparse.level = 0))/
                matrix(data= dthetaint,nrow=Nr,ncol=(Ntheta+1),byrow=TRUE) /r.c

## Calculate rate of change = flux gradient 

  dFdtheta <- 0.
  dFdr   <- -diff(Flux.r * r)/dr/r.c
  dFdtheta <- -t(diff(t(Flux.theta))/dtheta)/r.c

 if (full.output)
  return (list (dC = dFdr + dFdtheta ,                  # Rate of change
                C.r.up     = C.r.up,
                C.r.down   = C.r.down,
                C.theta.up   = C.theta.up,
                C.theta.down = C.theta.down,
                r.flux   = Flux.r,                 
                theta.flux = Flux.theta,
                flux.r.up = Flux.r[1,],
                flux.r.down = Flux.r[Nr+1,],
                flux.theta.up = Flux.theta[,1],
                flux.theta.down = Flux.theta[,Ntheta+1]
                
                ))  
 else
  return (list (dC = dFdr + dFdtheta ,                 
                flux.r.up = Flux.r[1,],
                flux.r.down = Flux.r[Nr+1,],
                flux.theta.up = Flux.theta[,1],
                flux.theta.down = Flux.theta[,Ntheta+1]
                ))  
 
} # end tran.polar

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top