introduction to environment system modeling

31
Introduction to Environment System Modeling 3 rd weekModeling with differential equationDepartment of Environment Systems, Graduate School of Frontier Sciences, the University of Tokyo Masaatsu AICHI

Upload: others

Post on 16-Oct-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to Environment System Modeling

Introduction to Environment System Modeling

(3rd week:Modeling with differential equation)

Department of Environment Systems,Graduate School of Frontier Sciences,

the University of TokyoMasaatsu AICHI

Page 2: Introduction to Environment System Modeling

Contents

• Conservation law– Flux/Storage/Source and Sink

• Balance• Typical processes in environment modeling

– Attenuation– Diffusion/Dispersion– Advection

• Material derivative

Page 3: Introduction to Environment System Modeling

Conservation law

• Typical conservation laws– Mass conservation– Momentum conservation– Energy conservation– Charge conservation etc…

• Conservation law means the balance of flux, storage, source, and sink.+ + , , − , ,+ , + , − , ,+ , , + − , , += 0– Dividing by and taking the infinitesimal limit,

+ + + + = + ∙ ⃗ + = 0

x

y

z

dxdy

dz

Page 4: Introduction to Environment System Modeling

Balance equation

+ ∙ ⃗ + = 0Change in storage Flux divergence Source/Sink

( > 0 denotes sink)

• This is a common form though the detailed laws for each term are different

• The characteristics of equation changes with the concrete formulae for storage, divergence, source, and sink terms.

Page 5: Introduction to Environment System Modeling

Radial symmetry in a plane+ − = 2 − 2 + +

∴ = − − = − 1+Dividing by 2 and taking a limit,

Polar coordinate43 + − = 4 − 4 + +

∴ = −2 − = − 1Dividing by 4 and taking a limit,

Page 6: Introduction to Environment System Modeling

Typical storage terms• Stored material in a solution

– Concentration: =• Stored thermal energy in a material

– Product of specific heat・density・temperature: =• Stored charge in a condenser

– Product of electric capacity and voltage: =• Stored fluid mass of law compressibility by pressure change

– Pressure divided by bulk modulus: =• Stored fluid mass due to the elastic deformation caused by the

fluid pressure change– Product of storage coefficient and pressure : =

→Typically the storage term is proportional to some potential.→There are nonlinear models for advanced problems

Page 7: Introduction to Environment System Modeling

Typical source/sink terms

• Artificial addition or removal– =

• Disappearance with a constant probability(e.g., radioactive decay)– Proportional to the amount: =

• Production with a constant probability(e.g., population increase)– Proportional to the amount: = −

• Production or loss through chemical reactions

Page 8: Introduction to Environment System Modeling

Growth and attenuation

• growth: =– Initial condition: 0 =– The solution is =

• attenuation: = −– Initial condition: 0 =– The solution is =

→Exponential increase or decrease→Linear in semi-logarithmic chart

Page 9: Introduction to Environment System Modeling

Typical diffusion flux• Fick’s first law

– Diffusion flux is proportional to the concentration gradient:⃗ = −• Fourier’s law

– Thermal conduction is proportional to the temperature gradient: ⃗ = −

• Ohm’s law– Electric current is proportional to the electric potential gradient: ⃗= −

• Darcy’s law– Fluid flux governed by viscos force is proportional to the fluid

potential: ⃗ = − ℎ→Flux is proportional to some potential gradient

Page 10: Introduction to Environment System Modeling

Typical diffusion equation• Diffusion equation(Fick’s second law):

=• Thermal conduction equation: = ∙• Electric current equation: = ∙• Groundwater flow equation: = ∙ ℎ

Page 11: Introduction to Environment System Modeling

0.0

0.2

0.4

0.6

0.8

1.0

1.2

0.00 0.05 0.10 0.15

Example of the exact solution of a diffusion equation

=

, 0 =

0, =∞, =

x [m]

C

= 1 − 0.8 ∗ 2

Initial conc. 0.2

x

Boundary conc. 1.0

Diffusion coeff.: D=2.5×10-9[m2/s]Time: t=86400 [s]

Decartes 1D

Initial condition

Boundary condition

= − − ∗= − − ∗ 2

Page 12: Introduction to Environment System Modeling

Example of the exact solution of a diffusion equation

ℎ = 1 ℎ

ℎ , 0 = ℎ

lim→ −2 ℎ =ℎ ∞, = ℎ

Initial head 0

x

Pumping rate 500m3/dayRadial 1D

Initial condition

Boundary condition

− =

20m

-60

-50

-40

-30

-20

-10

0

0 100 200 300 400 500r [m]

= 4

Hydraulic conductivity 10-5 m/s

