CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Access a probed value

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 28, 2011, 16:13
Default Access a probed value
  #1
New Member
 
Anders
Join Date: Nov 2010
Posts: 9
Rep Power: 5
anlj is on a distinguished road
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
anlj is offline   Reply With Quote

Old   August 28, 2011, 18:57
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,756
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by anlj View Post
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)
gschaider is offline   Reply With Quote

Old   June 29, 2012, 11:28
Default
  #3
Member
 
Join Date: Oct 2010
Location: Germany
Posts: 39
Rep Power: 5
Ivanet is on a distinguished road
Hi Bernhard,
do you need swak4Foam for using sampledSet?
Thanks
Ivan
Ivanet is offline   Reply With Quote

Old   June 30, 2012, 07:34
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,756
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Ivanet View Post
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

Last edited by gschaider; June 30, 2012 at 07:34. Reason: Corrected name
gschaider is offline   Reply With Quote

Old   July 1, 2012, 07:37
Default
  #5
Member
 
Join Date: Oct 2010
Location: Germany
Posts: 39
Rep Power: 5
Ivanet is on a distinguished road
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
Ivanet is offline   Reply With Quote

Old   July 1, 2012, 10:23
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,756
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Ivanet View Post
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
gschaider is offline   Reply With Quote

Old   July 2, 2012, 11:57
Default
  #7
Member
 
Join Date: Oct 2010
Location: Germany
Posts: 39
Rep Power: 5
Ivanet is on a distinguished road
Quote:
Originally Posted by gschaider View Post
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
Ivanet is offline   Reply With Quote

Old   March 13, 2014, 06:34
Default
  #8
Senior Member
 
Aurelien Thinat
Join Date: Jul 2010
Posts: 148
Rep Power: 6
Aurelien Thinat is on a distinguished road
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 is offline   Reply With Quote

Old   March 13, 2014, 11:52
Default
  #9
Senior Member
 
Aurelien Thinat
Join Date: Jul 2010
Posts: 148
Rep Power: 6
Aurelien Thinat is on a distinguished road
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";; );
}
Aurelien Thinat is offline   Reply With Quote

Old   March 13, 2014, 12:25
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,756
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Aurelien Thinat View Post
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
__________________
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
gschaider is offline   Reply With Quote

Old   March 13, 2014, 12:33
Default
  #11
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,756
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Aurelien Thinat View Post
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
__________________
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
gschaider is offline   Reply With Quote

Old   March 13, 2014, 15:13
Default
  #12
Senior Member
 
Aurelien Thinat
Join Date: Jul 2010
Posts: 148
Rep Power: 6
Aurelien Thinat is on a distinguished road
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.
Aurelien Thinat is offline   Reply With Quote

Old   March 14, 2014, 07:40
Default
  #13
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,756
Rep Power: 36
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Aurelien Thinat View Post
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)
__________________
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
gschaider is offline   Reply With Quote

Reply

Tags
codedfixedvalue, probe

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Online libraries - with access to Journals momentum_waves Main CFD Forum 2 December 12, 2007 10:08
UDF Data Access Macro Woo Meng Wai FLUENT 0 November 6, 2007 20:23
Error: access: unbound variable,HELP sudhakar FLUENT 0 January 15, 2007 23:21
Access Density Allan Walsh FLUENT 3 October 4, 2005 07:55
access to variables at interface of porous media? Mazyar FLUENT 0 October 10, 2003 14:59


All times are GMT -4. The time now is 05:56.