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

DirectionMixed mixed bc

Register Blogs Community New Posts Updated Threads Search

Like Tree78Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2011, 11:06
Default
  #21
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Nicolas,

I am not too familiar with writing a boundary condition but I think you can call the mother constructor to set gradients etc (see $FOAM_SOLVERS/newStressAnalysis/materialModels/fvPatchFields/tractionDisplacement/tractionDisplacementFvPatchVectorField.C in OpenFOAM-1.6-ext which is derived from fixedGradient).

Philip
nlc and Sherlock_1812 like this.
bigphil is offline   Reply With Quote

Old   October 20, 2011, 11:35
Default
  #22
nlc
Member
 
nlc's Avatar
 
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 61
Rep Power: 17
nlc is on a distinguished road
Great example Tanks
nlc is offline   Reply With Quote

Old   February 5, 2012, 09:35
Default
  #23
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
AlmostSurelyRob will become famous soon enough
I would like to implement Newton's law of cooling. This is a type of Robin boundary condition, which is specified by

\frac{\partial T}{\partial n} = -(h A/k) (T_w - T_{ref})

where h, A, k are problem constants, n is the normal to the boundary and T is the temperature. The subscript w, means wall temperature and ref is the reference ambient temperature.

I would be happy to implement and test this, but I would need to understand the code a little bit more. Can mixed boundary condition simulate that kind of behaviour?

Essentially I would like to have a basic BC that allows to specify a b and g as described here:
http://en.wikipedia.org/wiki/Robin_boundary_condition

I would be obliged for any hints.
AlmostSurelyRob is offline   Reply With Quote

Old   February 5, 2012, 10:47
Default
  #24
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
AlmostSurelyRob will become famous soon enough
Right... I think I've answered my questions now, although as a "home-grown" user and programmer of OF I will always appreciate any help and comments.

After analysis of the code in fixedGradient, fixedValue and mixed, I came to a conclusion that for my BC I need to express the functions snGrad and evaluate. One way to do it, is

  1. express the T_w in snGrad as T_p + \frac{\partial T}{\partial n} and do a bit of juggling with terms.
  2. express T_w in evaluate as T_p + approximation of gradient from neighbouring cells.
T_p is the internal value.


Is there anything else I should keep in mind? I don't quite understand what's the purpose of XCoeffs functions. Do I need to make alterations there as well?

Is it off-topic? Should I post in developers forum?
AlmostSurelyRob is offline   Reply With Quote

Old   February 5, 2012, 16:47
Default
  #25
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 256
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
Hi Robert,

an explanation how to use modified mixed BC for your equation see
the post http://www.cfd-online.com/Forums/ope...tml#post295694
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   February 5, 2012, 19:37
Default
  #26
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
AlmostSurelyRob will become famous soon enough
Thank you very much for the reply. Yes, I was actually thinking of expressing the equations in terms of the blending coefficient, but for some reason I thought it will not be possible. Clearly, I was wrong.

Incidentally, I've written my version of robinBC which evaluates the face value in exactly the same way. It calculates the gradient in a similar manner. It is a 1st order approximation. However, I have not touched XCoeff functions as I am still not sure what they do and my robinBC is not tested. The only positive is that it doesn't diverge when I run it with my case.

Now I could test it against this setting of mixed BC.

Many thanks.
AlmostSurelyRob is offline   Reply With Quote

Old   February 5, 2012, 19:42
Default
  #27
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 256
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
The XCoeff (nice name:-)) functions update your diagonal elements of the linear system which you solve after all based on the BC type. And it uses either your value representation at the boundary for let's say convectional terms or gradient treatment for your diffusion terms.
__________________
Best regards,

Dr. Alexander VAKHRUSHEV

Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics"

Simulation and Modelling of Metallurgical Processes
Department of Metallurgy
University of Leoben

http://smmp.unileoben.ac.at
makaveli_lcf is offline   Reply With Quote

Old   February 6, 2012, 06:55
Default
  #28
Senior Member
 
Robert Sawko
Join Date: Mar 2009
Posts: 117
Rep Power: 22
AlmostSurelyRob will become famous soon enough
Thanks again. The main advantage of my implementation, if it proves to work, should be an easier definition of the transfer coefficient. The mixed BC "hack" requires to specify delta which is the first cell centroid wall distance. I would like to get rid of that!
AlmostSurelyRob is offline   Reply With Quote

Old   June 18, 2012, 14:21
Default hi
  #29
New Member
 
moon
Join Date: Feb 2012
Posts: 26
Rep Power: 14
moun139 is on a distinguished road
how about mixed boundary condition in FLUENT code ,please ?

thank you
moun139 is offline   Reply With Quote

Old   July 31, 2012, 12:56
Default
  #30
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Dear Bigphil

I tried your method to customize directionMixed BC but I could not compile my code.
I got following errors:

error: ‘directionMixedFvPatchVectorField’ was not declared in this scope
error: ‘loadingIndex’ was not declared in this scope
error: ‘const class Foam:olyPatch’ has no member named ‘faceCentre’

Do you know maybe what can be reason for that ?
Currently I am using 2.1.0 OpenFOAM.

Do you know maybe if it is possible to use groovyBC it this case ?

Best and thank you
ZM
ziemowitzima is offline   Reply With Quote

Old   July 31, 2012, 13:03
Default
  #31
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Dear Bigphil

I tried your method to customize directionMixed BC but I could not compile my code.
I got following errors:

