p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

46
Report #1 Example Parallel FEM Class in Winter Semester 2011 Summer Kengo Nakajima Kengo Nakajima Technical & Scientific Computing I (4820-1027) Seminar on Computer Science I (4810-1204)

Transcript of p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Page 1: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort #

1 Ex

ampl

ep

pPa

ralle

l FEM

Cla

ss in

Win

ter

Sem

este

r

2011

Sum

mer

Ken

goN

akaj

ima

Ken

goN

akaj

ima

Tech

nica

l & S

cien

tific

Com

putin

g I (

4820

-102

7)S

emin

ar o

n C

ompu

ter S

cien

ceI (

4810

-120

4)

Page 2: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

12

1DS

tatic

Line

arE

last

icP

robl

em1D

Sta

tic L

inea

r Ela

stic

Pro

blem F

x=0

(xm

in)

x= x

max

•O

nly

defo

rms

in x

-dire

ctio

n (d

ispl

acem

ent:

u)

x0

(xm

in)

xx m

ax

–S

ectio

nal A

rea

A=A 1

x +

A 2(>

0)–

Uni

form

You

ng’s

Mod

ulus

E–

Bou

ndar

y C

ondi

tions

(B.C

.)•

x=0

:

u=0

(fix

ed)

•x=

x max

: F(a

xial

forc

e)

•Tr

uss:

NO

ben

ding

def

orm

atio

n by

G-fo

rce

Page 3: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

13

1DS

tatic

Line

arE

last

icP

robl

em1D

Sta

tic L

inea

r Ela

stic

Pro

blem F

A=A 1

x +

A 2(>

0)

x=0

(xm

in)

x= x

max

•O

nly

defo

rms

in x

-dire

ctio

n (d

ispl

acem

ent:

u)

x0

(xm

in)

xx m

ax

–S

ectio

nal A

rea

A=A 1

x +

A 2(>

0)–

Uni

form

You

ng’s

Mod

ulus

E–

Bou

ndar

y C

ondi

tions

(B.C

.)•

x=0

:

u=0

(fix

ed)

•x=

x max

: F(a

xial

forc

e)

•Tr

uss:

NO

ben

ding

def

orm

atio

n by

G-fo

rce

Page 4: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

14

1DS

tatic

Line

arE

last

icP

robl

em1D

Sta

tic L

inea

r Ela

stic

Pro

blem F

A=A 1

x +

A 2(>

0)

x=0

(xm

in)

x= x

max

x0

(xm

in)

xx m

ax

0=

+∂∂

Xx

σE

quilib

rium

Equ

atio

n∂x

u∂

Equ

atio

n

Stra

in~

0+ ⎟⎞

⎜⎛∂

∂X

uE

xux

∂∂=

εS

train

Dis

plac

emen

t

Stre

ss~

0=

+ ⎟ ⎠⎜ ⎝

∂∂

Xx

Ex

Gov

erni

ngE

quat

ion

xx

Eεσ

=S

tress

~S

train

Gov

erni

ng E

quat

ion

for u

Page 5: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

15

Pro

cedu

res

for C

ompu

tatio

np

0=

+ ⎟ ⎠⎞⎜ ⎝⎛

∂∂∂∂

Xxu

Ex

•so

lve

equa

tions

for

disp

lace

men

t u

•ca

lc. s

train

xux

∂∂=

ε

•ca

lc. s

tress

x∂

xx

Eεσ

=

Page 6: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

166

Ana

lytic

al S

olut

ion

y

AFE

xx

==

εσ

Ax

x

Fdu

E2

1A

xA

dxE

+=

()

CA

xA

AFEu

++

=2

11

log

()

0@0

log

21

==

−=

xu

AAF

CQ

()

()

[]

ll

AA

AF

()

()

[]

22

11

log

log

AA

xA

EAu

−+

=∴

Page 7: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

17

Rep

ort #

1•

Impl

emen

t qua

drat

ic in

terp

olat

ion

on “b

1.c/

b1.f”

. N

ame

ofth

ede

velo

ped

code

is“b

2c/

b2f”

Nam

e of

the

deve

lope

d co

de is

b2.

c/b2

.f•

Eva

luat

e ac

cura

cy o

f “b1

” and

“b2”

acc

ordi

ng to

ef

fect

ofnu

mbe

rofm

eshe

sef

fect

of n

umbe

r of m

eshe

s.•

Con

firm

the

follo

win

g eq

uatio

n is

cor

rect

, if s

ectio

nal

it

tar

ea is

con

stan

t:

[]

[]

⎥⎤⎢⎡

+−

+⎟⎞

⎜⎛∫

216

14EA

Nd

Nd

T[

][

]⎥⎥⎥ ⎦

⎢⎢⎢ ⎣+

−+

−+

−=

⎟⎟ ⎠⎞⎜⎜ ⎝⎛

∫14

162

1632

166LEA

dVdxN

ddxN

dE

V

•D

ue o

n S

epte

mbe

r 12t

h(M

), 20

11 a

t 17:

00•

Doc

umen

ts–

Rep

ort (

Out

line,

Res

ults

, Dis

cuss

ions

) (le

ss th

an 5

pag

es)

–Li

st o

f Sou

rce

Cod

e

Page 8: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

18

Rep

ort #

1: T

ips

(1)

•D

eriv

ativ

e of

Sha

pe

ξ=+1

13

2

ξ=-1

ξ=0

Func

tions

13

()

()

ξξ

ξ+

=1

1N

ξξ

+−

=21

1

ddN()

()

()

()(

ξξ

ξξ

ξ

−+

=

+−

=

11

12

21

NN

ξξξ

−=

22

2

ddNd

()

()

ξξ

ξ+

=1

213

ξξ

+=

213

ddNd ξ2

d

⎥⎥⎤

⎢⎢⎡

⎥⎥⎤

⎢⎢⎡∂∂

∂∂∂∂

∂∂∂∂

∂∂N

NN

NN

N3

12

11

1

ξξ

ξξ

ξξ

()

∑ ==

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

∂∂

∂∂

∂∂

∂∂∂∂

∂∂∂∂

∂∂∂∂

∂∂

∂∂

∂∂

⋅=

m kk

kA

NN

NN

NN

NN

NN

NN

Jw

EEm

atk

1

33

23

13

32

22

12

||1

][

ξξ

ξξ

ξξ

ξ

ξξ

ξξ

ξξ

ξξ

=⎥⎥ ⎦

⎢⎢ ⎣⎥⎥ ⎦

⎢⎢ ⎣∂

∂∂

∂∂

∂k

ξξ

ξξ

ξξ

ξξ

Valu

es a

t Gau

ssia

n Q

uad

Poi

nts

(ξk)

Page 9: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

19

Rep

ort #

1: T

ips

(2)

•Ja

cobi

anξ=

+1

13

2

ξ=-1

ξ=0

()

32

13

3N

NN

NN

xi

∂∂

∂⎟⎟⎞

⎜⎜⎛ ∂∂

∂∑

13

()

33

22

11

11

xx

xx

xN

ii

i

ii

ξξ

ξξ

ξ∂

+∂

+∂

= ⎟⎟ ⎠⎜⎜ ⎝∂

=∂

=∂

∑∑

==

•Ja

cobi

an a

t Gau

ssia

n Q

uad

Poi

nts

(ξk)

Q(ξ

k)

33

22

11

xN

xN

xN

ξξ

ξ∂∂

+∂∂

+∂∂

=∂∂

kk

kk

ξξ

ξξ

ξξ

ξξ

ξξ

ξξ

==

==

∂∂

∂∂

Page 10: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

11010

Stra

tegy

•U

nifo

rm S

ect.

Are

a, L

inea

r Ele

m. (

Ana

lytic

al

Inte

grat

ion

)g

)–

