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

Problems with creating a volScalarField

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By georlade

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 27, 2010, 02:31
Default Problems with creating a volScalarField
  #1
New Member
 
Georg Ladenburger
Join Date: Apr 2010
Posts: 2
Rep Power: 0
georlade is on a distinguished road
Hi,

I've got a question about a (at least for me) weird problem.
I'm working with a coupled solver based on the solidparticlecloud and interfoam. I want to create a volScalarField in the solidParticleCloud.
I tried the following:

-I created a variable volScalarField alphap in solidParticleCloud.H by using:

Code:
alphap
    (
       IOobject
        (
        "alphap",
            runTime.timeName(),            
            mesh_,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
       mesh_,
       dimensionedScalar(0.)
    );
after Compiling I get the following:
Code:
$ wmake libso .
Making dependency list for source file oilParticleCloud.C
Making dependency list for source file oilParticle.C
SOURCE=oilParticle.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linuxGccDPOpt/oilParticle.o
In file included from oilParticle.C:27:
oilParticleCloud.H:122: error: expected ‘)’ before string constant
oilParticleCloud.H:122: error: expected ‘)’ before string constant
oilParticleCloud.H:122: error: expected ‘;’ before string constant
oilParticle.C: In member function ‘bool Foam::oilParticle::move(Foam::oilParticle::trackData&)’:
oilParticle.C:173: warning: unused variable ‘volp’
oilParticle.C:174: warning: unused variable ‘volcell’
make: *** [Make/linuxGccDPOpt/oilParticle.o] Error 1
I don't understand the error message at all.

