CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Getting value of omega from a specific file.

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2016, 14:27
Post Getting value of omega from a specific file.
  #1
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
Hi i am talking specificly about in dynamicFVMesh there is a class oscillatingRotatingMotion. In oscillatingRotatingMotion.C there is a code


bool Foam::solidBodyMotionFunctions:scillatingRotatin gMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);

SBMFCoeffs_.lookup("origin") >> origin_;
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;


I want to read value of omega from a file which is stored in case directory. I want it to be read at every time step..... The most important is it should be read at every time step. I dont know its basic structure for further work i will make it in such a way that at first time step first line of file will be read at 2nd iteration 2nd line will be read...... and so on. Please help me
13msmemusman is offline   Reply With Quote

Old   May 20, 2016, 08:43
Default
  #2
New Member
 
Join Date: Oct 2014
Posts: 26
Rep Power: 12
teuk is on a distinguished road
Hi 13msmemusman,

I'm not sure about this one but maybe something like:


Code:
scalar newOmega = readScalar(<dictionaryName>.lookupEntry("omega"));
in your time loop will do the trick for you?


regards,
teuk
teuk is offline   Reply With Quote

Old   May 20, 2016, 13:06
Post
  #3
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
But i dont want a new variable newOmega. i just want to update this variable omega at every time step
13msmemusman is offline   Reply With Quote

Old   May 20, 2016, 14:35
Post
  #4
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
I have tried something. I thought i should use interpolationTable to give different Amplitude or Omega values at different time steps. So i added in solver.H (creatFields.H) file


// Read the data file and initialise the interpolation table
interpolationTable<scalar> timeSeriesAmplitude
(
runTime.path()/runTime.constant()/"amplitude.dat"
);


Then added in interDyMFoam.C file

amplitude.value() = timeSeriesAmplitude(runTime.value());


But the complier say that amplitude is not declared.

Please guide me what should i do...... amplitude if function of dynamicFVMesh or solidBodyMotionFvMesh or one of the oscillatingRotatingMotionCoeffs. i dont know and i could not figure out.
13msmemusman is offline   Reply With Quote

Old   May 21, 2016, 10:11
Default
  #5
New Member
 
Join Date: Oct 2014
Posts: 26
Rep Power: 12
teuk is on a distinguished road
Hi,


looks promising to me. But you need to assign your value from the table to the omega variable. Like you said:

Quote:
But i dont want a new variable newOmega. i just want to update this variable omega at every time step
Coming from:

Code:
SBMFCoeffs_.lookup("omega") >> omega_;
Probably something like:
Code:
omega_.value() = timeSeriesAmplitude(runTime.value());
Did you get this idea from tables in BCs?
Because thats what I used a couple of month ago. A BC where you can apply a table of inlet values. I used it for volume fraction if I remember correct. Maybe you'll have a look to that, too.

regards,
teuk
teuk is offline   Reply With Quote

Old   May 21, 2016, 10:28
Post
  #6
Member
 
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0
13msmemusman is on a distinguished road
Actually i got the idea from variable acceleration problem i had to solve couple of months ago. For that i used interpolationTables. This is what i am again trying to do. I want to get omega value from a file in which i will write the omega value while algorithm is running. here is piece of code where exactly the omega is defined.

It is in the end of oscillatingRotatingMotion.C you can read this file in openfoam source code

bool Foam::solidBodyMotionFunctions:scillatingRotatin gMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);

SBMFCoeffs_.lookup("origin") >> origin_;
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;

return true;
}


Please help me
13msmemusman is offline   Reply With Quote

Reply

Tags
file input, read file, solidbodymotionfunctions


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 18:18
ParaView Compilation jakaranda OpenFOAM Installation 3 October 27, 2008 12:46


All times are GMT -4. The time now is 09:52.