0% found this document useful (0 votes)
102 views

Description For 2d Wave Equation Codes

This document describes methods for solving the 2D wave equation using finite difference methods and discusses applications to modeling refraction and reflection of waves. The 2D wave equation is solved using finite difference methods by approximating derivatives on a grid and calculating wave values at the next time step based on current and previous values at neighboring points. Refraction is modeled by calculating shifts in wave positions proportional to the slope of the water surface. Reflection is modeled by calculating the shift of a reflected ray's intersection with the surface based on the gradient of the water's height.

Uploaded by

Joe Bonfield
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views

Description For 2d Wave Equation Codes

This document describes methods for solving the 2D wave equation using finite difference methods and discusses applications to modeling refraction and reflection of waves. The 2D wave equation is solved using finite difference methods by approximating derivatives on a grid and calculating wave values at the next time step based on current and previous values at neighboring points. Refraction is modeled by calculating shifts in wave positions proportional to the slope of the water surface. Reflection is modeled by calculating the shift of a reflected ray's intersection with the surface based on the gradient of the water's height.

Uploaded by

Joe Bonfield
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Description for 2d wave equation codes.

1. Solve 2d wave equation with Finite difference method The 2d wave equation is: ( )

( ) is function that need to find, it can be different thing - time, coordinates, depending on physics task: change of height of water in a pool, change of pressure when sound expansion, electric potential in electromagnetic waves. - is speed of waves. is strength of waves decay. finite difference methods give as approximation for derivative If there is a some function ( ) and we have mesh second derivative approximately: with step , is values of at then

( For wave equation: ( ) ( ( )

where time index, - x index, Then we can find next time step:

- y index. Let

( where

( ( This can be solved as recurrent method: for (

) )

end of for

where

is current values,

- is old values,

is new values.

It can be imagined as sequence of frames one by another:

i+4
i+3 i+2 i+1 i

i-1

this thing:

i+1,j,k

i,j,k+1 i,j-1,k i,j,k-1 i-1,j,k


move along all current plate and find values of on next plate. When dots is out o the plate than 0 used. That mean that it is boundary condition on edges. in Matlab cross shown with red:

i,j,k

i,j+1,k

can be made with conv2 matlab function. It is 2d convolution. It is need to convolve with this matrix: ( conv2(u,D,'same') 'same' makes return same size matrix as u sizes. Then here boundary condition on edges used. )

2. Refraction Let say on the bottom of pool of water we have some picture. Water surface has height change . equation for is 2d wave equation. We want to know how the picture will be distorted after it come out from water. Let water surface in some place was inclined at small angle :

ray

te wa

e f ac ur s

a a
d

b c

s=?
because ray has time reversal nature then we can consider that ray come from eye to pool bottom. Our task is to find shift . From refraction low:

is refraction index of water. because angles are small:

( I.e shift is proportional to angle of water surface inclining.

In 2d waves we have to inclinings one along x another along y. The angles can be found from gradient:

derevatives in matlab can be found as covolution with sobel operator: http://en.wikipedia.org/wiki/Sobel_operator Shifted pixels colors can be get as 2d interpolation. inter2 matlab function used.

3. Reflection Let we have water surface in plane y=0, a ray go at angle Normal vector to water surface in point p is to the plane y=0 and reflected at point p.

(x0 ,y0 )

x n

p z
(x0 ,-y0 )

If water surface has no inclining then vector ( ) and ray go to point in plane z=0

now let water surface incline a little: ( direction of the ray before reflection: ( point of reflection position: ( ray direction after reflection: ( ( ( ) ( ) )( ) ( ) ) ) ) )

reflected ray can be parameterized with parameter

Let find parameter when ray reach plane z=0: ( ( ) ) ( )

( ( )

) ( (

( )( )

) ) ( )

So shift to

is

Shift to

is ( )

vector (

) is proportional to gradient of solution . Gradient can be found with sobel operator.

You might also like