<$fe

m1>

/1d/

1d.c

•U

nifo

rmS

ect.

Are

a,H

ighe

r-O

rder

Ele

m.

Uni

form

Sec

t. A

rea,

Hig

her

Ord

er E

lem

.–

<$fe

m1>

/1d/

1d2.

c•

Non

unifo

rmS

ect

Are

aLi

near

Ele

m(A

naly

tical

)•

Non

-uni

form

Sec

t. A

rea,

Lin

ear E

lem

. (A

naly

tical

)–

<$fe

m1>

/1da

rea/

a1.c

Nif

St

AI

tiLi

•N

on-u

nifo

rm S

ect.

Are

a, Is

opar

amet

ricLi

near

E

lem

. (N

umer

ical

Inte

grat

ion

)–

<$fe

m1>

/1da

rea/

b1.c

•N

on-u

nifo

rm S

ect.

Are

a, Is

opar

amet

ricH

ighe

r-O

rder

Ele

m. (

Num

eric

al In

tegr

atio

n )

–S

tarti

ng fr

om “1

d2.c

” is

easy

.

Page 11: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

111

Gau

ssia

n Q

uadr

atur

e•

On

norm

aliz

ed “n

atur

al (o

r loc

al)”

coo

rdin

ate

t[

1+1

]sy

stem

[-1,

+1]

•C

an a

ppro

xim

ate

up to

(2m

-1)-

thor

der o

f fun

ctio

ns

by m

quad

ratu

re p

oint

s (m

=2is

eno

ugh

for

quad

ratic

sha

pe fu

nctio

ns).

()

()

[]

∑∫

=

+

⋅=

m kk

kf

wd

f1

1 1

ξξ

ξξ=

+1ξ=

-1ξ=

0

ξ=

057

7350

ξ=+

057

7350

=−

k1

1ξ k

=-0.

5773

50ξ k

=+0.

5773

50

001

5773

500

200.2

,00.0

==

=k

kw

mξξ

9/8,

00.03

00.1,

5773

50.0

2=

==

==

kk

kk

wm

wm

ξξ

9/5,

7745

97.0

=k

kw

ξ

Page 12: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

112

Gau

ssia

n Q

uadr

atur

eca

n be

eas

ily e

xten

ded

to 2

D &

3D

++

11

∫∫

+ −

+ −

=d

df

I1 1

1 1

),

ξη

ξ []

∑∑

==

⋅⋅

=n j

ji

ji

m if

WW

11

),

ξ

mn:

num

bero

fqua

drat

ure

m,n:

num

ber o

f qua

drat

ure

poin

ts in

ξ,η

-dire

ctio

n

ji

WW

,

),

(j

ξ

:W

eigh

ting

Fact

or:

Coo

rdin

ates

of Q

uad’

s

j

Page 13: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

113

How

to u

se G

auss

ian

Qua

drat

ure

•C

oord

inat

e tra

nsfo

rmat

ion

from

[0,L

](or

[X1,X

2]) t

o is

d

dne

eded

.•

Sha

pe/In

terp

olat

ion

func

tions

mus

t be

hand

led

on

natu

ral/l

ocal

coo

rdin

ate

syst

em.

12

X=X 1

=0X=

X 2=L

12

12

ξ=-1

ξ=+1

Loca

l nod

e ID

’s (1

,2,3

…) a

re d

efin

ed a

s su

bscr

ipts

of

X, u

, N a

nd e

tc.

Page 14: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

114

Pie

cew

ise

Line

ar E

lem

ent

()

21+

αα

uξ=

-1ξ=

+1

()

() 11

21

2

21

1

++

=−

+=

αα

αα

uuu 11

2 u 2

21

22

11

2,

2u

uu

α+

−=

+=

()

() 2

12

12

12

11

211

212

2

22

uu

uu

uu

ξξ

ξα

α+

+−

=+

−+

+=

+=

22

22

()

ξ1

N()

ξ2

N

()

()

()

()

ξξ

ξξ

+=

−=

121

,1

212

1N

N

Page 15: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

115

2nd -

orde

r/Qua

drat

ic E

lem

ent

ξ=+1

13

2

ξ=-1

ξ=0

12

32

11

23

21

αα

αξ

αξ

αα

=+

−=

++

=u

uu

u 1u 2

u 33

21

αα

++

=u

32

13

31

22

12

,,

uu

uu

uu

αα

α+

−=

+−

==

23

21

31

22

32

1

32

21

22

,2

,

uu

uu

uu

u

u

ξξ

ξα

ξα

α

αα

α

+−

++

−+

=+

+=

()

3

2

22

1

2

23

21

1

22

uu

ξξ

ξξ

ξξ

ξξ

++

−+

+−

=(

)

()

()(

)(

) 32

1

32

1

121

11

121

22

uu

ξξ

ξξ

ξ

ξ

++

−+

++

−=

()

()(

)(

) 32

12

ξξ

ξξ

ξ

()

ξ1

N()

ξ2

N()

ξ3

N

()

()

()

()(

)()

()

ξξ

ξξ

ξξ

ξξ

ξ+

=−

+=

+−

=1

21,

11

,1

213

21

NN

N

Page 16: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

116

Isop

aram

etric

Ele

men

tso

paa

etc

ee

t•

Def

initi

ons

of “I

sopa

ram

etric

” Ele

men

ts–

Eac

h el

emen

t is

defin

ed o

n na

tura

l/loc

al c

oord

inat

e fo

r [-

1,+1

]A

dth

tf

lb

ldi

tt

fh

–A

nd th

e co

mpo

nent

s of

glo

bal c

oord

inat

e sy

stem

of e

ach

node

(e.g

. x,y

,z) fo

r cer

tain

kin

ds o

f ele

men

ts a

re d

efin

ed

bysh

ape

func

tions

[N]o

nna

tura

l/loc

alco

ordi

nate

syst

emby

sha

pe fu

nctio

ns [N

]on

natu

ral/l

ocal

coo

rdin

ate

syst

em,

whe

re s

hape

func

tions

[N]a

re a

lso

used

for i

nter

pola

tion

of d

epen

dent

var

iabl

es.

p

)(

,)

