12
ULUG 내내내내내 내내내내 HLUG 임 임 임 Numerical Method

Numerical Method

  • Upload
    ulug

  • View
    165

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Numerical Method

ULUG 내부세미나 발표자료

HLUG 임 준 형

Numerical Method

Page 2: Numerical Method

Numerical Methods 란 ?

Numerical Modthod 란 컴퓨터를 이용하여 복잡하고 어려운 수학 문제를 푸는 것 입니다

오늘 발표하고자 하는 열전달이라는 분야에서는 비선형 문제라던 지 , 복잡한 형상을 갖는다던 지 , 복잡한 경계조건을 갖는 문제를 푸는데 아주 유용합니다

Page 3: Numerical Method

격자란 주어진 문제의 domain 을 node 로 구분해 놓은 것 이다

격자

Page 4: Numerical Method
Page 5: Numerical Method

Heat Transfer

1 차원의 정상상태의 길이가 L 인 domain 에서 전도가 일어나는 것 을 표현하면 다음과 같습니다

Energy-in + Energy-generation= Energy-out + Energy-storage

Page 6: Numerical Method

Heat Transfer

전도 계수A : 넓이 dx : 단위 길이dt : 온도변화A : 면적

Page 7: Numerical Method

Heat Transfer

Energy Generation 이 없다고 가정하면

𝑇𝑚=𝑇𝑚−1+𝑇𝑚+1

2

Page 8: Numerical Method

Heat Transfer

𝑇𝑚 ,𝑛=𝑇𝑚− 1 ,𝑛+𝑇𝑚+1 ,𝑛

2

𝑇𝑚 ,𝑛=𝑇𝑚 ,𝑛−1+𝑇𝑚 ,𝑛+1

2

𝑇𝑚 ,𝑛=𝑇𝑚− 1 ,𝑛+𝑇𝑚+1 ,𝑛+𝑇𝑚 ,𝑛−1+𝑇𝑚 ,𝑛+1

4

Page 9: Numerical Method

30℃ 100℃

100

10

Page 10: Numerical Method

#include <stdio.h>#include <math.h>#define a 100//number of grids on a single side#define b 10//number of grids on a single side#define MAXIT 10000#define error 0.0001int main(void){ double G[a][b]={0};int i=0,j=0,k=0;double t1=30, t2=100.0;double old=0;FILE *I=fopen("output.txt","w");

for(i=0;i<b;i++){G[0][i]=t1;G[a-1][i]=t2;}for(k=0;k<MAXIT;k++){old=G[1][1];for(i=1; i<a-1; i++){for(j=0;j<b;j++) {if(j==0)G[i][j]=(G[i-1][j]+G[i+1][j]+G[i][j+1])/3; else if(j==(b-1))G[i][j]=(G[i-1][j]+G[i+1][j]+G[i][j-1])/3;

Page 11: Numerical Method

elseG[i][j]=(G[i-1][j]+G[i+1][j]+G[i][j+1]+G[i][j-1])/4;}}if(old-G[1][1]<error&&G[1][1]-old<error)break;}for(i=0; i<a; i++){for(j=0;j<b;j++)printf("%3.2f ",G[i][j]);printf("\n",i);}

for(i=0;i<a;i++){for(j=0;j<b;j++) fprintf(I,"%3.2f  ",G[i][j]);fprintf(I,"\n");} }

Page 12: Numerical Method