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

passing none-Field Data among libraries

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

Like Tree1Likes
  • 1 Post By lukasfischer

Reply
 
LinkBack Thread Tools Display Modes
Old   June 9, 2009, 07:04
Default passing none-Field Data among libraries
  #1
New Member
 
Lukas Fischer
Join Date: Mar 2009
Location: Innsbruck, Austria
Posts: 15
Rep Power: 8
lukasfischer is on a distinguished road
Hi,
we would like to access one Foam::scalar that we calculate in a modified forces library to set a boundary. The library we created calculates the surface elevation depending on gamma and a predefinded direction and is called from the controlDict similar to the forces library and can be called several times with different names.
Now we would like to use these values in a wave generating boundary, preferably by specifying the same identifier in the boundary condition as in the controlDict. If the forces lib would be a registry object this would be easy, but it seems to me that only fields and some special types (i.e. Time) can be attached to the registry.
Is there any type that can hold a single value/scalar and that can be attached to the registry or can the forces object be linked to the reg., or is there a different way to pass small data among libraries?
Thanks, Lukas
wxtwalkee likes this.
lukasfischer is offline   Reply With Quote

Old   June 15, 2009, 10:41
Default
  #2
New Member
 
Lukas Fischer
Join Date: Mar 2009
Location: Innsbruck, Austria
Posts: 15
Rep Power: 8
lukasfischer is on a distinguished road
bump? .
lukasfischer is offline   Reply With Quote

Old   June 15, 2009, 13:20
Default
  #3
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 105
Rep Power: 9
psosnows is on a distinguished road
hello Lukas,

my idea would be to create fileds with zeroGradient boundaries and constant, fixedValues in internalFields. Then use them to transfer data via transferScalar.value();

Code:
violScalarField transferScalar
(
        IOobject (
            name_from_controlDict,
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet( <my dim set> ),
        "zeroGradient"
);
transverScalar = MyValueToTransfer;
hope it helps,
Pawel
psosnows is offline   Reply With Quote

Old   June 15, 2009, 16:31
Default
  #4
New Member
 
Lukas Fischer
Join Date: Mar 2009
Location: Innsbruck, Austria
Posts: 15
Rep Power: 8
lukasfischer is on a distinguished road
Thanks for the help, but wouldn't that mean to pass a whole list of scalars of the size of the mesh cells? I just want to register one single scalar.
Thanks, Lukas
lukasfischer is offline   Reply With Quote

Old   June 15, 2009, 19:40
Default
  #5
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 105
Rep Power: 9
psosnows is on a distinguished road
As far as I know if you have uniform value inside the filed it stores just the value (so it is quite small). Simple way to try it is to force it to write itself ( transferScalar.write(); ).
You will see that it writes the file with uniform value.

My other idea of transfering the scalars would be:
- calculate the value and store it in some "global" variable in main code
- pass it as an argument via procedure which calls your second routine

But if you want to use registery I belive the first way is quite simple and convinient
(although maybe there is a better way)

Regards,
Pawel
psosnows is offline   Reply With Quote

Old   August 14, 2014, 07:51
Default
  #6
New Member
 
Wang Xiuting
Join Date: May 2014
Location: Tianjin,CHN
Posts: 4
Rep Power: 3
wxtwalkee is on a distinguished road
Quote:
Originally Posted by lukasfischer View Post
Hi,
we would like to access one Foam::scalar that we calculate in a modified forces library to set a boundary. The library we created calculates the surface elevation depending on gamma and a predefinded direction and is called from the controlDict similar to the forces library and can be called several times with different names.
Now we would like to use these values in a wave generating boundary, preferably by specifying the same identifier in the boundary condition as in the controlDict. If the forces lib would be a registry object this would be easy, but it seems to me that only fields and some special types (i.e. Time) can be attached to the registry.
Is there any type that can hold a single value/scalar and that can be attached to the registry or can the forces object be linked to the reg., or is there a different way to pass small data among libraries?
Thanks, Lukas
Hi Lukas,
I am investigating on the active-absorbing piston-type wave-making in OpenFoam. I am confused by the same problem you have met. I need to adjust the piston's movement according to the surface elevation( just a scalar) on the piston. Besides, I need the piston's position( just a vector) at previous timestep. The problem has been confusing me for weeks. Would you please help me out? I cannot be too grateful!

wxtwalkee
wxtwalkee is offline   Reply With Quote

Reply

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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
External magnetic field data Richard Lee FLUENT 2 March 10, 2010 11:22
may i import flow field data to do particle track? Hao FLUENT 8 April 29, 2008 08:22
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27


All times are GMT -4. The time now is 18:00.