CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Harmonic Boundary Condition (noob Fortran question)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2018, 19:08
Question Harmonic Boundary Condition (noob Fortran question)
  #1
New Member
 
Fredh
Join Date: Dec 2014
Posts: 2
Rep Power: 0
Fredh is on a distinguished road
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...
Fredh is offline   Reply With Quote

Old   August 30, 2018, 19:19
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
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???
FMDenaro is offline   Reply With Quote

Old   August 31, 2018, 12:08
Default
  #3
agd
Senior Member
 
Join Date: Jul 2009
Posts: 358
Rep Power: 19
agd is on a distinguished road
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?
agd is offline   Reply With Quote

Old   September 2, 2018, 11:24
Default
  #4
New Member
 
Fredh
Join Date: Dec 2014
Posts: 2
Rep Power: 0
Fredh is on a distinguished road
I think I found the problem, I was trying to set the boundary conditions before the temperature field, gonna try to fix it, thanks!
Fredh is offline   Reply With Quote

Reply

Tags
code, fortran 90, loop, mesh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
Problem in setting Boundary Condition Madhatter92 CFX 12 January 12, 2016 05:39
Time dependant pressure boundary condition yosuke1984 OpenFOAM Verification & Validation 3 May 6, 2015 07:16
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05
a simple Boundary condition question prapanj OpenFOAM Running, Solving & CFD 1 March 16, 2009 08:51


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