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] funkySetFields over a cellZone (https://www.cfd-online.com/Forums/openfoam-community-contributions/129847-funkysetfields-over-cellzone.html)

r2d2 February 14, 2014 06:31

funkySetFields over a cellZone
 
Dear All,
What would be the syntax of funkySetFields to set a value of a field only on a part of a cellZone of my mesh?
This does not work:

expressions
(

setProp1
{
field alpha;
zoneName pipe;
condition " (pos().y < -0.331)";
expression "1";
keepPatches true;
}

);

Many thanks in advance...

gschaider February 14, 2014 11:41

Quote:

Originally Posted by r2d2 (Post 474937)
Dear All,
What would be the syntax of funkySetFields to set a value of a field only on a part of a cellZone of my mesh?
This does not work:

expressions
(

setProp1
{
field alpha;
zoneName pipe;
condition " (pos().y < -0.331)";
expression "1";
keepPatches true;
}

);

Many thanks in advance...

This is documented in the incomplete reference guide that comes with the sources and on the original funkySetFields-page (I point this out because it is my impression that the fact that there IS documentation seems to confuse people): you're looking for the zone-function. Your condition would be (if I interpret it correctly) "zone(pipe) && (pos().y<-0.331)"

r2d2 February 17, 2014 03:33

Dear Bernhard,
My fault for being a bit lazy...actually I found it while you gave me the solution.
Many thanks,
radu

saumavadey July 24, 2021 03:56

Hello!

I was trying to set the field for a volTensorField for a particular cellzone the following way:

roughness_channel1
{
field nRGHo;
zone(channel1);
expression "tensor(0.15, 0.0, 0.0, 0.0, 0.15, 0.0, 0.0, 0.0, 0.0)";
keepPatches 1;
}

But it doesn't work. The field for the entire domain gets replaced by the given tensor value. Can anyone explain why is it happening?

gschaider July 26, 2021 03:49

Quote:

Originally Posted by saumavadey (Post 808865)
Hello!

I was trying to set the field for a volTensorField for a particular cellzone the following way:

roughness_channel1
{
field nRGHo;
zone(channel1);
expression "tensor(0.15, 0.0, 0.0, 0.0, 0.15, 0.0, 0.0, 0.0, 0.0)";
keepPatches 1;
}

But it doesn't work. The field for the entire domain gets replaced by the given tensor value. Can anyone explain why is it happening?


To constrain the cells the cells that FSF manipulates you've got to use a "condition" (it is a bit more typing but sooo much more flexible). The condition can be any expression with a boolean result. In your case something like
Code:

roughness_channel1
    {
        field nRGHo;
        condition "zone(channel1)";
        expression "tensor(0.15, 0.0, 0.0, 0.0, 0.15, 0.0, 0.0, 0.0, 0.0)";
        keepPatches 1;
    }


saumavadey July 26, 2021 04:07

Yes! Got it! It works well.... Thanks a lot! :)


All times are GMT -4. The time now is 17:46.