...!Opening files in Matlab
!Initial Conditions
x(0)= 0
x(JI)= 1.0
y(0)= 0
y(NI)= SQRT(3.0)
do i=0,JI
do j=0,NI
x(i)= i*h ! x-axix, x starts from 0 to 1
y(j)= j*h ! y-axis y starts from 0 to SQRT(3.0)
u(i,j)= 0 ! Entire Boundary is zero
end do
end do
while (error .GT. tolerence)...
...!Opening files in Matlab
!Initial Conditions
x(0)= 0
x(JI)= 1.0
y(0)= 0
y(NI)= SQRT(3.0)
do i=0,JI
do j=0,NI
x(i)= i*h ! x-axix, x starts from 0 to 1
y(j)= j*h ! y-axis y starts from 0 to SQRT(3.0)
u(i,j)= 0 ! Entire Boundary is zero
end do
end do
while (error .GT. tolerence)...
dear franc, i checked my output with my lectures and he told me it is correct. i just to plot the output in the matlab. i want to plot the value of u(i,j) between interval of both -1<x<1 and -1<y<1. since it is 3-d ,i getting problems to plot u values correctly between the x and y intervals by...
Here is my output, when i enter the space size=10, and the final space size =1, That gives h=0.1 for both directions x and y
ApproximateSolution =
x-axis y-axis u(i,j)
[ -1.00000 -1.00000 0.00000
-0.900000 -0.900000 2.500000E-03...
I think this is not correct too
! The Entire Boundary Conditions
u(0,1)=0 !West u(i-1,j), x direction
u(2,1)=0 ! East u(i+1,j), x direction
u(1,2)=0 !North u(i,j+1), y direction
u(1,0)=0 !South u(i,j-1), y direction
because The Entire Boundary Conditions of u=0, when i=1, j=1...
In question Sorry the elliptic equation is - u_xx - u_yy = 1 instead of u_xx - u_yy=1, there is - sign missing infront of u_xx.
And same for the poisson euqation : - u_xx - u_yy = 1
...1 not laplace equations, by using Jacobi iterative method for solving linear systems such as
A*u= b
u= A^(-1)*b
Where b is the right hand side, u is unknown and A is matrix
For this, we use a sequence u^(k)...
Treating the case
D(u)=1 when x<1/2
D(u)=1/2 When x>1/2 (otherwise)
I need to use if statement:
if (-1+j*dx >1/2) then
.....
end if ..
but not sure where to put and there might other codes I need to add to get discontinuity when x>1/2 at D(u)=1/2
and from get the values of u(j) values and...
Francios Jacq, Its a different question but just need to need the previous code to solve this new questions. As fae as Im concerned, this code is working perfectly.
...normal code:
program crank_nicolson
implicit none
real, allocatable :: x(:),u(:),a(:),b(:),c(:),d(:)
real:: m,dx,dt,tmax
integer:: j,ni,ji
print*, 'enter the total number of time steps'
read*, ni
print*, 'enter the final time'
read*, tmax
dt=tmax/ni !the size of timestep
print*, 'this...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.