CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Harmonic Boundary Condition (noob Fortran question) (https://www.cfd-online.com/Forums/main/206165-harmonic-boundary-condition-noob-fortran-question.html)

Fredh August 30, 2018 19:08

Harmonic Boundary Condition (noob Fortran question)
 
Hey guys, I am trying to simulate a steady 2d temperature field for an assignment. I have constant prescribed temperatures on 3 edges of a rectangular mesh but one of them has a sine function that varies with height. I've been trying to code this for a while with no succes, if anyone could help me I would appreciate.


Here's the bit of code I am having trouble with:


!West Boundary
if (i .eq. 2) then
aw = 2*cond*dy/dx

yy(j) = dy
do while (j .lt. m2)
T(2,j) = Tini*sin(pi*yy(j)/a)
yy(j) = yy(j)+dy
end do
end if


!test
write(*,*)"T west = ",T(2,5)



It always returns T west = 0.0000...

FMDenaro August 30, 2018 19:19

Tini is correctly prescribed?


Then, let us start for example at j=2


yy(2) = dy
do while ....
T(2,2) = Tini*sin(pi*yy(2)/a)
yy(2) = yy(2)+dy


T(2,3) = Tini*sin(pi*yy(3)/a)
yy(3) = yy(3)+dy



.....


what about your yy update???

agd August 31, 2018 12:08

My eyes may be getting old but it looks like you have i in the if test and j as the loop index. Are these supposed to be different? Where is the value of i set to get you into the if test block? Where is j incremented?

Fredh September 2, 2018 11:24

I think I found the problem, I was trying to set the boundary conditions before the temperature field, gonna try to fix it, thanks!


All times are GMT -4. The time now is 14:32.