CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Problem with funkySetFields: How to set field on patch? (https://www.cfd-online.com/Forums/openfoam/85660-problem-funkysetfields-how-set-field-patch.html)

DanielPT March 3, 2011 13:53

Problem with funkySetFields: How to set field on patch?
 
Hello,

I have some problems with funkySetFields. I want to set a fully developed velocity profile on my inlet.
But after running funkySetFields -time 0 the file 0/U contains a filed for the whole mesh and my entry for Inlet is even the entry before using FSF.

My funkySetFieldsDict:

surface
{
field U;
expression.....
valuePatches (inlet);
keepPatches 0;
}

Thanks and regards
Daniel

gschaider March 3, 2011 17:44

Quote:

Originally Posted by DanielPT (Post 297824)
Hello,

I have some problems with funkySetFields. I want to set a fully developed velocity profile on my inlet.
But after running funkySetFields -time 0 the file 0/U contains a filed for the whole mesh and my entry for Inlet is even the entry before using FSF.

My funkySetFieldsDict:

surface
{
field U;
expression.....
valuePatches (inlet);
keepPatches 0;
}

Thanks and regards
Daniel

Hmmm. You tried to do it by hand like it is described in http://openfoamwiki.net/index.php/Co...t-Room_Example (BTW: of course you'll need a second expression to clear the internal field). What type is inlet. I think it has to be a fixedValue-patch if FSF should be able to set values there.

Bernhard

PS: for just setting patch-values there is a utility funkySetBoundaryFields in the swak4Foam-suite.

alfa_8C May 5, 2011 05:49

...referring to the last post:

http://www.cfd-online.com/Forums/ope...tml#post306326

Ok, Berhard. Now it works really well!! Thank you.

But there is one further I don't understand so far. If I apply the following expression:

"faceAverage(fpos().z <= surf(3.) ? surf(1.0) : surf(0.))"

the red part determines at which height the free surface will be set - in this case at 3m. This is ok for simply horizontal initial free surfaces.

In the case I want to apply an inital free surface that varies over lenght i.e. along a slope (pic illustrates the problem), I have to insert a linear function f(z)=m*x+n. But the expression doesn't accept this:


"faceAverage(fpos().z <= surf(-m*pos().x+n) ? surf(1.0) : surf(0.))"

Whereas the condition accepts it without any problem.

Is there any solution for this problem?

gschaider May 5, 2011 11:41

Quote:

Originally Posted by alfa_8C (Post 306336)
...referring to the last post:

http://www.cfd-online.com/Forums/ope...tml#post306326

Ok, Berhard. Now it works really well!! Thank you.

But there is one further I don't understand so far. If I apply the following expression:

"faceAverage(fpos().z <= surf(3.) ? surf(1.0) : surf(0.))"

the red part determines at which height the free surface will be set - in this case at 3m. This is ok for simply horizontal initial free surfaces.

In the case I want to apply an inital free surface that varies over lenght i.e. along a slope (pic illustrates the problem), I have to insert a linear function f(z)=m*x+n. But the expression doesn't accept this:


"faceAverage(fpos().z <= surf(-m*pos().x+n) ? surf(1.0) : surf(0.))"

Whereas the condition accepts it without any problem.

Is there any solution for this problem?

What do you mean with "Whereas the condition accepts it without any problem"? In real life of course you use values for m and n?

What is the error message? Without it I can't do much and I don't have the time to test the expressions "by hand"

BTW: If thing the better variant (I'm doing this from memory the syntax might be slightly different) would be in my opinion "<= surf(42.)+fpos().x*surf(13.)" with the values 13 and 42 for m and n

alfa_8C May 6, 2011 09:45

...the problem is solved. Your hint....

BTW: If thing the better variant (I'm doing this from memory the syntax might be slightly different) would be in my opinion "<= surf(42.)+fpos().x*surf(13.)" with the values 13 and 42 for m and n

led me to the solution. It was just a synthax error.

Thank you Bernhard!!

Best, Toni


All times are GMT -4. The time now is 07:41.