[R-sig-dyn-mod] problem with advection.1D and ode.1D

Daniel Reed reeddc at umich.edu
Tue Jul 2 00:29:04 CEST 2013


Hi Dabing:

There's a typo in your return statement: it should be a lowercase C.

Cheers,
Daniel

_______________________________
Daniel C. Reed, PhD.
Postdoctoral Fellow,
Dept. of Earth & Environmental Sciences,
University of Michigan,
Ann Arbor, MI, USA.
email: reeddc at umich.edu
web: www.danielreed.org

On Jul 1, 2013, at 4:30 PM, Dabing Chen <dabing.c at gmail.com> wrote:

> Hello All:
>       I constantly ran into message like this:
> 
>> systime <- system.time(out <- ode.1D(func = advModel, y=state,times
> =times,parms = 0,nspec=1))
> Error in levels(x) : argument "object" is missing, with no default
> Timing stopped at: 0 0 0
> 
>      I am wondering what went wrong.
>      Thanks a lot in advance.
> 
> Dabing Chen
> 
> 
> rm(list=ls())
> library (deSolve)
> library(ReacTran)
> 
> 
> advModel <- function(t, C, parms) {
> 
>     with (as.list(parms), {
>         stomach <- state[1]
>         intestine <- state[2:101]
>          emptying <- 0.05+0.2*(tanh(t%%120-60)-tanh(t%%120-70))
> 
>         if(stomach <=0) gastric = 0 else gastric = emptying*stomach
>         dstomach <- -gastric
>         Tran <- advection.1D(C = intestine, flux.up = gastric, v = 1,
> dx=1,adv.method="super")
> 
>       dintestine <- Tran$dC
> 
>         return (list(C(dstomach = dstomach,dintestine=dintestine)))
>       })
> }
> 
> times <- seq(1,1000,by =1)
> 
> state <- c(100,rep(0,100))
> 
> systime <- system.time(out <- ode.1D(func = advModel, y=state,times
> =times,parms = 0,nspec=1))
> 
> #plot (out, xlab = "x", ylab = "Conc", main = "advection")
> #image(out)
> write.csv(out,file="C:/BI-Chen/Research/R script/learning/plug.csv")
> 
> 
> systime
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models



More information about the R-sig-dynamic-models mailing list