Below are the solutions to these exercises on “Simple Spatial Modeling – Part 3.” ############### # # # Exercise 1 # # # ############### ntimesteps <- 1000 ncell <- 25 timestep <- 1 t <- 0 k <- 0.01 ############### # # # Exercise 2 # # # ############### H <- matrix(data = 1,nrow=ncell,ncol=ncell) ############### […]

# Rhydrology

## Simple Spatial Modeling – Part 3: Exercises

So far, we have learned how to count spatial variability in our model. Please look at these two previous exercises here and here if you haven’t tried it yet. However, it only represents 1-Dimension models. In this exercise, we will try to expand our spatial consideration into a 2-Dimension model. Have a look at this […]

## Simple Spatial Modeling – Part 2: Solutions

Below are the solutions to these exercises on “Simple Spatial Modeling: Part 2.” ############### # # # Exercise 1 # # # ############### rm(list=ls()) t <- 0 ntimesteps <- 500 timestep <- 1 ncell <- 5 H <- mat.or.vec(ntimesteps+1,ncell) q <- mat.or.vec(1,ncell+1) # # ****** Here we define the flows q1 and q6 that remain […]

## Simple Spatial Modeling – Part 2: Exercises

In the first exercise of simple spatial modeling here, we learned to create a model that considers more spatial variability. However, it relies on an isolated system where we set the q1 and q6 as zero. In this exercise, we try to bring the model into a more realistic space by adding some boundary conditions, […]

## Simple Spatial Modeling – Part 1: Solutions

Below are the solutions to these exercises on “Simple Spatial Modeling – Part 1.” rainfall <- read.table(“C:/Users/Hanif Kusuma/Documents/R Blogging/spatial/rain.txt”) plot(x = (rainfall[,1]), y = rainfall[,2], xlab = “Time (sec)”, ylab = “Water level (cm)”, main = “Plot of simulated water level in tank”) ############### # # # Exercise 1 # # # ############### #define the […]

## Simple Spatial Modeling – Part 1: Exercises

This exercise is an extension of the last two previous exercises about numerical modeling. They can be found here and here. Those two previous exercises are representing how the model works in a lumped system. At this time, we will try to bring a space into our model. Make sure that you look at the […]

## Simple Numerical Modeling in R – Part 2: Solutions

Below are the solutions to these exercises on “Simple Numerical Modeling – Part 2.” ############### # # # Exercise 1 # # # ############### #previous work (ignore when you used the same script as previous exercise) datatable <- read.table(file.choose()) t<-0 k <- 0.05 S <- 15 timestep <- 1 ntimesteps <-100 output <- mat.or.vec(ntimesteps,2) for(n […]

## Simple Numerical Modeling in R – Part 2: Exercises

In this exercise, we will continue to build our model from our previous exercise here, specifically to revise the errors that may be generated from the model, including rounding and truncating errors. Answers to these exercises are available here. If you obtained a different (correct) answer than those listed on the solutions page, please feel […]

## Simple Numerical Modeling in R – Part 1: Solutions

Below are the solutions to these exercises on “Simple Numerical Modeling in R – Part 1.” ############### # # # Exercise 1 # # # ############### # Load Data datatable <- read.table(file.choose()) # Plot Data View(datatable) plot(datatable$V1,datatable$V2) ############### # # # Exercise 2 # # # ############### # dS/dt = kS # where S is […]

## Simple Numerical Modeling in R – Part 1: Exercises

The modeling process is just one of the methods to find a solution for a certain problem. It can be a combination between empirical simulation approaches. The empirical method is data-based analysis that relies upon mathematical function and often has no meaning in real life. An approach using simulation is more based on scientific understanding […]