Getting value of omega from a specific file.
Hi i am talking specificly about in dynamicFVMesh there is a class oscillatingRotatingMotion. In oscillatingRotatingMotion.C there is a code
bool Foam::solidBodyMotionFunctions::oscillatingRotatin 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 |
Hi 13msmemusman,
I'm not sure about this one but maybe something like: Code:
scalar newOmega = readScalar(<dictionaryName>.lookupEntry("omega")); regards, teuk |
But i dont want a new variable newOmega. i just want to update this variable omega at every time step
|
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. |
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 |
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::oscillatingRotatin 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 |
All times are GMT -4. The time now is 17:11. |