(i

n

ii

n

ix

Nx

uN

uN

N

⋅=

⋅=

∑∑

ξξ

()

() 2

11

211

21u

uu

ξξ

++

−=

...3,2:1

1

N

ii

n=

=

()

() 2

11

211

21x

xx

ξξ

++

−=

⎞⎛

11(

)(

) ⎟ ⎠⎞⎜ ⎝⎛

++

−=

21

12

2121

xx

xx

ξ

Page 17: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

117

Inte

grat

ion

over

Eac

h E

lem

ent:

[k]

g[

]

[]

[]

[]

[]

NN

NN

TT

⎟⎞⎜⎛

∂∂

⎟⎞⎜⎛

∂∂

∫∫

[]

[]

[]

[]

Adx

xNxN

EdV

xNxN

EV

V⎟⎟ ⎠⎞

⎜⎜ ⎝⎛

∂∂∂

∂=

⎟⎟ ⎠⎞⎜⎜ ⎝⎛

∂∂∂

∂∫

Page 18: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

118

Par

tial D

iffer

entia

tion

on N

atur

al/L

ocal

C

oord

inat

e S

yste

m (1

/2)

•A

ccor

ding

to fo

rmul

ae:

ξ∂

∂∂

xN

Ni

i)

ξξ∂∂

∂∂=

∂∂

xxN

Ni

i)