Next thing I tried:
- declaration of volScalarField alpha in solidParticleCloud.H and creating the IOobject in the constructor
in solidParticleCloud::solidParticleCloud :
Code:
alphap  
 (
       IOobject
        (
        "alphap",
            runTime.timeName(),            
            mesh_,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
       mesh_,
       dimensionedScalar(0.)
    );
Here the error message is even longer:

Code:
$ wmake libso .
Making dependency list for source file oilParticleCloud.C
SOURCE=oilParticleCloud.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/finiteVolume/lnInclude -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude -I/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linuxGccDPOpt/oilParticleCloud.o
oilParticleCloud.C: In constructor ‘Foam::oilParticleCloud::oilParticleCloud(const Foam::fvMesh&, const Foam::word&)’:
oilParticleCloud.C:85: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:602: note: candidates are: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:567: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:537: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:504: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:472: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:441: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:409: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:369: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, Foam::Istream&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:329: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:302: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensionSet&, const Foam::Field<Type>&, const Foam::PtrList<PatchField<Type> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:273: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensioned<Type>&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:244: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensioned<Type>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:217: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensionSet&, const Foam::wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/georg/OpenFOAM/OpenFOAM-1.6.x/src/OpenFOAM/lnInclude/GeometricField.C:187: note:                 Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const typename GeoMesh::Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
oilParticleCloud.C:92: error: ‘runTime’ was not declared in this scope
make: *** [Make/linuxGccDPOpt/oilParticleCloud.o] Error 1
Ok, runTime was not declared is plausible, as the solidparticlecloud.H is included into InterFoam before the createTime.H
To fix it I used instead:
Code:
mesh_.time().timeName()
Instead of the "runTime not declared in this scope" another error occurs (all the other text is similar):
Code:
oilParticleCloud.C:99: error: no match for call to ‘(Foam::volScalarField) (Foam::IOobject, const Foam::fvMesh&, Foam::dimensionedScalar)’
make: *** [Make/linuxGccDPOpt/oilParticleCloud.o] Error 1
Then I did the following:

Code:
Foam::oilParticleCloud::oilParticleCloud
(
    const fvMesh& mesh,
    const word& cloudName
)
:
    Cloud<oilParticle>(mesh, cloudName, false),
    mesh_(mesh),
    particleProperties_
    (
        IOobject
        (
            "particleProperties",
            mesh_.time().constant(),
            mesh_,
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    ),
    injectorProperties_
    (
        IOdictionary
        (
            IOobject
            (
                "injectorProperties",
                mesh_.time().constant(),
                mesh_,
                IOobject::MUST_READ,
                IOobject::NO_WRITE
            )
        )
    ),
alphap
    (
       IOobject
        (
        "alphap",
            mesh_.time().timeName(),            
            mesh_,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
       mesh_,
       dimensionedScalar(0.)
    ),
    rhop_(dimensionedScalar(particleProperties_.lookup("rhop")).value()),
    e_(dimensionedScalar(particleProperties_.lookup("e")).value()),
    mu_(dimensionedScalar(particleProperties_.lookup("mu")).value())
{  
    oilParticle::readFields(*this);
}
The good thing: There was no compilation error. Only some warnings:
Code:
oilParticleCloud.H: In constructor ‘Foam::oilParticleCloud::oilParticleCloud(const Foam::fvMesh&, const Foam::word&)’:
oilParticleCloud.H:118: warning: ‘Foam::oilParticleCloud::alphap’ will be initialized after
oilParticleCloud.H:100: warning:   ‘Foam::scalar Foam::oilParticleCloud::rhop_’
oilParticleCloud.C:50: warning:   when initialized here
'/home/georg/OpenFOAM/OpenFOAM-1.6.x/lib/linuxGccDPOpt/liboilParticle.so' is up to date.
The bad thing: After starting the simulation I got an Segmentation fault.
I could locate the error:
It occurs in the InterFoam.C at runTime++

So where is my mistake?
Here some backgroundinformation what I want to do:
The volScalarField alpha should be located in solidParticleCloud, as all solidParticles have to write some data into alpha (due to this, it has to be public in solidParticleCloud). After the loop over all particles is finished, alpha is read by alphaEqn.H to add a masssource into the equotation (this is, why I need the IOobject). Afterwards it is set to zero, and the particles write again and so on...

If anyone have an idea or a hint, how to solve this problem (maybe a little bit more elegant), your very welcome to enlighten me. Also it would be great to understand why all the above happens.

I'm looking forward for your answers,
Cheers,
Georg
georlade is offline   Reply With Quote

Old   June 24, 2010, 08:48
Default
  #2
Member
 
Raghavendra
Join Date: Mar 2009
Location: Goteborg, Sweden
Posts: 95
Rep Power: 17
raagh77 is on a distinguished road
Send a message via Yahoo to raagh77 Send a message via Skype™ to raagh77
Hi Georg,

Even I am facing the same problem
I am not able to couple particle tracking with VOF
I mean solidParticle and interFoam

I tried to compile part pisoLagrangianFoam with interFoam and it was successful (at least code compiled without any error) but the thing is the drag coefficient is not treated well there in pisoLagrangianFoam.

I thought of coupling solidPartilce and interFoam but ended up with the same problem (I think there is some changes to be made in the soildparticle files so that it can be treated well with the piso loop of interFoam ?.. wild guess.. because solidparticle+simpleFoam works well without any problem)

if you have fixed this issue pls. let me know

Awaiting to hear from you


Regards
Raghu
raagh77 is offline   Reply With Quote

Old   July 6, 2010, 03:19
Default
  #3
New Member
 
Georg Ladenburger
Join Date: Apr 2010
Posts: 2
Rep Power: 0
georlade is on a distinguished road
Hi Raghu,

Sorry for the late answer! Unfortunately I have bad news for you. I wasn't able to find the cause of the problem.
I only can show you a way to by-pass the problem. For me, it works, maybe for you as well.

What I did: I created a variable alphap_ of type scalarField (also possible vectorField...) in the solidParticleCloud.H file. With a function it is possible to access this variable and copy it into the VOF Solver. The function also converts the scalarField into a volScalarField. Declaration of the function is in solidParticleCloud.H, definition in solidParticleCloudI.H.

Code:
inline Foam::tmp<Foam::volScalarField> Foam::oilParticleCloud::alphap() const
{
    tmp<volScalarField> volfrac
    (
        new volScalarField
        (
            IOobject
            (
                "alphap",
                mesh_.time().timeName(),
                mesh_,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh_,
            dimensionedScalar
            (
                "zero",
                dimensionSet(0, 0, 0, 0, 0, 0, 0),
                0. 
            )
        )
    );

    volfrac().internalField() = alphap_;

    return volfrac;
}
Maybe you can use this way as well, fingers crossed!

If you have questions, don't hesitate to ask me!

Regards,
Georg
Luttappy and elham usefi like this.
georlade is offline   Reply With Quote

Old   August 4, 2016, 10:38
Default
  #4
New Member
 
elham usefi
Join Date: Apr 2016
Location: tabriz,iran
Posts: 13
Rep Power: 9
elham usefi is on a distinguished road
Quote:
Originally Posted by georlade View Post
Hi Raghu,

Sorry for the late answer! Unfortunately I have bad news for you. I wasn't able to find the cause of the problem.
I only can show you a way to by-pass the problem. For me, it works, maybe for you as well.

What I did: I created a variable alphap_ of type scalarField (also possible vectorField...) in the solidParticleCloud.H file. With a function it is possible to access this variable and copy it into the VOF Solver. The function also converts the scalarField into a volScalarField. Declaration of the function is in solidParticleCloud.H, definition in solidParticleCloudI.H.

Code:
inline Foam::tmp<Foam::volScalarField> Foam::oilParticleCloud::alphap() const
{
    tmp<volScalarField> volfrac
    (
        new volScalarField
        (
            IOobject
            (
                "alphap",
                mesh_.time().timeName(),
                mesh_,
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh_,
            dimensionedScalar
            (
                "zero",
                dimensionSet(0, 0, 0, 0, 0, 0, 0),
                0. 
            )
        )
    );

    volfrac().internalField() = alphap_;

    return volfrac;
}
Maybe you can use this way as well, fingers crossed!

If you have questions, don't hesitate to ask me!

Regards,
Georg
Hi georlade
I have a question! what does exactly the last zero in ("zero",dimensionSet(0, 0, 0, 0, 0, 0, 0),0.) refers to?
elham usefi is offline   Reply With Quote

Old   December 4, 2016, 13:31
Default
  #5
Member
 
Zhiyi Li
Join Date: Mar 2015
Location: Germany
Posts: 43
Rep Power: 11
comingdaytime is on a distinguished road
Have you tried to set the initial value not equal to zero. Because sometimes it is used as denominator, therefore something like segmentation fault or floating point exception will occur.
comingdaytime is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[blockMesh] Problems in creating a wedge type mesh Joscha OpenFOAM Meshing & Mesh Conversion 28 August 3, 2019 08:59
problems creating a mesh of inlet pipe peterle ANSYS 0 November 13, 2009 09:57
Problems with Meshing: Collapsed Cells Emmanuel Resch Siemens 1 July 30, 2007 04:02
Really big problems when creating own materials da Jop FLUENT 0 June 28, 2007 12:15
Problems with volScalarField niklas OpenFOAM Running, Solving & CFD 2 November 28, 2005 17:05


All times are GMT -4. The time now is 02:16.