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

Using Omega from MRFZones

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 1 Post By edalmau
  • 1 Post By edalmau
  • 1 Post By edalmau
  • 1 Post By edalmau

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2013, 16:33
Default Using Omega from MRFZones
  #1
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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);
Then the MRFZones file:

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;
    }
)

// ************************************************************************* //
Thanks!
immortality likes this.
edalmau is offline   Reply With Quote

Old   March 30, 2013, 18:48
Default
  #2
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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_)
As before I tried lots of combinations with 0 success so I'm quite disappointed with that.

Anyone can give me some advices???
edalmau is offline   Reply With Quote

Old   April 1, 2013, 09:36
Default
  #3
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
Anyone can help me please?
edalmau is offline   Reply With Quote

Old   April 1, 2013, 12:39
Default
  #4
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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");
I put this editing a code found in this thread.

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
Anybody knows why????

Thanks!
edalmau is offline   Reply With Quote

Old   April 2, 2013, 00:55
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
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.
immortality is offline   Reply With Quote

Old   April 2, 2013, 02:15
Default
  #6
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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());
I define a double called omega, and then I want to set it as the magnitude of the vector Omega cause I want a scalar not the whole vector.

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
I'm not an expert in c++, but as I see I've to create an object in the class MRFZone to solve it but I still don't know how to do it, and maybe there is an easier solution for that.

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
edalmau is offline   Reply With Quote

Old   April 3, 2013, 06:25
Default
  #7
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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()
So is there any way to know how to "call" all the other variables used in the solvers? Or I've to search in all the .H and .C that my solver uses to find out?

Thanks in advance,
immortality likes this.
edalmau is offline   Reply With Quote

Old   April 4, 2013, 11:01
Default
  #8
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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());
As you can see I define the object velangular as MRFZone. Then I want to use the function and assign the value of the magnitude of Omega to a double called 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
As far as I know in C++ when defining an object you only have to do what I've already done so I don't know how I can define it to not be "ambiguous".

I'll apreciate any advice, help or comment.

Thanks!
edalmau is offline   Reply With Quote

Old   April 4, 2013, 17:10
Default
  #9
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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)
What I put is that:
Code:
MRFZone velangular("zone1",mesh, mrfZones, "tank");
The error displayed is:
Code:
--> FOAM FATAL IO ERROR: 
keyword origin is undefined in dictionary "/home/eric/PFC/Carpeta_nova/constant/MRFProperties"
It seems like the dictionary I put on the declaration is not correct but I don't know which is the good one. The file MRFProperties is OK cause it runs with MRFInterFoam.

Any ideas?

Anticipated thanks,
Eric
edalmau is offline   Reply With Quote

Old   April 23, 2013, 10:16
Default
  #10
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
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");
Then you can call all functions by using:
Code:
velangular.Omega()
(e.g. gives you the vector Omega)

Hope its helpful for someone.
immortality likes this.

Last edited by edalmau; April 23, 2013 at 11:16.
edalmau is offline   Reply With Quote

Old   April 23, 2013, 13:08
Default
  #11
Senior Member
 
HECKMANN Frédéric
Join Date: Jul 2010
Posts: 249
Rep Power: 16
fredo490 is on a distinguished road
Quote:
Originally Posted by edalmau View Post
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()
So is there any way to know how to "call" all the other variables used in the solvers? Or I've to search in all the .H and .C that my solver uses to find out?

Thanks in advance,
Do you mean something like that:
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
fredo490 is offline   Reply With Quote

Old   April 23, 2013, 18:31
Default
  #12
New Member
 
Eric Dalmau
Join Date: Mar 2013
Location: Catalonia
Posts: 20
Rep Power: 13
edalmau is on a distinguished road
Quote:
Originally Posted by fredo490 View Post
Do you mean something like that:
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
I was already aware of that website when I posted all that stuff. The deal was that I didn't know how to create it, what I should put in each parameter the function asks for.

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.
fredo490 likes this.
edalmau is offline   Reply With Quote

Reply


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
overshooting of Omega in SST komega using simpleFoam cm_jubayer OpenFOAM 2 June 7, 2020 12:52
Variable Omega in MRFZones edalmau OpenFOAM Pre-Processing 5 February 1, 2016 16:06
"Glitches" in k and omega buffi OpenFOAM Running, Solving & CFD 8 January 29, 2013 03:57
Boundary Conditions for k omega SST dancfd OpenFOAM Pre-Processing 0 June 9, 2011 23:25
Use of k omega turbulence model john_w OpenFOAM Running, Solving & CFD 2 September 22, 2009 05:15


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