Specific storage 3×10-5 m-1

= 0.5772⋯ (Euler const.)≈ + log − + 2 ∙ 2! − 3 ∙ 3! + ⋯+ −∙ ! + ⋯

h [m] 1 day1 week1 month3 months1 year

10 years

Page 13: Introduction to Environment System Modeling

Typical advection flux• Solute transport by a flow verocity of the

solution with a concentration– Product of flow velocity and concentration: ⃗ =

• Transport of momentum– Product of velocity and mass: ⃗ =

• Heat transport by a wind– Product of the flow velocity of a wind and heat

content: ⃗ =→Product of the field velocity and the content or mass

Page 14: Introduction to Environment System Modeling

Advection equation• Advection equation for a solute:

= − ∙ = − ∙ − ∙If the flow field is in a steady-sate (or incompressible) and source/sink terms are zero, mass balance of flow becomes ∙ = 0, and hence, the equation is reduced to = − ∙

• The exact solution of advection equation is⃗, = ⃗ − ∫ ,

It has no concrete functional form. The concentration directly comes from the upstream backward from to .

Page 15: Introduction to Environment System Modeling

Relative velocity between observer and flow field

• The previous explanations are based on the view of an observer at the outside of the flow field

• If the observer moves on the flow, the advection term is not seen.That is, = 0.

Based on 全微分 = + + + ,

= + + + = + ∙ is obtained. If the observer (coordinate) moves on the flow of velocity , = 0 expresses the same process (principle of relativity)

• Because the conclusion is same, we can choose more convenient one depending on the case.

= + ∙ is called as “material derivative” or “Lagrange derivative”, and it is used for the derivation of Navier-Stokes equation in the theory of fluid dynamics, for example.

Page 16: Introduction to Environment System Modeling

Superposition of multiple processes

• Advection + diffusion– flux: ⃗ = −– Advection-diffusion equation: = − ∙• Advection + diffusion + attenuation– Advection-diffusion-attenuation equation: =− ∙ +→It is achieved by summing up the necessary processes to be considered in the model.

Page 17: Introduction to Environment System Modeling

Continuum mechanics

• Force balance+ −+ + −+ + − + F = 0

+ − + + −+ + − + F = 0

+ + + F = 0x1

x2

x3

dx1dx2

dx3 σ22

σ23

σ21

σ32

σ33

σ31

σ12

σ13σ11

Let Σ = , and it becomes ∙ Σ + = 0The formula is very similar to the conservation equation.

Page 18: Introduction to Environment System Modeling

Static solid mechanics

• Force balance– direction: ∙ Σ + = 0

• Constitutive equation– StressーStrain relation:

• Displacement-strain relation

– Strain tensor ε = +

223ij ij kk ijG K G

Σ =

+ + 3 + = 0Putting them into together, we obtain

Page 19: Introduction to Environment System Modeling

Fluid dynamics

• Momentum conservation

– direction: ∙ Σ + =• Constitutive equation

– StressーStrain relation:

• velocity-strain rate relation

– Strain rate tensor: = +

Σ =2 ij

ij ijpt

2ii i i

i

v pv v v Ft x

Putting them into together, we obtain The mass balance equation

∙ ⃗ = 0

Page 20: Introduction to Environment System Modeling

Special methods to solve differential equation

• Laplace transform– example:For = , integrating both sides of equation

as∫ , it becomes − 0 =– where = ∫ . If the initial condition is 0 = 0, it is

reduced to =– Solving for is easy and = +– If the boundary conditions are = at = 0, = 0 at

= , they give = + = , = − += 0, and = is the final solution

Page 21: Introduction to Environment System Modeling

Inverse Laplace transform• To obtain the time-domain solution from , we need

an inversion.• Usually it can be achieved by referring a list of known

Laplace transform• If the solution is not listed in the table, it is necessary

to calculate Bromwich integral = ∫ . This is a complex integral in gauss plane and calculated with the residue theorem. It is not easy and the analytical integration is not always possible.

• Numerical methods to calculate inverse Laplace transform– Stehfest, Iseger, etc.

Page 22: Introduction to Environment System Modeling

Stehfest’s algorithm• ≈ ∑• = −1 ∑ !

! ! ! ! !,

• is the maximum integer less than• Technique for numerical evaluation

– The factorial and exponent calculations appeared in increases explosively. Do not calculate them directly. Calculate with logarithmic scaling and invert it by exp function.

– Mathematically the accuracy becomes better as N becomes greater. Numerically, however, it is not true because the cancelation error becomes greater as becomes greater. Empirically, N~5 is a first choice and some trial-and-error might give the best accuracy around it.

