CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

cyclic boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 4, 2014, 03:54
Default cyclic boundary condition
  #1
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
Dear OpenFoamer,

I've tried to write this cyclic or periodic boundary condition code by myself. For the velocity between two connected surface, I use the transformation matrix to change the direction of velocity. In order to calculate this matrix, the normal and tangent vectors of surface should be inputted. For instance,

nA = [-sin(theta_A), cos(theta_A), 0.0]
t1A = [cos(theta_A), sin(theta_A), 0.0]

however, there is certain error between real value of nA and calculated one. if theta_A = 30 degree. cos(theta_A) should be equal to sqrt(3)/2, but for the double type value in C++, the calculated result of cos(theta_A) is slightly different from real value, and then make the mass flux through two connected surfaces different.

So how can I fix this bug?

Thanks in advance
nwpukaka is offline   Reply With Quote

Old   March 4, 2014, 07:39
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22
jherb is on a distinguished road
The C++ functions use radians angle values: http://www.cplusplus.com/reference/cmath/cos/
jherb is offline   Reply With Quote

Old   March 4, 2014, 20:59
Default
  #3
Member
 
Kan
Join Date: Feb 2014
Location: Australia
Posts: 54
Rep Power: 12
nwpukaka is on a distinguished road
Quote:
Originally Posted by jherb View Post
The C++ functions use radians angle values: http://www.cplusplus.com/reference/cmath/cos/
Hi jherb,

I did use radian angle in my calculation.

Thanks
nwpukaka is offline   Reply With Quote

Old   March 9, 2014, 06:59
Default
  #4
New Member
 
Tenglubao
Join Date: Feb 2013
Posts: 5
Rep Power: 13
philocfd is on a distinguished road
Maybe,you can try" Foam::sin(theta_A)"
philocfd is offline   Reply With Quote

Reply


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
Understanding the cyclic boundary condition leroyv OpenFOAM Running, Solving & CFD 10 May 31, 2020 10:05
mixed inflow/outflow downstream boundary condition question peob OpenFOAM Running, Solving & CFD 3 February 3, 2017 11:54
cyclic boundary condition flotran OpenFOAM 3 December 19, 2011 21:13
can I use cyclic boundary condition to modeling axisymmetric flow ? mechy OpenFOAM 0 July 8, 2011 15:16
cyclic boundary condition doesn't work in a tube ?? Cyp OpenFOAM 6 April 16, 2010 16:21


All times are GMT -4. The time now is 21:45.