(

⎤⎡ ∂

N⎥ ⎦⎤

⎢ ⎣⎡∂∂ξiN

⎤⎡∂

N

can

be e

asily

der

ived

acc

ordi

ng to

def

initi

ons.

⎥ ⎦⎤⎢ ⎣⎡∂∂xN

iar

e re

quire

d fo

r com

puta

tions

.

⎤⎡ ∂

⎥ ⎦⎤⎢ ⎣⎡ ∂∂ ξx

is J

acob

ian

(=J)

⎞⎛

Jx

Nx

Nx

i

n i

ii

n ii

NN

=∂∂

= ⎟⎟ ⎠⎞⎜⎜ ⎝⎛

∂∂=

∂∂∑

∑=

=1

ξξ

Page 19: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

119

Par

tial D

iffer

entia

tion

on N

atur

al/L

ocal

C

oord

inat

e S

yste

m (2

/2)

•Ta

rget

term

s ar

e de

rived

as

follo

ws:

NN

Ni

i

i1

)(

)(

⋅∂

=∂

=∂

ξξξ

Jx

x⋅

∂=

∂∂=

∂ξ

ξ

•In

tegr

atio

n on

nat

ural

/loca

l coo

rdin

ate

syst

em:

()

()

ξξ

ξξ

ξd

xd

Jdx

dJ

fdx

xf

L

∂∂=

==∫

∫+ −

Q1 1

0

Page 20: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

120

Inte

grat

ion

over

Eac

h E

lem

ent:

[k] (

1/2)

g[

]()

[]

[]

[]

[] ⎟⎞

⎜⎛∂

∂⎟⎞

⎜⎛∂

∂T

TN

NN

N[]

[]

[]

[]

()

∫∫

⎞⎛

⎤⎡

⎞⎛

⎟⎟ ⎠⎞⎜⎜ ⎝⎛

∂∂∂

∂=

⎟⎟ ⎠⎞⎜⎜ ⎝⎛

∂∂∂

VV

dxx

AxN

xNE

dVxN

xNE

[]

[]

()

[]

[]

()

∫∫

+ −

+ −⎟⎟ ⎠⎞

⎜⎜ ⎝⎛⎥ ⎦⎤

⎢ ⎣⎡∂∂

⎥ ⎦⎤⎢ ⎣⎡

∂∂

=⎟⎟ ⎠⎞

⎜⎜ ⎝⎛

∂∂∂

∂=

TT

dJ

AJ

NJ

NE

dJ

AxN

xNE

1 1

1 1

11

ξξ

ξξ

ξξ

[]

[]

()

∫+

⎟⎟ ⎠⎞⎜⎜ ⎝⎛

∂∂∂

∂=

⎠⎝

⎦⎣

⎠⎝

T

dA

NN

JE

1

||1

ξξ

ξξ

[]

[]

()

∑∫ −

⎥⎤⎢⎡

∂∂

⎟ ⎠⎜ ⎝

∂∂

mT

AN

Nw

E

J1

1

||

ξ

ξξ

[]

[]

()

∑ ==

=⎥⎥ ⎦

⎢⎢ ⎣∂

∂⋅

==

kk

kA

Jw

Ek

kk

1|

ξξ

ξξ

ξξ

ξξ

Page 21: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

121

Inte

grat

ion

over

Eac

h E

lem

ent:

[k] (

2/2)

g

[](

)

[]

[]

()

∑⎥⎤

⎢⎡∂

∂m

T

AN

NE

[]

[]

()

∑ ==

=

⎤⎡

⎥⎥ ⎦⎢⎢ ⎣

∂∂∂

∂⋅

=k

kk

AN

NJ

wE

kk

k1

||

ξξ

ξξ

ξξ

ξξ

ξ

()

∑ ==

⎥⎥ ⎦⎤

⎢⎢ ⎣⎡⎥ ⎦⎤

⎢ ⎣⎡∂∂

∂∂⎥ ⎦⎤

⎢ ⎣⎡∂

∂∂

∂⋅

=m k

kk

AN

NNN

Jw

Ek

1

21

21,

//|

|1ξ

ξξ

ξξ

ξξ

ξξ

==

⎥⎤⎢⎡

⎥⎤⎢⎡

∂∂

∂∂

⎦⎣

⎦⎣ ⎦

NN

NN

kk

21

112

||

ξξ

ξξ

ξξ

()

∑ ==

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

⎥⎥⎥⎥ ⎦⎢⎢⎢⎢ ⎣

∂∂∂∂

∂∂∂∂

∂∂

∂∂

⋅=

m kk

kA

NN

NN

Jw

Ek

12

21

2|

|1ξ

ξξ

ξξ

ξξ

ξξ

ξξ

=⎥⎥ ⎦

⎢⎢ ⎣⎥ ⎦

⎢ ⎣∂

∂∂

∂k

ξξ

ξξ

ξξ

Page 22: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

122

Exa

mpl

e (1

/7):

Var

’s/A

rray

’sp

()

y#include <stdio.h>

#include <stdlib.h>

#include<mathh>

#include

<math.h>

#include <assert.h>

int main(){

int NE, N, NPLU, IterMax, errno, NPLU0;

int

RZ

QP

DD

ip;

int R, Z, Q,

P, DD, i

p;

double dX, Resid, Eps, Area, F, Young, Jacobi;

double X1, X2, X3, U1, U2, U3, DL, Strain, Sigma, Ck, XX, X0, A1, A2, DISP;

double *U, *Rhs, *X;

double*Diag

*AMat;

double *Diag, *AMat;

double **W;

int *Index, *Item, *Icelnod;

double POI[2], WEI[2], dNdQ[3],Emat[3][3];

int i, j, in1, in2, in3, k, icel, k12, k13, k21, k23, k31, k32, jS;

int iter;

FILE *fp;

double BNorm2, Rho, Rho1=0.0, C1, Alpha, DNorm2;

intierr=

1;int ierr

1;

Page 23: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

12323

Exa

mpl

e (2

/7)

Initi

aliz

atio

n, A

rray

Allo

catio

n/*

//

+-------+

// +

+// | INIT. |

// +-------+

*/

fp = fopen("input2.dat", "r");

assert(fp

!=

NULL);

assert(fp !=

NULL);

fscanf(fp, "%d", &NE);

fscanf(fp, "%lf %lf %lf %lf %lf", &dX, &F, &A1, &A2, &Young);

fscanf(fp, "%d", &IterMax);

fscanf(fp, "%lf", &Eps);

fclose(fp);

fclose(fp);

N = 2*NE + 1;

NPLU0= 2*2 + NE*2 + (NE-1)*4;

U=

calloc(N

sizeof(double));

U = calloc(N, sizeof(double));

X = calloc(N, sizeof(double));

Diag = calloc(N, sizeof(double));

AMat = calloc(NPLU0, sizeof(double));

Rhs = calloc(N, sizeof(double));

Index=

calloc(N+1

sizeof(int));

Index= calloc(N+1, sizeof(int));

Item = calloc(NPLU0, sizeof(int));

Icelnod= calloc(3*NE, sizeof(int));

Page 24: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

124 2

4

Inpu

t Dat

ap

input.dat

2NE (

Num

ber o

f Ele

men

ts)

50.0 5.e4

-0.105 12

5.e6

Δx,F, A

1, A2, E

100

Num

ber o

f MA

X. I

tera

tions

for C

G S

olve

r1.e-8

Con

verg

ence

Crit

eria

for C

G S

olve

r

.12

02

1=

+=

Ax

Ax

5.110

02

1=

+=

Ax

Ax

12

34

5

12

Ele

men

t ID

Nod

e ID

(Glo

bal)

Δx=2

12

x=0

x=25

x=50

x=75

x=10

0

Page 25: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

12525

Exa

mpl

e (2

/7)

Initi

aliz

atio

n, A

rray

Allo

catio

n/*

//

+-------+

// +

+// | INIT. |

// +-------+

*/

fp = fopen("input2.dat", "r");

assert(fp

!=

NULL);

assert(fp !=

NULL);

fscanf(fp, "%d", &NE);

fscanf(fp, "%lf %lf %lf %lf %lf", &dX, &F, &A1, &A2, &Young);

fscanf(fp, "%d", &IterMax);

fscanf(fp, "%lf", &Eps);

fclose(fp);

fclose(fp);

N = 2*NE + 1;

NPLU0= 2*2 + NE*2 + (NE-1)*4;

U=

calloc(N

sizeof(double));

U = calloc(N, sizeof(double));

X = calloc(N, sizeof(double));

Diag = calloc(N, sizeof(double));

AMat = calloc(NPLU0, sizeof(double));

Rhs = calloc(N, sizeof(double));

Index=

calloc(N+1

sizeof(int));

Amat

: N

on-Z

ero

Off-

Dia

g. C

omp.

Item

: C

orre

spon

ding

Col

umn

IDIndex= calloc(N+1, sizeof(int));

Item = calloc(NPLU0, sizeof(int));

Icelnod= calloc(3*NE, sizeof(int));

pg

Page 26: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

1D-P

art2

26 26

Non

-Zer

oO

ff-D

iago

nalC

ompo

nent

sN

onZe

ro O

ffD

iago

nal C

ompo

nent

sN

odes

are

con

nect

ed to

nod

e on

eac

h el

emen

t eac

h ot

her

[]

[] =

=∑ =2 1

)(

i

ik

K+

{}

{} =

=∑4

)(i f

F+

∑ =1i

Page 27: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

1D-P

art2

27 27

Num

ber o

f Non

-Zer

o O

ff-D

iago

nals

Diff

tb

fti

dit

lti

fD

iffer

ent n

umbe

r of c

onne

ctio

ns a

ccor

ding

to lo

catio

n of

ea

ch n

ode

4 fo

rN

orm

al

Nod

es

2fo

rIn

term

edia

te

Nod

es

2 fo

rB

dB

ound

ary

Nod

es

Page 28: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

1D-P

art2

28 28

Num

ber o

f Non

-Zer

o O

ff-D

iago

nals

Diff

tb

fti

dit

lti

fD

iffer

ent n

umbe

r of c

onne

ctio

ns a

ccor

ding

to lo

catio

n of

ea

ch n

ode

4f

4 fo

rN

orm

al

Nod

es

2fo

rIn

term

edia

te

Nod

es

2 fo

r

•B

ound

ary

Nod

e#2

Boun

dary

Nod

es

y•

Inte

rmed

iate

Nod

e#N

E•

Nor

mal

Nod

e#N

E+1

2=N

E1

•N

orm

al N

ode#

NE+

1-2=

NE-

1–

exce

pt B

ound

ary

Nod

esT

tlN

d#

N2+

NE+

NE

12*

NE

+1

•To

tal N

ode#

: N=

2+N

E+N

E-1=

2*N

E +

1•

Non

-Zer

o O

ff-D

iag.

#: N

PLU

= 2*

2 +

2*N

E +

4*(N

E-1)

Page 29: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

129

Exa

mpl

e (3

/7)

Iiti

liti

AA

llti

(t)

Initi

aliz

atio

n, A

rray

Allo

catio

n (c

ont.)

W = (double **)malloc(sizeof(double *)*4);

()

{if(W == NULL) {

fprintf(stderr, "Error: %s¥n", strerror(errno));

return -1;

} for(i=0; i<4; i++) {

W[i]

(d

bl

)ll

(i

f(d

bl

)N)

W[i]

= (double *)

mall

oc(sizeof(double

)*N);

if(W[i] == NULL) {

fprintf(stderr, "Error: %s¥n", strerror(errno));

return -1;

}}} for(i=0;i<N;i++) U[i] = 0.0;

for(i=0;i<N;i++) Diag[i] = 0.0;

for(i=0;i<N;i++) Rhs[i] = 0.0;

f(k

0k<NPLU0k

)AM

[k]

00

X:

Xco

ordi

nate

for(k=0;k<NPLU0;k++) AMat[k] = 0

.0;

for(i=0;i<N;i++) X[i]= i*dX*0.5;

for(icel=0;icel<NE;icel++){

Icelnod[3*icel ]= 2*icel;

Icelnod[3*icel+1]= 2*icel+1;

Il

d[3

il2]

2i

l2

X:

X-c

oord

inat

e co

mpo

nent

of e

ach

node

Icelnod[3*icel+2]= 2*

icel+2;

} WEI[0]= +1.0;

WEI[1]= +1.0;

POI[0]

0577350

12

3

POI[0]= -0.577350;

POI[1]= +0.577350;

Page 30: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

130

Exa

mpl

e (3

/7)

Iiti

liti

AA

llti

(t)

Initi

aliz

atio

n, A

rray

Allo

catio

n (c

ont.)

W = (double **)malloc(sizeof(double *)*4);

()

{if(W == NULL) {

fprintf(stderr, "Error: %s¥n", strerror(errno));

return -1;

} for(i=0; i<4; i++) {

W[i]

(d

bl

)ll

(i

f(d

bl

)N)

W[i]

= (double *)

mall

oc(sizeof(double

)*N);

if(W[i] == NULL) {

fprintf(stderr, "Error: %s¥n", strerror(errno));

return -1;

}}} for(i=0;i<N;i++) U[i] = 0.0;

for(i=0;i<N;i++) Diag[i] = 0.0;

for(i=0;i<N;i++) Rhs[i] = 0.0;

f(k

0k<NPLU0k

)AM

[k]

00

icel

for(k=0;k<NPLU0;k++) AMat[k] = 0

.0;

for(i=0;i<N;i++) X[i]= i*dX*0.5;

for(icel=0;icel<NE;icel++){

Icelnod[3*icel ]= 2*icel;

Icelnod[3*icel+1]= 2*icel+1;

Il

d[3

il2]

2i

l2

Icel

nod[

3*ic

el]

=2*

icel

Icel

nod[

3*ic

el+

2]=

2*ic

el+

2Icelnod[3*icel+2]= 2*

icel+2;

} WEI[0]= +1.0;

WEI[1]= +1.0;

POI[0]

0577350

2ic

el2

icel

+2

Icel

nod[

3*ic

el+

1]=

2*ic

el+

1POI[0]= -0.577350;

POI[1]= +0.577350;

Page 31: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

13131

Exa

mpl

e (4

/7)

Glo

bal M

atrix

: Col

umn

ID fo

r Non

-Zer

o O

ff-D

iag’

s/*

// +--------------+

//

|CONNECTIVITY

|// | CONNECTIVITY |

// +--------------+

*/

Index[0]= 0;

for(i=1;i<N;i++) {

if(i%2

1)

{Index[i]4;

if

(i%2==1)

{Index[i]=4;

}else {Index[i]=2;}}

Index[1]= 2;

Index[N]= 2;

for(i=0;i<N;i++){

Index[i+1]

Index[i+1]

+Index[i];}

Index[i+1]= Index[i+1] + Index[i];}

NPLU= Index[N];

for(i=0;i<N;i++){

int jS = Index[i];

if(i

==0){

4 fo

rN

orm

al

Nod

esif(i

== 0){

Item[jS ] = i+1;

Item[jS+1] = i+2;

}else if(i == N-1){

Item[jS ] = i-2;

Item[jS+1]

=i

1;

Nod

es

2fo

rIn

term

edia

te

Nod

esItem[jS+1] =

i-1;

}else{

if (i%2==1){

Item[jS ] = i-1;

Item[jS+1] = i+1;

}else

{

2 fo

rBo

unda

ryN

odes

} else {

Item[jS ] = i-2;

Item[jS+1] = i-1;

Item[jS+2] = i+1;

Item[jS+3] = i+2;}}}

Page 32: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

13232

Exa

mpl

e (4

/7)

Glo

bal M

atrix

: Col

umn

ID fo

r Non

-Zer

o O

ff-D

iag’

s/*

// +--------------+

//

|CONNECTIVITY

|// | CONNECTIVITY |

// +--------------+

*/

Index[0]= 0;

for(i=1;i<N;i++) {

if(i%2

1)

{Index[i]4;

if

(i%2==1)

{Index[i]=4;

}else {Index[i]=2;}}

Index[1]= 2;

Index[N]= 2;

for(i=0;i<N;i++){

Index[i+1]

Index[i+1]

+Index[i];}

Index[i+1]= Index[i+1] + Index[i];}

NPLU= Index[N];

for(i=0;i<N;i++){

int jS = Index[i];

if(i

==0){

if(i

== 0){

Item[jS ] = i+1;

Item[jS+1] = i+2;

}else if(i == N-1){

Item[jS ] = i-2;

Item[jS+1]

=i

1;

両端の

節点:2つ

Item[jS+1] =

i-1;

}else{

if (i%2==1){

Item[jS ] = i-1;

Item[jS+1] = i+1;

}else

{

Item

(jS)

Item

(jS+1

)Ite

m(jS

)Ite

m(jS

+1)

} else {

Item[jS ] = i-2;

Item[jS+1] = i-1;

Item[jS+2] = i+1;

Item[jS+3] = i+2;}}}

Page 33: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

13333

Exa

mpl

e (4

/7)

Glo

bal M

atrix

: Col

umn

ID fo

r Non

-Zer

o O

ff-D

iag’

s/*

// +--------------+

//

|CONNECTIVITY

|// | CONNECTIVITY |

// +--------------+

*/

Index[0]= 0;

for(i=1;i<N;i++) {

if(i%2

1)

{Index[i]4;

if

(i%2==1)

{Index[i]=4;

}else {Index[i]=2;}}

Index[1]= 2;

Index[N]= 2;

for(i=0;i<N;i++){

Index[i+1]

Index[i+1]

+Index[i];}

Index[i+1]= Index[i+1] + Index[i];}

NPLU= Index[N];

for(i=0;i<N;i++){

int jS = Index[i];

if(i

==0){

if(i

== 0){

Item[jS ] = i+1;

Item[jS+1] = i+2;

}else if(i == N-1){

Item[jS ] = i-2;

Item[jS+1]

=i

1;Item[jS+1] =

i-1;

}else{

if (i%2==1){

Item[jS ] = i-1;

Item[jS+1] = i+1;

}else

{

中間

節点

:2つ

} else {

Item[jS ] = i-2;

Item[jS+1] = i-1;

Item[jS+2] = i+1;

Item[jS+3] = i+2;}}}

Item

(jS)

Item

(jS+1

)

Page 34: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

13434

Exa

mpl

e (4

/7)

Glo

bal M

atrix

: Col

umn

ID fo

r Non

-Zer

o O

ff-D

iag’

s/*

// +--------------+

//

|CONNECTIVITY

|// | CONNECTIVITY |

// +--------------+

*/

Index[0]= 0;

for(i=1;i<N;i++) {

if(i%2

1)

{Index[i]4;

if

(i%2==1)

{Index[i]=4;

}else {Index[i]=2;}}

Index[1]= 2;

Index[N]= 2;

for(i=0;i<N;i++){

Index[i+1]

Index[i+1]

+Index[i];}

Index[i+1]= Index[i+1] + Index[i];}

NPLU= Index[N];

for(i=0;i<N;i++){

int jS = Index[i];

if(i

==0){

if(i

== 0){

Item[jS ] = i+1;

Item[jS+1] = i+2;

}else if(i == N-1){

Item[jS ] = i-2;

Item[jS+1]

=i

1;Item[jS+1] =

i-1;

}else{

if (i%2==1){

Item[jS ] = i-1;

Item[jS+1] = i+1;

}else

{

Item

(jS)

Item

(jS+3

)

Item

(jS+2

)Ite

m(jS

+1)

} else {

Item[jS ] = i-2;

Item[jS+1] = i-1;

Item[jS+2] = i+1;

Item[jS+3] = i+2;}}}要

素両

端の節点

:4つ

Page 35: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

135

Exa

mpl

e (5

/7):

Mat

rix (1

/3)

p(

)(

)/*

// +-----------------+

// | MATRIX assemble |

//

+-----------------+

// +

+*/

for(icel=0;icel<NE;icel++){

in1= Icelnod[3*icel];

in2= Icelnod[3*icel+1];

in3=

Icelnod[3*icel+2];

icel

in3

Icelnod[3*icel+2];

X1 = X[in1];

X2 = X[in2];

X3 = X[in3];

DL

=fabs(X3-X1);

in3

in1

in2

DL

fabs(X3X1);

X0 = 0.5 * (X1+X3);

Emat[0][0]= 0.0;

Emat[0][1]= 0.0;

Emat[0][2]=

00;

Emat[0][2] 0.0;

Emat[1][0]= 0.0;

Emat[1][1]= 0.0;

Emat[1][2]= 0.0;

Emat[2][0]= 0.0;

Emat[2][1]=

00;

Emat[2][1] 0.0;

Emat[2][2]= 0.0;

Page 36: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

136

Exa

mpl

e (6

/7):

Mat

rix (2

/3)

p(

)(

)for(ip=0;ip<2;ip++){

dNdQ[0]= -0.5 + POI[ip];

dNdQ[1]= -2.0 * POI[ip];

dNdQ[2]=

05

+POI[ip];

dNdQ[2] 0.5 + POI[ip];

XX= X0 + POI[ip]*0.50*DL;

Area= A1*XX + A2;

if(Area<=

0)

{if(Area< 0.) {

fprintf(stderr, "ERROR: Area<0: ¥n");

return -1;

} Jacobi=fabs(dNdQ[0]*X1

+dNdQ[1]*X2

+dNdQ[2]*X3);

Jacobi

fabs(dNdQ[0]*X1 +

dNdQ[1]*X2 + dNdQ[2]*X3);

Ck= Area*Young/Jacobi;

Emat[0][0]= Emat[0][0] + Ck * WEI[ip] * dNdQ[0] * dNdQ[0];

Emat[0][1]= Emat[0][1] + Ck * WEI[ip] * dNdQ[0] * dNdQ[1];

Emat[0][2]= Emat[0][2] + Ck * WEI[ip] * dNdQ[0] * dNdQ[2];

Emat[1][0]=Emat[1][0]

+Ck*

WEI[ip]

*dNdQ[1]*

dNdQ[0];

Emat[1][0] Emat[1][0]

Ck * WEI[ip] * dNdQ[1] *

dNdQ[0];

Emat[1][1]= Emat[1][1] + Ck * WEI[ip] * dNdQ[1] * dNdQ[1];

Emat[1][2]= Emat[1][2] + Ck * WEI[ip] * dNdQ[1] * dNdQ[2];

Emat[2][0]= Emat[2][0] + Ck * WEI[ip] * dNdQ[2] * dNdQ[0];

Emat[2][1]= Emat[2][1] + Ck * WEI[ip] * dNdQ[2] * dNdQ[1];

Emat[2][2]=Emat[2][2]

+Ck*

WEI[ip]

*dNdQ[2]*

dNdQ[2];

Emat[2][2] Emat[2][2]

Ck

WEI[ip]

dNdQ[2]

dNdQ[2];

}

Page 37: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

137

Der

ivat

ives

at G

auss

ian

Qua

d. P

oint

s•

Der

ivat

ive

of S

hape

ξ=

+1

13

2

ξ=-1

ξ=0

Func

tions

13

()

()

ξξ

ξ+

=1

1N

ξξ

+−

=21

1

ddN()

()

()

()(

ξξ

ξξ

ξ

−+

=

+−

=

11

12

21

NN

ξξξ

−=

22

2

ddNd

()

()

ξξ

ξ+

=1

213

ξξ

+=

213

ddNd ξ2

d

⎥⎥⎤

⎢⎢⎡

⎥⎥⎤

⎢⎢⎡∂∂

∂∂∂∂

∂∂∂∂

∂∂N

NN

NN

N3

12

11

1

ξξ

ξξ

ξξ

()

∑ ==

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

∂∂

∂∂

∂∂

∂∂∂∂

∂∂∂∂

∂∂∂∂

∂∂

∂∂

∂∂

⋅=

m kk

kA

NN

NN

NN

NN

NN

NN

Jw

EEm

atk

1

33

23

13

32

22

12

||1

][

ξξ

ξξ

ξξ

ξ

ξξ

ξξ

ξξ

ξξ

=⎥⎥ ⎦

⎢⎢ ⎣⎥⎥ ⎦

⎢⎢ ⎣∂

∂∂

∂∂

∂k

ξξ

ξξ

ξξ

ξξ

Valu

es a

t Gau

ssia

n Q

uad

Poi

nts

(ξk)

Page 38: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

138

Exa

mpl

e (6

/7):

Mat

rix (2

/3)

p(

)(

)for(ip=0;ip<2;ip++){

dNdQ[0]= -0.5 + POI[ip];

dNdQ[1]= -2.0 * POI[ip];

dNdQ[2]=

05

+POI[ip];

LdNdQ[2] 0.5 + POI[ip];

XX= X0 + POI[ip]*0.50*DL;

Area= A1*XX + A2;

if(Area<=

0)

{ξ=

+1ξ=

1ξ=

0

L/2

if(Area< 0.) {

fprintf(stderr, "ERROR: Area<0: ¥n");

return -1;

} Jacobi=fabs(dNdQ[0]*X1

+dNdQ[1]*X2

+dNdQ[2]*X3);

ξ=+1

12

ξ=-1

ξ=0

ξ 1ξ 2

Jacobi

fabs(dNdQ[0]*X1 +

dNdQ[1]*X2 + dNdQ[2]*X3);

Ck= Area*Young/Jacobi;

Emat[0][0]= Emat[0][0] + Ck * WEI[ip] * dNdQ[0] * dNdQ[0];

Emat[0][1]= Emat[0][1] + Ck * WEI[ip] * dNdQ[0] * dNdQ[1];

Emat[0][2]= Emat[0][2] + Ck * WEI[ip] * dNdQ[0] * dNdQ[2];

Emat[1][0]=Emat[1][0]

+Ck*

WEI[ip]

*dNdQ[1]*

dNdQ[0];

XX

: Glo

bal C

oord

inat

e fo

r Gau

ssia

n Q

uad.

Poi

ntA

rea:

Sec

tiona

l Are

a at

XX

Emat[1][0] Emat[1][0]

Ck * WEI[ip] * dNdQ[1] *

dNdQ[0];

Emat[1][1]= Emat[1][1] + Ck * WEI[ip] * dNdQ[1] * dNdQ[1];

Emat[1][2]= Emat[1][2] + Ck * WEI[ip] * dNdQ[1] * dNdQ[2];

Emat[2][0]= Emat[2][0] + Ck * WEI[ip] * dNdQ[2] * dNdQ[0];

Emat[2][1]= Emat[2][1] + Ck * WEI[ip] * dNdQ[2] * dNdQ[1];

Emat[2][2]=Emat[2][2]

+Ck*

WEI[ip]

*dNdQ[2]*

dNdQ[2];

Emat[2][2] Emat[2][2]

Ck

WEI[ip]

dNdQ[2]

dNdQ[2];

}

Page 39: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

1D-P

art2

39

X-C

oord

. or G

auss

ian

Qua

d. P

oint

s 2n

dO

d/Q

dti

El

t2n

d -O

rder

/Qua

drat

ic E

lem

ent

•A

ccor

ding

to d

efin

ition

s of

L

g“is

opar

amet

ric” e

lem

ents

:L/

2()

()

3

XN

X=∑

ξξ

ξ=+1

13

2

ξ=-1

ξ=0

ξξ

()

()

()

()

()

33

22

11

1

XN

XN

XN

XN

Xk

kk

++

=

=∑ =

ξξ

ξ

ξξ

ξ 1ξ 2

()

()

()

121

11

213

22

1X

XX

++

−+

+−

ξξ

ξξ

22

22

32

11

32

XX

XX

XX

+−

+−

+=

ξξ

22

23

12

13

31

XX

XX

XX

X+

=−

++

=Q

ξ

∴ XX= X0 + POI[ip]*0.50*DL;

Page 40: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

140

Exa

mpl

e (6

/7):

Mat

rix (2

/3)

p(

)(

)for(ip=0;ip<2;ip++){

dNdQ[0]= -0.5 + POI[ip];

dNdQ[1]= -2.0 * POI[ip];

dNdQ[2]=

05

+POI[ip];

dNdQ[2] 0.5 + POI[ip];

XX= X0 + POI[ip]*0.50*DL;

Area= A1*XX + A2;

if(Area<=

0)

{(

)3 1

xN

xJa

cobi

ii

ξ∂∂

=∂∂

=∑ =

if(Area< 0.) {

fprintf(stderr, "ERROR: Area<0: ¥n");

return -1;

} Jacobi=fabs(dNdQ[0]*X1

+dNdQ[1]*X2

+dNdQ[2]*X3);

33

22

11

3 1

1

xN

xN

xN

xN

ii

i

i

ξξ

ξξ

ξξ

∂∂+

∂∂+

∂∂=

⎟⎟ ⎠⎞⎜⎜ ⎝⎛∂∂

=∑ =

Jacobi

fabs(dNdQ[0]*X1 +

dNdQ[1]*X2 + dNdQ[2]*X3);

Ck= Area*Young/Jacobi;

Emat[0][0]= Emat[0][0] + Ck * WEI[ip] * dNdQ[0] * dNdQ[0];

Emat[0][1]= Emat[0][1] + Ck * WEI[ip] * dNdQ[0] * dNdQ[1];

Emat[0][2]= Emat[0][2] + Ck * WEI[ip] * dNdQ[0] * dNdQ[2];

Emat[1][0]=Emat[1][0]

+Ck*

WEI[ip]

*dNdQ[1]*

dNdQ[0];

Emat[1][0] Emat[1][0]

Ck * WEI[ip] * dNdQ[1] *

dNdQ[0];

Emat[1][1]= Emat[1][1] + Ck * WEI[ip] * dNdQ[1] * dNdQ[1];

Emat[1][2]= Emat[1][2] + Ck * WEI[ip] * dNdQ[1] * dNdQ[2];

Emat[2][0]= Emat[2][0] + Ck * WEI[ip] * dNdQ[2] * dNdQ[0];

Emat[2][1]= Emat[2][1] + Ck * WEI[ip] * dNdQ[2] * dNdQ[1];

Emat[2][2]=Emat[2][2]

+Ck*

WEI[ip]

*dNdQ[2]*

dNdQ[2];

Emat[2][2] Emat[2][2]

Ck

WEI[ip]

dNdQ[2]

dNdQ[2];

}

Page 41: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

141

Jaco

bian

at G

auss

ian

Qua

d. P

oint

s•

Jaco

bian

ξ=+1

13

2

ξ=-1

ξ=0

()

32

13

3N

NN

NN

xi

∂∂

∂⎟⎟⎞

⎜⎜⎛ ∂∂

∂∑

13

()

33

22

11

11

xx

xx

xN

ii

i

ii

ξξ

ξξ

ξ∂

+∂

+∂

= ⎟⎟ ⎠⎜⎜ ⎝∂

=∂

=∂

∑∑

==

•Ja

cobi

an a

t Gau

ssia

n Q

uad

Poi

nts

(ξk)

Q(ξ

k)

33

22

11

xN

xN

xN

ξξ

ξ∂∂

+∂∂

+∂∂

=∂∂

kk

kk

ξξ

ξξ

ξξ

ξξ

ξξ

ξξ

==

==

∂∂

∂∂

Page 42: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

142

Exa

mpl

e (6

/7):

Mat

rix (2

/3)

p(

)(

)for(ip=0;ip<2;ip++){

dNdQ[0]= -0.5 + POI[ip];

dNdQ[1]= -2.0 * POI[ip];

dNdQ[2]=

05

+POI[ip];

⎥⎥⎤

⎢⎢⎡⎥⎤

⎢⎡∂∂

∂∂∂∂

∂∂∂∂

∂∂N

NN

NN

N3

12

11

1

ξξ

ξξ

ξξ

dNdQ[2] 0.5 + POI[ip];

XX= X0 + POI[ip]*0.50*DL;

Area= A1*XX + A2;

if(Area<=

0)

{

()

∑ ==

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

∂∂

∂∂

∂∂

∂∂∂∂

∂∂∂∂

∂∂∂∂

∂∂

∂∂

∂∂

⋅=

m kk

kA

NN

NN

NN

NN

NN

NN

Jw

EEm

atk

1

33

23

13

32

22

12

||1

][

ξξ

ξξ

ξξ

ξ

ξξ

ξξ

ξξ

ξξ

if(Area< 0.) {

fprintf(stderr, "ERROR: Area<0: ¥n");

return -1;

} Jacobi=fabs(dNdQ[0]*X1

+dNdQ[1]*X2

+dNdQ[2]*X3);

=⎥⎥ ⎦

⎢⎢ ⎣⎥⎥ ⎦

⎢⎢ ⎣∂

∂∂

∂∂

∂k

33

23

13

ξξ

ξξ

ξξ

ξξ

Jacobi

fabs(dNdQ[0]*X1 +

dNdQ[1]*X2 + dNdQ[2]*X3);

Ck= Area*Young/Jacobi;

Emat[0][0]= Emat[0][0] + Ck * WEI[ip] * dNdQ[0] * dNdQ[0];

Emat[0][1]= Emat[0][1] + Ck * WEI[ip] * dNdQ[0] * dNdQ[1];

Emat[0][2]= Emat[0][2] + Ck * WEI[ip] * dNdQ[0] * dNdQ[2];

Emat[1][0]=Emat[1][0]

+Ck*

WEI[ip]

*dNdQ[1]*

dNdQ[0];

Emat[1][0] Emat[1][0]

Ck * WEI[ip] * dNdQ[1] *

dNdQ[0];

Emat[1][1]= Emat[1][1] + Ck * WEI[ip] * dNdQ[1] * dNdQ[1];

Emat[1][2]= Emat[1][2] + Ck * WEI[ip] * dNdQ[1] * dNdQ[2];

Emat[2][0]= Emat[2][0] + Ck * WEI[ip] * dNdQ[2] * dNdQ[0];

Emat[2][1]= Emat[2][1] + Ck * WEI[ip] * dNdQ[2] * dNdQ[1];

Emat[2][2]=Emat[2][2]

+Ck*

WEI[ip]

*dNdQ[2]*

dNdQ[2];

Emat[2][2] Emat[2][2]

Ck

WEI[ip]

dNdQ[2]

dNdQ[2];

}

Page 43: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

143

Exa

mpl

e (7

/7):

Mat

rix (3

/3)

Sam

e pr

oced

ures

in “1

d2.c

”Diag[in1]= Diag[in1] + Emat[0][0];

Di

[i2]

Di

[i

2]

Et[1][1]

Diag[in2]= Diag[in2] + Emat[1][1];

Diag[in3]= Diag[in3] + Emat[2][2];

if (icel==0){k12=Index[in1];

k13=Index[in1]+1;

}l

{k12

Id

[i

1]2

}else {k12=In

dex[in1]+2;

k13=Index[in1]+3;}

k21=Index[in2];

k23=Index[in2]+1;

in3

in1

icelin2

k31=Index[in3];

k32=Index[in3]+1;

AMat[k12]= AMat[k12] + Emat[0][1];

AMt[k13]

AMt[k13]

Et[0][2];

in3

in1

in2

AMat[k13]= AMat[k13]

+ Emat[0][2];

AMat[k21]= AMat[k21] + Emat[1][0];

AMat[k23]= AMat[k23] + Emat[1][2];

AMat[k31]= AMat[k31] + Emat[2][0];

AMat[k32]= AMat[k32] + Emat[2][1];

}}

⎥⎤⎢⎡−

2321

1312

kk

kk

1stro

w: c

orre

spon

ds to

in1

⎥⎥⎥ ⎦⎢⎢⎢ ⎣

−− 32

3123

21k

kk

k2n

dro

w: c

orre

spon

ds to

in2

3rd

row

: cor

resp

onds

to in

3

Page 44: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

144

Exa

mpl

e (7

/7):

Mat

rix (3

/3)

Sam

e pr

oced

ures

in “1

d2.c

”Diag[in1]= Diag[in1] + Emat[0][0];

Di

[i2]

Di

[i

2]

Et[1][1]

Diag[in2]= Diag[in2] + Emat[1][1];

Diag[in3]= Diag[in3] + Emat[2][2];

if (icel==0){k12=Index[in1];

k13=Index[in1]+1;

}l

{k12

Id

[i

1]2

}else {k12=In

dex[in1]+2;

k13=Index[in1]+3;}

k21=Index[in2];

k23=Index[in2]+1;

in3

in1

icelin2

k31=Index[in3];

k32=Index[in3]+1;

AMat[k12]= AMat[k12] + Emat[0][1];

AMt[k13]

AMt[k13]

Et[0][2];

in3

in1

in2

AMat[k13]= AMat[k13]

+ Emat[0][2];

AMat[k21]= AMat[k21] + Emat[1][0];

AMat[k23]= AMat[k23] + Emat[1][2];

AMat[k31]= AMat[k31] + Emat[2][0];

AMat[k32]= AMat[k32] + Emat[2][1];

}}

⎥⎤⎢⎡−

2321

1312

kk

kk

1stro

w: c

orre

spon

ds to

in1

⎥⎥⎥ ⎦⎢⎢⎢ ⎣

−− 32

3123

21k

kk

k2n

dro

w: c

orre

spon

ds to

in2

3rd

row

: cor

resp

onds

to in

3

Page 45: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Rep

ort-0

14545

Win

ter S

emes

ter:

Par

alle

l FE

MTe

chni

cal &

Sci

entif

ic C

ompu

ting

IIS

emin

ar o

n C

ompu

ter S

cien

ce II

p

•C

onte

nts

–P

aral

lel P

rogr

amm

ing

usin

g M

PI

–D

ata

Stru

ctur

e fo

r Par

alle

l FE

M–

Impl

emen

tatio

n of

Par

alle

l FE

M–

Exe

rcis

es u

sing

T2K

Ope

n-S

uper

com

pute

r (To

kyo)

•“P

aral

leliz

e”fe

m3d

code

for3

Dst

atic

linea

r-el

astic

Par

alle

lize

fem

3d c

ode

for 3

D s

tatic

line

arel

astic

pr

oble

ms

in th

is s

emes

ter.

Page 46: p ort #1 Exam r Semeste Nakajima Technical & Scientific ...

Tech

nica

l & S

cien

tific

Com

putin

g I,

II (F

inite

Ele

men

t Met

hod)

Rep

ort-0

1

•In

stru

ctor

: Ken

goN

akaj

ima

•G

radu

ate

Leve

l•

Sem

este

r & C

redi

tsI

S2

Cdi

t

Sum

mer

(I)

1.Fu

ndam

enta

l The

ory’

s fo

r FE

M,

Sta

tic L

inea

r-Ela

stic

Pro

blem

–I :

Sum

mer

, 2-C

redi

ts–

II: W

inte

r, 2-

Cre

dits

•O

verv

iew

2.FE

M b

y G

aler

kin

Met

hod

3.S

pars

e Li

near

Sol

vers

, P

reco

nditi

oner

s•

Ove

rvie

w–

(I): F

unda

men

tal i

ssue

s of

fini

te-e

lem

ent m

etho

d (F

EM

) on

stat

ic li

near

-ela

stic

pro

blem

s, in

clud

ing

linea

r eq

uatio

n so

lver

s an

d pr

ogra

mm

ing.

(II)

Dt

tt

fll

lFE

Mi

lt

tif

4.FE

M P

rogr

amm

ing

–1D

, 3D

5.E

CC

S 2

008

Sys

tem

of I

TC–

(II):

Dat

a st

ruct

ure

for p

aral

lel F

EM, i

mpl

emen

tatio

n of

pa

ralle

l FE

M, f

ram

ewor

k fo

r dev

elop

men

t of p

aral

lel

code

s, s

uch

as “H

PC

-MW

” and

“ppO

pen-

HP

C” w

ith

T2K

Ope

n-S

uper

com

pute

r (To

kyo)

S&

Win

ter (

II)1.

Par

alle

l Pro

gram

min

g us

ing

MP

I–

Stro

ng c

olla

bora

tions

bet

wee

n sc

ienc

e &

en

gine

erin

g, c

ompu

ter s

cien

ce a

nd n

umer

ical

al

gorit

hms

are

requ

ired

tow

ards

suc

cess

of l

arge

-sc

ale

scie

ntifi

c si

mul

atio

ns u

sing

par

alle

l G

lf

hl

ih

d

gg

g2.

Dat

a S

truct

ure

for P

aral

lel F

EM

3.Im

plem

enta

tion

of P

aral

lel F

EM

4.Fr

amew

ork

for D

evel

o pm

ent o

f co

mpu

ters

. Goa

l of t

hese

cla

sses

is th

at s

tude

nts

of g

radu

ate

scho

ol o

f inf

orm

atio

n sc

ienc

e an

d te

chno

logi

es u

nder

stan

d re

quire

men

t of

appl

icat

ions

and

try

to d

evel

op n

ew

it

dii

lih

pP

aral

lel S

imul

atio

n C

odes

usi

ng

Larg

e-sc

ale

Sys

tem

s5.

T2K

Ope

n-S

uper

com

pute

r (To

kyo)

46

inte

rdis

cipl

inar

y re

sear

ch a

rea.

Gra

de b

ased

on

repo

rts