error: ‘directionMixedFvPatchVectorField’ was not declared in this scope
error: ‘loadingIndex’ was not declared in this scope
error: ‘const class FoamolyPatch’ has no member named ‘faceCentre’

Do you know maybe what can be reason for that ?
Currently I am using 2.1.0 OpenFOAM.

Do you know maybe if it is possible to use groovyBC it this case ?

Best and thank you
ZM
ziemowitzima is offline   Reply With Quote

Old   July 31, 2012, 13:07
Default
  #32
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi ZM,

Actually there is a small mistake in my previous code snippet:
this line:
Code:
vectorField n = mesh.boundary()[loadingIndex].nf();
should be
Code:
vectorField n = mesh.boundary()[patchID].nf();
and
Code:
const vectorField& patchFaceCentres = mesh.boundaryMesh()[patchID].faceCentre();
should be
Code:
const vectorField& patchFaceCentres = mesh.boundaryMesh()[patchID].faceCentres();
And also, you need to tell your solver about the directionMixed class, so add the following line under #include "fvCFD.H":
Code:
#include "directionMixedFvPatchFields.H"
Philip
nlc, mm.abdollahzadeh and meth like this.
bigphil is offline   Reply With Quote

Old   July 31, 2012, 13:31
Default
  #33
Senior Member
 
Mieszko Młody
Join Date: Mar 2009
Location: POLAND, USA
Posts: 145
Rep Power: 17
ziemowitzima is on a distinguished road
Hi Philip
Thanks a lot !
There is one more error:
error: ‘Foam::directionMixedFvPatchVectorField’ has no member named ‘refGradient’

but I corrected it:
instead:
Upatch.refGradient() = patchFaceCentres * runTime.value();

should be:

Upatch.refGrad() = patchFaceCentres * runTime.value();
Thanks again
-ZM
ziemowitzima is offline   Reply With Quote

Old   July 31, 2012, 13:39
Default
  #34
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Great,

hopefully it'll do what you want.

In answer to your earlier question, I would say that groovy/swak4Foam can more than likely do what you want also, but I have never used it.

Philip
bigphil is offline   Reply With Quote

Old   September 17, 2013, 06:59
Default
  #35
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Greetings.

I have got a fairly clear idea about directionMixed Bc from this thread. Thank you!

I have one question though (may be trivial, but still).

What are the three components of the vector given as input to refGradient in cartesian notations? Example, if refGradient is (-1 0 0) is dv1/dx= -1 or dv1/dz?

How does one assign partial du/dy and/or partial dv/dx alone using this bc?
__________________
Regards,

Srivaths

Last edited by Sherlock_1812; September 18, 2013 at 06:52.
Sherlock_1812 is offline   Reply With Quote

Old   September 18, 2013, 07:59
Default
  #36
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Sherlock_1812 View Post
Greetings.

I have got a fairly clear idea about directionMixed Bc from this thread. Thank you!

I have one question though (may be trivial, but still).

What are the three components of the vector given as input to refGradient in cartesian notations? Example, if refGradient is (-1 0 0) is dv1/dx= -1 or dv1/dz?

How does one assign partial du/dy and/or partial dv/dx alone using this bc?
Hi,

refGradient is (-1 0 0) means:
dvx/dn = -1
dvy/dn = 0
dvz/dn = 0
where vx, vy, vz are the cartesian components of vector field v (e.g. velocity) and n is the patch normal direction.

Keep in mind, the valueFraction will control the fraction of the refValue used and the fraction of the refGradient used.

Philip
bigphil is offline   Reply With Quote

Old   September 18, 2013, 08:06
Default
  #37
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Thank you Philip!
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   September 18, 2013, 14:07
Default
  #38
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Quote:
Originally Posted by bigphil View Post
If your patch faces have all different normals then you will have to set the patch valueFraction in the solver (using refCast etc.) to be symm(n*n).
Hi Philip,

I'm not able to understand what changes are to be made to valueFraction in the above case (using refCast?). I have a curved patch where face normals are different for different faces, so I see that I should do what you've said. My C++ isn't that good. Can you elaborate?

If two faces in a patch have different normals n1 and n2, then the valueFraction is given by symm(n1*n2)? Is this right?

Thanks in advance,
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   September 19, 2013, 06:11
Default
  #39
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,097
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Sherlock_1812 View Post
Hi Philip,
If two faces in a patch have different normals n1 and n2, then the valueFraction is given by symm(n1*n2)? Is this right?
It depends on what condition you want to impose;
in the case where you would like the normal component to be fixedValue and the tangential components to be fixedGradient then you fix the face valueFraction to be symm(n*n) where n is the face normal.

e.g.
if you have a list of faces (f1, f2, f3, …) with face normals (n1, n2, n3, …) then you would set the valueFractions to be symm(n1*n1), symm(n2*n2), symm(n3*n3), …

Philip
bigphil is offline   Reply With Quote

Old   September 19, 2013, 07:51
Default
  #40
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 13
Sherlock_1812 is on a distinguished road
Thank you for your quick reply Philip
__________________
Regards,

Srivaths
Sherlock_1812 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
mixed difference Shuo Main CFD Forum 1 September 3, 2008 02:25
mixed convection sumesh FLUENT 0 March 7, 2008 01:00
Mixed CPU/GPU computing Joe Main CFD Forum 4 September 20, 2006 13:04
Direction mixed bc evgenii OpenFOAM Pre-Processing 1 November 30, 2005 05:37
mixed convection raj calay Main CFD Forum 6 April 21, 1999 23:33


All times are GMT -4. The time now is 19:13.