|
[Sponsors] |
May 19, 2016, 14:27 |
Getting value of omega from a specific file.
|
#1 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
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 |
|
May 20, 2016, 08:43 |
|
#2 |
New Member
Join Date: Oct 2014
Posts: 26
Rep Power: 12 |
Hi 13msmemusman,
I'm not sure about this one but maybe something like: Code:
scalar newOmega = readScalar(<dictionaryName>.lookupEntry("omega")); regards, teuk |
|
May 20, 2016, 13:06 |
|
#3 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
But i dont want a new variable newOmega. i just want to update this variable omega at every time step
|
|
May 20, 2016, 14:35 |
|
#4 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
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. |
|
May 21, 2016, 10:11 |
|
#5 | |
New Member
Join Date: Oct 2014
Posts: 26
Rep Power: 12 |
Hi,
looks promising to me. But you need to assign your value from the table to the omega variable. Like you said: Quote:
Code:
SBMFCoeffs_.lookup("omega") >> omega_; Code:
omega_.value() = timeSeriesAmplitude(runTime.value()); 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 |
||
May 21, 2016, 10:28 |
|
#6 |
Member
Muhammad Usman
Join Date: Feb 2014
Posts: 91
Rep Power: 0 |
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 |
|
Tags |
file input, read file, solidbodymotionfunctions |
|
|
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 |