# calculate nusselt with swak4Foam

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 March 12, 2012, 09:45 calculate nusselt with swak4Foam #1 Senior Member   Nima Sam Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,123 Blog Entries: 1 Rep Power: 14 Hi dear friends im interested to use swak4Foam to calculate Nusselt along a patch. is there any option to calculate patch gradient in swak4Foam?

March 12, 2012, 10:40
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
Quote:
 Originally Posted by nimasam Hi dear friends im interested to use swak4Foam to calculate Nusselt along a patch. is there any option to calculate patch gradient in swak4Foam?
Have a look at http://openfoamwiki.net/index.php/Co...her_field_are: (I think snGrad is what you're looking for)

March 13, 2012, 07:55
#3
Senior Member

Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
Quote:
 functions ( NusseltNumber { type patchExpression; patches ( down ); verbose true; variables ( "Tsat=500;" "lc2D=0.0786;" ); expression "lc2D*snGrad(T)/(T-Tsat)"; accumulations ( max min average ); } );
the last question, how i can save it as a patch value for all patch faces! not just max, min or average value?

March 13, 2012, 18:54
#4
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
Quote:
 Originally Posted by nimasam the last question, how i can save it as a patch value for all patch faces! not just max, min or average value?
Depends on what you want to do. There is a dumpSwakExpression-functionObject. That dumps all the values. The order is the order of the faces in the patch. So to make sense of this you've got to know that

If you want postprocess the boundary values in paraview then the best guess is to use the readFields-FO that comes with OpenFOAM to read a field that defines a groovyBC with that expression

May 13, 2012, 01:32
#5
Senior Member

Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
Quote:
 Originally Posted by gschaider Depends on what you want to do. There is a dumpSwakExpression-functionObject. That dumps all the values. The order is the order of the faces in the patch. So to make sense of this you've got to know that
i did it,
Quote:
 If you want postprocess the boundary values in paraview then the best guess is to use the readFields-FO that comes with OpenFOAM to read a field that defines a groovyBC with that expression
yes i want it for postProcessing in paraView, so tell me how i can manage it?

May 14, 2012, 17:17
#6
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
Quote:
 Originally Posted by nimasam i did it, yes i want it for postProcessing in paraView, so tell me how i can manage it?
Well. You need a field file where the boundary condition is set to the expression you want to visualize. The internalField and the "uninteresting" BCs can be uniform (or zeroGradient for the patches). Then in the input panel of the reader (whichever of the both you use) select in addition to the internalField the patch you're interested in. With the "Extract Block"-filter select that patch and visualize it in any way you see fit.

The "interesting" part is getting the patch field. Currently not sure how to do that in a functionObject. One way would be to write a field where the expression is "written" in a groovyBC in the initial timestep and then run the replayTransientBC-utility on it. The other would be to write a similar file but with a fixedValue-BC and then use funkySetBoundaryField to set the value-entry. The advantage of the second approach is that it works for the initial timestep as well.

September 5, 2013, 11:37
#7
Member

Join Date: Jun 2011
Posts: 65
Rep Power: 6
Hi!

Quote:
 Have a look at http://openfoamwiki.net/index.php/Co...her_field_are: (I think snGrad is what you're looking for)
Is there any function to calculate the curl(U) on a patch??

September 5, 2013, 14:19
#8
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
Quote:
 Originally Posted by maalan Hi! Is there any function to calculate the curl(U) on a patch??
No. I've explained it several times before: differential operators can only be calculated for the whole field at once and I don't want to trigger a calculation on thousands (millions) of cells just to update a few hundred faces, If a user wants that he should create that field with an expressionField-functionObject (curlU for instance) and then use it in his BC. Only downside is that this only happens at the end of the time-step. So for a solver that does several loops per timestep it might be inaccurate. But if it is for a patchExpression, swakExpression it shouldn't be a problem
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

September 6, 2013, 03:54
#9
Member

Join Date: Jun 2011
Posts: 65
Rep Power: 6
Quote:
 No. I've explained it several times before: differential operators can only be calculated for the whole field at once and I don't want to trigger a calculation on thousands (millions) of cells just to update a few hundred faces, If a user wants that he should create that field with an expressionField-functionObject (curlU for instance) and then use it in his BC. Only downside is that this only happens at the end of the time-step. So for a solver that does several loops per timestep it might be inaccurate. But if it is for a patchExpression, swakExpression it shouldn't be a problem
Thanks for your reply bernhard, although I have looked for it and find nothing!!
In fact, I meant calculate the curl(U) by using functionObjects. So, if I try to calculate the curl(U) just in the patch I get this error:

Code:
```--> FOAM FATAL ERROR:
Parser Error for driver PatchValueExpressionDriver at "1.1-4" :"field curl not existing or of wrong type"
"curl(U)"
^^^^
--|```
I assume you mean calculate and store the curl(U) in the volume by means of an expressionField and then use the stored e.g. 'curlU' in the expression within the patchExpresion, isn't it?? In this way it works though I was not very sure of being right.

On the other hand, for a surface integral on a patch, always by using swakExpressions, should I use 'mag(Sf())' as 'dS' term as in the volume one I use 'vol()' as 'dV'??

Thank you very much!

September 6, 2013, 06:43
#10
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
Quote:
 Originally Posted by maalan Thanks for your reply bernhard, although I have looked for it and find nothing!! In fact, I meant calculate the curl(U) by using functionObjects. So, if I try to calculate the curl(U) just in the patch I get this error: Code: ```--> FOAM FATAL ERROR: Parser Error for driver PatchValueExpressionDriver at "1.1-4" :"field curl not existing or of wrong type" "curl(U)" ^^^^ --|``` I assume you mean calculate and store the curl(U) in the volume by means of an expressionField and then use the stored e.g. 'curlU' in the expression within the patchExpresion, isn't it?? In this way it works though I was not very sure of being right.
That's exactly what I said with
"expressionField-functionObject (curlU for instance) and then use it in his BC"
(it may be a bit brief but as my time is limited I expect people to at least spend as much time reading the stuff as it took me to write it. Arrogant, I know. But that's me)

Quote:
 Originally Posted by maalan On the other hand, for a surface integral on a patch, always by using swakExpressions, should I use 'mag(Sf())' as 'dS' term as in the volume one I use 'vol()' as 'dV'?? Thank you very much!
I'm not aware of vol() being implemented for patches. An exhaustive list of functions defined on patches can be found in Documentation/swakReference. Or an incomplete (but still valid) list for functions on patches at http://openfoamwiki.net/index.php/Contrib_groovyBC
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 Tags nusselt, patch gradient, swak4foam

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post nimasam OpenFOAM 1 March 1, 2012 15:10 Kalas OpenFOAM Post-Processing 1 February 3, 2012 05:18 SeRGeiSarov Main CFD Forum 4 May 6, 2009 01:57 prayskyer CFX 2 June 19, 2006 01:24 prayskyer Main CFD Forum 0 June 17, 2006 20:57

All times are GMT -4. The time now is 09:50.

 Contact Us - CFD Online - Top