|
[Sponsors] |
March 30, 2013, 17:33 |
Using Omega from MRFZones
|
#1 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
Hi to all foamers,
I'm quite new in this and I want to call the parameter "omega" defined in the MRFZones in my solver to change my gravity direction. I decomposed g into my axes but the angle will be found by multiplying omega and t. First of all I tried with an scalar and it worked. Now I want to add omega to that but I have no clue to how call it. I've tried lots of different calls used in the c++ codes but none worked (omega, omega.value, omega(),....) This is the line where I call the omega. The MRFZones.h is already included so this is not the problem. Code:
g=gunits*Foam::sin(runTime.value()*(omega))*vector(1,0,0)-gunits*Foam::cos(runTime.value()*(omega))*vector(0,1,0); Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "constant"; object MRFZones; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 1 ( tank { // Fixed patches (by default they 'move' with the MRF zone) nonRotatingPatches (atmosfera); origin origin [0 1 0 0 0 0 0] (0.5 0.5 0); axis axis [0 0 0 0 0 0 0] (0 0 1); omega omega [0 0 -1 0 0 0 0] -1.75; } ) // ************************************************************************* // |
|
March 30, 2013, 19:48 |
|
#2 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
I looked up to the cfdtools of MRFZones and it seems like the correct definition is Omega_ for the vector and omega_ for the scalar value but it keep not working.
Here you can see part of the MRFZone.C where they use this names: Code:
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::MRFZone::MRFZone(const fvMesh& mesh, Istream& is) : mesh_(mesh), name_(is), dict_(is), cellZoneID_(mesh_.cellZones().findZoneID(name_)), excludedPatchNames_ ( dict_.lookupOrDefault("nonRotatingPatches", wordList(0)) ), origin_(dict_.lookup("origin")), axis_(dict_.lookup("axis")), omega_(dict_.lookup("omega")), Omega_("Omega", omega_*axis_) Anyone can give me some advices??? |
|
April 1, 2013, 10:36 |
|
#3 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
Anyone can help me please?
|
|
April 1, 2013, 13:39 |
|
#4 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
After more research in how to read from MRFZones dictionary I found a thread here about calling constant values from dictionaries but it seems it doesn't work in my case but I don't know why is not working.
I add this code in my createFields.h: Code:
IOdictionary MRFZones ( IOobject ( "MRFZones", runTime.constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); dimensionedScalar omega_("omega", dimensionSet(0,0,0,0,0,0,0), scalar(0.0)); omega_ = MRFZones.lookup("omega"); Now I don't have the same error when compiling but the new error is more strange to me cause I've not edited the createMRFZones.H from the original MRFInterFoam so I'm so surprised on that failing. Here you have the error I have when compiling: Code:
In file included from MRFSpinInterFoam.C:61:0: createMRFZones.H: In function ‘int main(int, char**)’: createMRFZones.H:1:14: error: expected ‘;’ before ‘mrfZones’ createMRFZones.H:1:28: warning: statement has no effect [-Wunused-value] createMRFZones.H:2:5: error: ‘mrfZones’ was not declared in this scope Thanks! |
|
April 2, 2013, 01:55 |
|
#5 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
dear my friend Eric.
im interested in your problem but didn't have an experiment in MRF concept.i hope your difficulty be resolved. Search in this forum more. Why don't you use scalar omega?is it variable in time?i know the underscore is not belonging to the name of variable.so try without _ And be patient.it certainly have a simple solution.please let me know your progress. |
|
April 2, 2013, 03:15 |
|
#6 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
Hey immortality!
After a long research I found a public function in Openfoam 2.2.0 called "Omega()" which returns the value of the vector Omega. The problem is that I want to use it at my solver and it crashes due to "object issues". The code where I call the function: Code:
double omega; omega = mag(Foam::MRFZone::Omega()); When compiling the solver this error occurs: Code:
MRFSpinInterFoam.C: In function ‘int main(int, char**)’: MRFSpinInterFoam.C:65:38: error: cannot call member function ‘Foam::vector Foam::MRFZone::Omega() const’ without object The function Omega() suits very well in my case cause in other files (e.g. UEqn) I've to use it as a vector for the centrifugal force but I don't know how to use it. In that file I saw how they use other MRF functions and they use in OF2.2.0 the mrfZones.addCoriolis but, whem using the same sintaxis with the function Omega() it doesn't works cause in this new version mrfZones is used for another class IOMRFZoneList if I remember correctly (sorry but I ran so many times different sintaxis and I'm not sure). Another problem I've to solve is making this Omega variable in time but first I want to call it in my solver properly and not adding a scalar in the equations because if I simulate different angular velocities I've to compile again and again. If anyone can give some advices it would be awesome. Thanks, Eric |
|
April 3, 2013, 07:25 |
|
#7 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
As nobody knows it or has read this thread yet. I'll ask you another question related to the subject. Is there any website, code, document or whatever where I can find how are named/labeled all the variables used in the different solvers?
For example I know that to call deltaT I've to type: Code:
runTime.deltaTValue() Thanks in advance, |
|
April 4, 2013, 12:01 |
|
#8 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
I tried again to use the Omega() function in MRFZone class.
The problem now is that I create an object of that class. But the compiler don't want to compile due to no matching. The code I tried to compile is this: Code:
MRFZone velangular; double omega = mag(velangular.Omega()); The error that appears is: Code:
MRF-interfoam.C:81:10: error: no matching function for call to ‘Foam::MRFZone::MRFZone()’ MRF-interfoam.C:81:10: note: candidates are: /opt/openfoam220/src/finiteVolume/lnInclude/MRFZone.H:147:9: note: Foam::MRFZone::MRFZone(const Foam::word&, const Foam::fvMesh&, const Foam::dictionary&, const Foam::word&) /opt/openfoam220/src/finiteVolume/lnInclude/MRFZone.H:147:9: note: candidate expects 4 arguments, 0 provided /opt/openfoam220/src/finiteVolume/lnInclude/MRFZone.H:132:9: note: Foam::MRFZone::MRFZone(const Foam::MRFZone&) /opt/openfoam220/src/finiteVolume/lnInclude/MRFZone.H:132:9: note: candidate expects 1 argument, 0 provided I'll apreciate any advice, help or comment. Thanks! |
|
April 4, 2013, 18:10 |
|
#9 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
After more tries I compiled the solver in OF 2.2.0 but I guess that the object definition is wrong because I don't really understand what is each of the 4 parameters I've to put.
The definition you can find in OpenFoam Programmers documentation: Code:
MRFZone (const word &name, const fvMesh &mesh, const dictionary &dict, const word &cellZoneName=word::null) Code:
MRFZone velangular("zone1",mesh, mrfZones, "tank"); Code:
--> FOAM FATAL IO ERROR: keyword origin is undefined in dictionary "/home/eric/PFC/Carpeta_nova/constant/MRFProperties" Any ideas? Anticipated thanks, Eric |
|
April 23, 2013, 11:16 |
|
#10 |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
After some more attempts, and with the help of my tutor we finally found out a solution and it seems to work.
The problem was that inside the MRFProperties dictionary there are some subdictionaries in my case the name is "tank". So the solution to declare an object in the class MRFZone is this: Code:
MRFZone velangular("zone1",mesh, mrfZones.subDict("name_subdict"), "tank"); Code:
velangular.Omega() Hope its helpful for someone. Last edited by edalmau; April 23, 2013 at 12:16. |
|
April 23, 2013, 14:08 |
|
#11 | |
Senior Member
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 17 |
Quote:
http://foam.sourceforge.net/docs/cpp/a02299.html There is a good search tool Edit: or you can use a google search of this kind "sourceforge openfoam deltaTValue members" Edit: on sourceforge with a simple search of "MRFZone" you would have found: http://foam.sourceforge.net/docs/cpp...d88ad5c0540a37 |
||
April 23, 2013, 19:31 |
|
#12 | |
New Member
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13 |
Quote:
The reason of my last post today was to answer my own question by in case someone in future has the same problem I had. Thanks for posting now I've new thread for the BC so you may be useful there. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
overshooting of Omega in SST komega using simpleFoam | cm_jubayer | OpenFOAM | 2 | June 7, 2020 13:52 |
Variable Omega in MRFZones | edalmau | OpenFOAM Pre-Processing | 5 | February 1, 2016 17:06 |
"Glitches" in k and omega | buffi | OpenFOAM Running, Solving & CFD | 8 | January 29, 2013 04:57 |
Boundary Conditions for k omega SST | dancfd | OpenFOAM Pre-Processing | 0 | June 10, 2011 00:25 |
Use of k omega turbulence model | john_w | OpenFOAM Running, Solving & CFD | 2 | September 22, 2009 06:15 |