dr. jennifer parham-mocello. what is an ide? ide – integrated development environment software...

22
Dr. Jennifer Parham-Mocello

Upload: leo-potter

Post on 20-Jan-2016

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Dr. Jennifer Parham-Mocello

Page 2: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

What is an IDE?IDE – Integrated Development EnvironmentSoftware application providing conveniences

to computer programmers for software development.

Consists of editor, compiler/interpreter, building tools, and a graphical debugger.

Heat Diffusion / Finite Difference Methods 2

Page 3: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

EclipseJava, C/C++, and PHP IDEUses Java Runtime Environment (JRE)

Install JRE/JDK - http://www.oracle.com/technetwork/java/index.html

Need C/C++ compilerInstall Wascana (Windows version)

http://www.eclipselabs.org/p/wascana

Heat Diffusion / Finite Difference Methods 3

Page 4: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Using EclipseExample – Open HelloWorld C++ project

File -> New -> C++ ProjectEnter Project Name

Building/Compiling ProjectsProject -> Build AllRun -> Run

Console

Heat Diffusion / Finite Difference Methods 4

Page 5: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Heat Diffusion / Finite Difference Methods 5

Page 6: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Heat Diffusion / Finite Difference Methods 6

Heat Diffusion EquationDescribes the distribution of heat (or

variation in temperature) in a given region over time.

For a function u(x, t) of one spatial variables(x) and the time variable t, the heat diffusion equation is:

t

uc

x

uk

2

2

1D02

2

t

uc

x

uk

1D

or

Material Parameters – thermal conductivity (k), specific heat (c), density ()

Page 7: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Conceptual and theoretical basisConservation of mass, energy, momentum,

etc.Rate of flow in - Rate of flow out = Rate of

heat storage

Heat Diffusion / Finite Difference Methods 7

t

uc

x

uk

2

2

t

uc

y

u

x

uk

2

2

2

2

t

uc

z

u

y

u

x

uk

2

2

2

2

2

2

1D 2D

3D

Page 8: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

x=0.0 x=4.0

3g/cm 7.8

Ccal/g 0.11

Ccmsec/cal 13.0

c

k

Physical Parameters

C100),0.4(

C0),0.0(

tu

tu

Boundary Conditions

C0)0.0,( xu

Initial Conditions

Wire with perfect insulation, except at ends

. and

of valuesallfor ),(for solve ,conditions

boundary and initial and ,parameters physical

, equation, reticalGiven theo2

2

tx

txu

t

uc

x

uk

Heat Diffusion / Finite Difference Methods 8

Page 9: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Outline of SolutionDiscretization (spatial and temporal)Transformation of theoretical equations to

approximate algebraic formSolution of algebraic equations

Heat Diffusion / Finite Difference Methods 9

Page 10: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

DiscretizationSpatial - Partition into equally-spaced nodes

Temporal - Decide on time stepping parameters

x=0.0 x=1.0x=0.33 x=0.67

u0 u1 u2 u3

Let to = 0.0, tn = 10.0, and t = 0.1

Heat Diffusion / Finite Difference Methods 10

Page 11: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Approximate Theoretical with Algebra

211

2

2

)(

2

x

uuu

x

u

t

uu

t

u

iii

ttt

Finite difference approximations forfirst and second derivatives

u0 ui-1 ui+1 unu1 un-1ui

Heat Diffusion / Finite Difference Methods 11

Page 12: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

ti

ttii

tit

it

ti

ttii

tit

it

uuuuuxc

tk

t

uuc

x

uuuk

t

uc

x

uk

112

2

11

2

2

2)(

)(

2

ti

ttii

tit

it uuuuur

xc

tkr

11

2

2

have then we,)(

Let

Heat Diffusion / Finite Difference Methods 12

Page 13: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Algorithm t

itt

iit

it

it uuuuur

11 2

for t=0,tn

for each node, i predict ut+t

endforendfor

• Predicting ut+t at each node• Explicit solution• Implicit solution (system of equations)

Heat Diffusion / Finite Difference Methods 13

Page 14: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

tii

tit

ittt

i

tti

ti

ttii

tit

it

uuuuru

u

uuuuur

11

11

2

,for solvingby

2

Rearrange

Heat Diffusion / Finite Difference Methods 14

Page 15: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

2

1

want wepurposes,stability for :Note

092.0)33.0)(0.5)(0.2(

)1.0)(0.1(

)(

33.0

1.0

0.5

2.0

.01

22

r

xc

tkr

x

t

c

k

Physical Parameters

100),0.1(

0),0.0(

tu

tu

Boundary Conditions

0)0.0,( xu

Initial Conditions

u0 u1 u2 u3

t u0 u1 u2 u30.0 0.0000 0.0000 0.0000 0.00000.1 0.0000 0.0000 9.1874 100.00000.2 0.0000 0.8432 16.6790 100.00000.3 0.0000 2.2200 22.8760 100.0000

10.0 0.0000 33.3300 66.6640 100.0000

0.0000 33.3333 66.6667 100.0000

Heat Diffusion / Finite Difference Methods 15

Page 16: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

ExtensionTwo Dimensions

t

uuc

y

uuu

x

uuuk

t

uc

y

u

x

uk

tji

ttjiji

tji

tji

tji

tji

tji

t

,,

2

1,,1,

2

,1,,1

2

2

2

2

)(

2

)(

2

u i,j

u i,j-1

u i,j+1

u i+1,ju i-1,j

Heat Diffusion / Finite Difference Methods 16

Page 17: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Implement 1-D Heat DiffusionOpen New C++ ProjectName the ProjectOpen New C++ source code file

File -> New -> Source FileName C++ File (remember extension, .C, .c+

+, .cpp)

Heat Diffusion / Finite Difference Methods 17

Page 18: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

EXTRAS

Heat Diffusion / Finite Difference Methods 18

Page 19: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Shorthand NotationsGradient (“Del”) Operator

z

y

x

,

z

y

x

:3D

, :2D

, :1D

u

u

u

u

y

ux

u

u

y

x

x

uu

x

Heat Diffusion / Finite Difference Methods 19

Page 20: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Divergence (Gradient of a vector field)

2

2

2

2

2

2

2

2

2

2

2

2

:3D

:2D

:1D

z

u

y

u

x

u

z

uy

ux

u

zyxu

y

u

x

u

y

ux

u

yxu

x

u

x

u

xu

T

T

T

Heat Diffusion / Finite Difference Methods 20

Page 21: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Laplacian Operator

uu

z

u

y

u

x

uu

y

u

x

uu

x

uu

T

2

2

2

2

2

2

22

2

2

2

22

2

22

2

Sometimes :Note

:3D

:2D

:1D

Heat Diffusion / Finite Difference Methods 21

Page 22: Dr. Jennifer Parham-Mocello. What is an IDE? IDE – Integrated Development Environment Software application providing conveniences to computer programmers

Heat Diffusion Equation - rewritten

t

uc

x

uk

2

2

t

uc

y

u

x

uk

2

2

2

2

t

uc

z

u

y

u

x

uk

2

2

2

2

2

2

t

ucuk

2

•LHS represents spatial variations•RHS represents temporal variation

Heat Diffusion / Finite Difference Methods 22