CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] calculate nusselt with swak4Foam (https://www.cfd-online.com/Forums/openfoam-community-contributions/98483-calculate-nusselt-swak4foam.html)

nimasam March 12, 2012 08:45

calculate nusselt with swak4Foam
 
Hi dear friends
im interested to use swak4Foam to calculate Nusselt along a patch.
is there any option to calculate patch gradient in swak4Foam?

gschaider March 12, 2012 09:40

Quote:

Originally Posted by nimasam (Post 348938)
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)

nimasam March 13, 2012 06:55

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?

gschaider March 13, 2012 17:54

Quote:

Originally Posted by nimasam (Post 349133)
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

nimasam May 13, 2012 01:32

Quote:

Originally Posted by gschaider (Post 349292)
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?

gschaider May 14, 2012 17:17

Quote:

Originally Posted by nimasam (Post 360760)
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.

maalan September 5, 2013 11:37

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??

gschaider September 5, 2013 14:19

Quote:

Originally Posted by maalan (Post 450101)
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

maalan September 6, 2013 03:54

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!

gschaider September 6, 2013 06:43

Quote:

Originally Posted by maalan (Post 450165)
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 (Post 450165)
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


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