CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Access a probed value (https://www.cfd-online.com/Forums/openfoam-solving/91962-access-probed-value.html)

anlj August 28, 2011 16:13

Access a probed value
 
Hello!

I probe the pressure in a point (x,y,z) and it is written to a file and I can post-process it later, so far so good.

In OpenFoam 2 there is the new codedFixedValue boundary condition, and in the code I would like to implement there, I want to use the pressure from my probe; so the question is, how do I access it?

Can someone help me with that part of the code?

Thanks! / Anders

gschaider August 28, 2011 18:57

Quote:

Originally Posted by anlj (Post 321977)
Hello!

I probe the pressure in a point (x,y,z) and it is written to a file and I can post-process it later, so far so good.

In OpenFoam 2 there is the new codedFixedValue boundary condition, and in the code I would like to implement there, I want to use the pressure from my probe; so the question is, how do I access it?

Can someone help me with that part of the code?

Thanks! / Anders

If the information is not in a regIOobject (and you can therefore access it via lookupObject) you'll have a hard time getting to it from a completely unrelated subroutine. So you'll probably end up re-implementing parts of the probe-functionality in your BC (somebody correct me if I'm wrong).

(Disclaimer: the next part will be seen as a shameless self-advertisment by some people ;) )
If you just need the value of the probe and the BC you want to set depending on it is an expression (nothing that involves multiple iterations) you should be able to do it with the groovyBC that come with swak4Foam (see the fillingTheDam-example. Just use a sampledSet of type cloud)

Ivanet June 29, 2012 11:28

Hi Bernhard,
do you need swak4Foam for using sampledSet?
Thanks
Ivan

gschaider June 30, 2012 07:34

Quote:

Originally Posted by Ivanet (Post 368930)
Hi Bernhard,
do you need swak4Foam for using sampledSet?

No. The sampling-functionality is part of OpenFOAM. Only if you want to use it in the way anlj needs it (in a boundary condition) AND you do not want to program the BC yourself in C++ do you need swak4Fam

Ivanet July 1, 2012 07:37

Hi Bernhard,
thanks for your reply. I have tried to use sampledSet in my controlDict, but I become this error message:
Quote:

--> FOAM FATAL ERROR:
Unknown function type sampledSet
My guess is that I have set probably a wrong functionObjectLib. I am using "libsampling.so". Which one should I use? Could you please include a small example of the controlDict settings for this function?
Thanks you very much
Ivan

gschaider July 1, 2012 10:23

Quote:

Originally Posted by Ivanet (Post 369095)
Hi Bernhard,
thanks for your reply. I have tried to use sampledSet in my controlDict, but I become this error message:

My guess is that I have set probably a wrong functionObjectLib. I am using "libsampling.so". Which one should I use? Could you please include a small example of the controlDict settings for this function?
Thanks you very much
Ivan

Try "sets". The FO is named that way. sampledSets is the name of the underlying class which is more "real" to me

Ivanet July 2, 2012 11:57

Quote:

Originally Posted by gschaider (Post 369128)
Try "sets". The FO is named that way. sampledSets is the name of the underlying class which is more "real" to me

Thanks Bernhard. It works now.
Ivan

Aurelien Thinat March 13, 2014 05:34

Hi everyone,

I'm willing to use a probe monitoring to control a boundary condition.

The problem :
- multiregion (1 fluid, 1 solid),
- 1 probe in temperature in the fluid domain,
- the energy flux at the outside of the solid region is a function of the probed temperature.

I'm aiming to use swak4Foam (OF.2.x) for this purpose. I'm looking at fillingTheDam example which use function type addGlobalVariable. But I don't find any exemple of probe reading in swak4Foam.

1) Does anyone have any idea how to link my function "probes" to the function "globalVariable" ?
2) How can I link a globalVariable to the flux boundary condition ? I guess I have to use a BC of type "groovyBC" ? This is done by using "0" in fractionExpression right ?
Thank you.

Aurelien Thinat March 13, 2014 10:52

Well I didn't find out how to link the probe value to the boundary condition. Here is what I wrote for now. It seems that global variables are linked to 1 domain zone and are not shared with the others.
NB : The probe is perfectly working this way.

