# Numerical simulation of heat conduction equation

Source: Internet
Author: User

`1  Public classheatconduction {2      Public Double[] Conduction (DoubleXDoubleTintIintj) {//i,j represents discrete points separated by x,t3         Double[] XT =New Double[i][j];4         Doubledx=x/(i-1), dt=t/(j-1);5         Doublec=dt/(dx*dx);6          for(intk = 0; K < I; k++) {//u (x,0) Initial value7xt[k][0]=k*dx* (X-K*DX)/x/x;8         }9          for(intk = 0; K < J; k++) {//u (0,t) Initial valueTenXt[0][k]=0; One         } A          for(intk = 0; K < J; k++) {//u (x,t) Initial value -Xt[i-1][k]=0; -         } the          for(intK = 1; K < J; k++) { -              for(intL = 1; L < i-1; l++) { -xt[l][k]=c* (Xt[l-1][k-1]+xt[l+1][k-1]) + (1-2*C) *xt[l][k-1]; -             } +         } -         returnXT; +     } A      at      Public Static voidMain (string[] args) { -Heatconduction heatconduction=Newheatconduction (); -         Double[] XT = heatconduction.conduction (1.0, 1.0, 10, 500); -          for(intj = 0; J < Xt[0].length; J + +) { -              for(inti = 0; i < xt.length; i++) { -                 if(i==xt.length-1) { in System.out.println (Xt[i][j]); -}Else { toSystem.out.print (xt[i][j]+ ""); +                 }     -             } the         } *     } \$}`

Ut=uxx (0<x<l) (0<t<)

U (0,t) =0, U (l,t) =0

U (x,0) =x (l-x)/l2

Numerical simulation of heat conduction equation

Related Keywords:

### Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.