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

make a dimensionedScalar to be volScalarField

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By alexeym

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   April 2, 2014, 04:39
Default make a dimensionedScalar to be volScalarField
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 841
Rep Power: 17
sharonyue is on a distinguished road
Hi,

I wanna make the diameter of the particle to be variable. Before I revise the code, d_ is a dimensionedScalar, locates in /opt/openfoam222/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/phaseModel

Code:
//- Characteristic diameter of phase
        dimensionedScalar d_;
Then I change it into:

Code:
//- Characteristic diameter of phase
        volScalarField d_;

.....

volScalarField& d() 
        {
            return d_;
        }

....
....
    d_
    (
        IOobject
        (
            "d" + phaseName,
            mesh.time().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
     ),
I wmake this phase.C successfully. But when I wmake this dragmodel as follows:
Code:
Foam::tmp<Foam::volScalarField> Foam::GidaspowSchillerNaumann::K
(
    const volScalarField& Ur
) const
{
    volScalarField alpha2(max(scalar(1) - alpha1_, scalar(1e-6)));
    volScalarField bp(pow(alpha2, -2.65));

    volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)));

    volScalarField Cds
    (
        neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
      + pos(Re - 1000)*0.44
    );

    return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d();
}
it said:

Code:
SOURCE=dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam222/src/finiteVolume/lnInclude -I../phaseModel/lnInclude -IlnInclude -I. -I/opt/openfoam222/src/OpenFOAM/lnInclude -I/opt/openfoam222/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/GidaspowSchillerNaumann.o
dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C: In member function ‘virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::GidaspowSchillerNaumann::K(const volScalarField&) const’:
dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C:74:47: error: passing ‘const Foam::phaseModel’ as ‘this’ argument of ‘Foam::volScalarField& Foam::phaseModel::d()’ discards qualifiers [-fpermissive]
dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C:82:51: error: passing ‘const Foam::phaseModel’ as ‘this’ argument of ‘Foam::volScalarField& Foam::phaseModel::d()’ discards qualifiers [-fpermissive]
make: *** [Make/linux64GccDPOpt/GidaspowSchillerNaumann.o] Error 1
So in this code above, I only make a dimensionedScalar to be a volScalarField. If I delete this phase1_.d(), all is okay. How should I handle this?

Actually my thought is very simple, in twoPhaseEulerFoam, particle's diameter is constant. you can set it in your transportDict. Well cua I wanna implant PBM into it, so this diameter should be variable. So I wanna implant PBM step by step. At first I should change this constant diameter to be changeable. This is why I revise the code.
sharonyue is offline   Reply With Quote

 


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
[openSmoke] libOpenSMOKE Tobi OpenFOAM Community Contributions 562 January 25, 2023 09:21
Problem with pow and volScalarField _Stefan_ OpenFOAM Programming & Development 15 April 14, 2019 22:20
changing a volScalarField to a dimensionedScalar wschosta OpenFOAM Running, Solving & CFD 5 May 6, 2015 10:20
multiplicate all elements of volScalarField with scalar to get new volScalarField maybee OpenFOAM Programming & Development 2 February 18, 2014 15:43
Confused about how OF handles operation between volScalarField and dimensionedScalar Edy OpenFOAM 3 September 30, 2010 10:07


All times are GMT -4. The time now is 20:29.