ControlDict file :
Code:

createProbe
{
type createSampledSet;
outputControl timeStep;
outputInterval 1;
setName probePoint;
region fluide;            //The problem is coming from here
set
{
type cloud;
axis x;
points
(
( 0.03 0.0005 0.05)
);
}
}
Probe
{
type swakExpression;
valueType set;
verbose true;
globalScopes ("scopeBC");
globalName probe;
outputControl timeStep;
outputInterval 1;
region fluide;
setName probeSwak;
set
{
type swakRegistryProxy;
axis x;
setName probePoint;
}
variables
(
"probeTemp = T";
);
expression "probeTemp";
accumulations (sum);
interpolate true;
interpolationType cell;
}

Solide/T file :
Code:

solidExternalWall
{
type groovyBC;
globalScopes (scopeBC);
valueExpression "flux";
fractionExpression "0";
value uniform 0;
variables (
"TempProbe{set 'probePoint} = sum(T);"
"TempObj = 400;"
"flux=100000(TempObj - TempProbe)/100";;
);
}


gschaider March 13, 2014 11:25

Quote:

Originally Posted by Aurelien Thinat (Post 479725)
Hi everyone,

I'm willing to use a probe monitoring to control a boundary condition.

The problem :
- multiregion (1 fluid, 1 solid),
- 1 probe in temperature in the fluid domain,
- the energy flux at the outside of the solid region is a function of the probed temperature.

I'm aiming to use swak4Foam (OF.2.x) for this purpose. I'm looking at fillingTheDam example which use function type addGlobalVariable. But I don't find any exemple of probe reading in swak4Foam.

1) Does anyone have any idea how to link my function "probes" to the function "globalVariable" ?
2) How can I link a globalVariable to the flux boundary condition ? I guess I have to use a BC of type "groovyBC" ? This is done by using "0" in fractionExpression right ?
Thank you.

Basically do it like fillingTheDam does: create a set and get the value of that set (see 0/U in that case: "aHeight{set'fillingLine}"). What you want is a set of type "cloud" where you have to specify all the locations (for all practical purposes this behaves like a probe so there is no "probe" type in swak).

I think I showed a case with such probes at the 6th Workshop (see http://openfoamwiki.net/index.php/Co...er_information) and there is also the (rather elaborate) CleaningTank-example in Examples/FromPresentation

For accessing the other mesh use "/other" as described in http://openfoamwiki.net/index.php/Co...al_expressions

gschaider March 13, 2014 11:33

Quote:

Originally Posted by Aurelien Thinat (Post 479815)
Well I didn't find out how to link the probe value to the boundary condition. Here is what I wrote for now. It seems that global variables are linked to 1 domain zone and are not shared with the others.
NB : The probe is perfectly working this way.

Seems you beat me to it. Basically that is what I was proposing in the other posting.

This application seems to be quite popular. Would be nice if someone added it at http://openfoamwiki.net/index.php/Co...Usage_examples

Aurelien Thinat March 13, 2014 14:13

Thank you for the answer.

Yes it's a very usefull tool when a PID controler is in the loop.

Thanks to your answer (I was pretty sure to saw this earlier but I read "another patch" instead of another mesh...), I'm now able to impose a fixedValue (dirichlet condition) : Twall = f(Tprobe, time).

I'm now looking to swtich to a Neumann's one. I'll try it tomorow morning and if everything is fine, I'll write something up for the wiki. Though I might ask you how to upload it.

gschaider March 14, 2014 06:40

Quote:

Originally Posted by Aurelien Thinat (Post 479856)
Thank you for the answer.

Yes it's a very usefull tool when a PID controler is in the loop.

Thanks to your answer (I was pretty sure to saw this earlier but I read "another patch" instead of another mesh...), I'm now able to impose a fixedValue (dirichlet condition) : Twall = f(Tprobe, time).

I'm now looking to swtich to a Neumann's one. I'll try it tomorow morning and if everything is fine, I'll write something up for the wiki. Though I might ask you how to upload it.

You'll just have to apply for an account (top left). Currently it takes one or two days after that because I've got to manually approve the account (to weed out spammers)


All times are GMT -4. The time now is 08:57.