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

ghRef defination location

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By phmusi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2016, 09:39
Default ghRef defination location
  #1
Member
 
Manoj
Join Date: Jun 2013
Posts: 38
Rep Power: 12
manoj_nav is on a distinguished road
Hi, I am trying to compile modify interDyMfoam and create waveDyMfoam. I am getting following error.

waveDyMFoam.C:130:43: error: ‘ghRef’ was not declared in this scope
gh = (g & mesh.C()) - ghRef;


I want to know where is ghRef defined..

Thanks,

Manoj
manoj_nav is offline   Reply With Quote

Old   March 22, 2016, 15:13
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
Try going to your OpenFOAM source root, and searching for it. Start with OpenFOAM/src, and if it's not there, search OpenFOAM/applications

find -name "*.[HC]" | xargs grep ghRef

or

grep -r ghRef *
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   March 23, 2016, 03:41
Default
  #3
Member
 
Manoj
Join Date: Jun 2013
Posts: 38
Rep Power: 12
manoj_nav is on a distinguished road
Quote:
Originally Posted by marupio View Post
Try going to your OpenFOAM source root, and searching for it. Start with OpenFOAM/src, and if it's not there, search OpenFOAM/applications

find -name "*.[HC]" | xargs grep ghRef

or

grep -r ghRef *
Thanks David for the reply.

I found that ghRef is defined in gh.H .

After including this in my code, I am now getting following error.

Code:
 In file included from waveDyMFoam.C:69:0:
../createFields.H: In function ‘int main(int, char**)’:
../createFields.H:83:18: error: redeclaration of ‘Foam::volScalarField gh’
 volScalarField gh("gh", g & (mesh.C() - referencePoint));
                  ^
In file included from waveDyMFoam.C:63:0:
/opt/openfoam30/src/finiteVolume/lnInclude/gh.H:8:20: note: ‘Foam::volScalarField gh’ previously declared here
     volScalarField gh("gh", (g & mesh.C()) - ghRef);
                    ^
In file included from waveDyMFoam.C:69:0:
../createFields.H:84:23: error: redeclaration of ‘Foam::surfaceScalarField ghf’
 surfaceScalarField ghf("ghf", g & (mesh.Cf() - referencePoint));
                       ^
In file included from waveDyMFoam.C:63:0:
/opt/openfoam30/src/finiteVolume/lnInclude/gh.H:9:24: note: ‘Foam::surfaceScalarField ghf’ previously declared here
     surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef);
Please help me to correct it. I am new to compiling these codes.

Regards,

Manoj
manoj_nav is offline   Reply With Quote

Old   March 23, 2016, 06:15
Default
  #4
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 313
Rep Power: 15
agustinvo is on a distinguished road
Hi,

did you included that gh.H file in your code?

It seems the error comes because you are defining it twice: when you include the H file and when you code it. Try to comment out your own definitions.
agustinvo is offline   Reply With Quote

Old   May 20, 2016, 13:26
Default
  #5
New Member
 
Pierre-Henri Musiedlak
Join Date: Dec 2015
Posts: 11
Rep Power: 10
phmusi is on a distinguished road
Hello Manoj and Agustino,

I am struggling at the same step.

I found this:
http://www.cfd-online.com/Forums/ope...c-meshing.html

And proceed to the opposite: in createFields.H
uncomment the two #include and comment the two solScalar and surfaceSaclar:

original:
Code:
//include "readhRef.H"
//include "gh.H"
#volScalarField gh("gh", g & (mesh.C() - referencePoint));
#surfaceScalarField ghf("ghf", g & (mesh.Cf() - referencePoint));
new:
Code:
#include "readhRef.H"
#include "gh.H"
//volScalarField gh("gh", g & (mesh.C() - referencePoint));
//surfaceScalarField ghf("ghf", g & (mesh.Cf() - referencePoint));
At least now it compiles and the floating run (crash after but might be another issue ^^)

The other solution I found is to copy-paste the definition of gh.H just before it is used in waveDyMFoam, but in removing the two last lines.

Code:
if (mesh.changing())
                {
                    Info<< "Execution time for mesh.update() = "
                        << runTime.elapsedCpuTime() - timeBeforeMeshUpdate
                        << " s" << endl;

        dimensionedScalar ghRef
            (
                mag(g.value()) > SMALL
              ? g & (cmptMag(g.value())/mag(g.value()))*hRef
              : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
            );
            //volScalarField gh("gh", (g & mesh.C()) - ghRef);
            //surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef);

                    gh = (g & mesh.C()) - ghRef;
                    ghf = (g & mesh.Cf()) - ghRef;
                }
AND by adding
Code:
#include "readhRef.H"
in the main (just after #include "readWaveProperties.H")

This way i am not altering the createFields.H

The simulation runs and then crash the same (hopefully meaning it does not come from here)

Cheers

Pierre-Henri
dupeng likes this.

Last edited by phmusi; May 20, 2016 at 14:27.
phmusi 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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Errors running allwmake in OpenFOAM141dev with WM_COMPILE_OPTION%3ddebug unoder OpenFOAM Installation 11 January 30, 2008 20:30


All times are GMT -4. The time now is 13:01.