Page 23: Introduction to Environment System Modeling

Special methods to solve differential equation

• Fourier transform

– Example:for = , integrating the both sides of equation by

∫ , it becomes =– where = ∫– can be easily obtained as = +– If the boundary conditions are = 0で = , = で = 0, they

give 0 = + = , = − + = 0, and

= is the final solution

Page 24: Introduction to Environment System Modeling

The meaning of the solution in Fourier transformed domain

• is a complex function– The magnitude of , , means the amplitude of the signal

of the angular frequency – The argument of , , means the phase shift

• Fourier transform gives the amplitude and phase-shift of periodical signal– For example, cos − gives the component of

angular frequency of the input signal• Since all the periodic signal can be expressed with the

series of trigonometric function(Fourier series) and the solutions of linear differential equation can be superposed, this approach works all the periodic input signal.

Page 25: Introduction to Environment System Modeling

Concept of Fourier series expansion• Periodic signals can be expressed with a series of

trigonometric function• For example, a input signal of period T is described as

= 12 + cos 2 + sin 2

= 2 cos 2= 2 sin 2

• In case the time series data is available only within the period T, the same method can be applied if we assume the unobserved data is periodic copies of the observed ones.

Page 26: Introduction to Environment System Modeling

Brief proof for Fourier coefficients• Only the integral of the product of cos or sin of same period are non-zeros and

the others are zeros

2 cos 2 = 2 1 + cos 42 =

2 sin 2 = 2 1 − cos 42 =

∫ cos sin = ∫ sin + sin = 0cos 2 cos 2 = 12 cos 2 + + cos 2 − = 0sin 2 sin 2 = 12 −cos 2 + + cos 2 − = 0

• Infinite series of orthogonal base functions must be able to express all functions(Linear algebra)

Page 27: Introduction to Environment System Modeling

Complex calculation for coefficients and applications

• − = ∫ exp −• Let = , then this is the Fourier transform for the period 0,• Though the integral can be defined for continuous data, usually we

have discrete observation of time span ∆• Then, the approximation − ~ ∑ exp − is used

• The amplitude + and the phase tan of the signal components of angular frequency = ∆ are obtained.

• If the input signal is Fourier transformed, it can be used for the boundary condition of Fourier transformed differential equation. Then, the solution in Fourier domain gives the amplitude and phase shift of the solution.

Page 28: Introduction to Environment System Modeling

Example of Discrete Fourier transform

0-50

-100

50100150

-150tide

leve

l [cm

, TP] Tide (Kouzushima)

Tide (Kouzushima)

0.0

10.0

20.0

30.0

ampl

itude

[cm

]

S2

M2

O1K1

10.5 5 10 50 100

period [day]

23-Jul 20-Aug 17-Sep 15-Oct 12-Nov 10-Dec

Page 29: Introduction to Environment System Modeling

Methods for Fourier transform• MS-EXCEL

– Data Analysis? → Fourier Transform– The number of data should be 2n

• R– (x <- read.table("sample_data.txt"))– ftx <- fft(x$V1)– ftx <- 2*ftx/length(x$V1)– ftx[1] <- ftx[1]*0.5– period <- 1:(length(x$V1)/2)– period <- length(x$V1)/period– absftx <- abs(ftx[1:(length(x$V1)/2)])– phaseftx <- atan2(Im(ftx[1:(length(x$V1)/2)]),Re(ftx[1:(length(x$V1)/2)]))– write.table(cbind(period,absftx,phaseftx), "output.txt", quote=FALSE,

append=FALSE)– (The number of data is not limited to 2n)

Page 30: Introduction to Environment System Modeling

Method for Fourier transform• fortran

– Basically, it is possible to make a simple code for Discrete Fourier Transform based on the previous handouts.

– Calculation of ∑ exp − is the core part

– +α• Complex number declaration → complex(8) :: fx• Pure imaginary number “i” → (0,1)• Magnitude of complex number →abs(fx)• Argument of complex number →atan2(imag(fx),real(fx))

Page 31: Introduction to Environment System Modeling

Summary• Most processes of interest in environment studies are expressed

with the differential equation of conservation law type.• Though there are the exact solutions under several simple

conditions, it is difficult to find the exact solution if the condition becomes a bit complex as it is observed in the actual situations.

• Laplace transform is effective to find the analytical solution. However the exact inverse Laplace transform is usually difficult and a numerical inversion is often necessary.

• Fourier transform is effective for analyzing and modeling periodic steady-state that is often observed in natural processes.However, it is not suitable for non-periodic processes.

• For general applications, numerical methods like FDM or FEM work.– From the next lecture, numerical methods for conservation law type

will be explained.