TempAnalyticHarmonic: Analytic Temperature Field with Harmonic Variation

Description Usage Arguments Details Value Author(s) Examples

View source: R/temp_analytic_harmonic.R

Description

Provides a template for bbuilding nicely documented R functions

Usage

1
TempAnalyticHarmonic(Tmean, As, z, t, P, kappa)

Arguments

Tmean

Mean temperature [C] at the surface. Must be a scalar.

As

Amplitude [C] of surface temperature oscillation. Must be larger than zero and a scalar.

z

Depth [m] below the surface, positive downwards. Must be positive number, can be a vector or a scalar.

t

Time [s] after start of period for which output is desired. Can be a vector or a scalar

P

Period [s] of surface temperature oscillation. Must be larger than zero and a scalar.

kappa

Thermal difussivity [m2/s] of material.

Details

Feel free to leave out things that are not needed.

Value

Returns an array of temperatures [C] with one column for each z specified and one row for each t specified.

Author(s)

Stephan Gruber <stephan.gruber@carleton.ca>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#temperature for only one depth and time
temp <- TempAnalyticHarmonic(0, 10, 1, 3600000, 24*365*3600, 5e-07)

#temperature for three depths and one instant in time
temp <- TempAnalyticHarmonic(0, 10, c(1,2,3), 3600000, 24*365*3600, 5e-07)

#temperature for three depths and many time steps, plot 
time <- seq(from = 0, to = 24*365*3600, length.out = 200)
temp <- TempAnalyticHarmonic(0, 10, c(1,2,3), time, 24*365*3600, 5e-07)
plot( temp[,1], type="l")
lines(temp[,2], col=2)
lines(temp[,3], col=3)

geocryology/PermafrostTools documentation built on Dec. 20, 2021, 10:40 a.m.