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

driftFluxFoam viscosity model modification problem

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 17, 2018, 15:12
Default driftFluxFoam viscosity model modification problem
  #1
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Hi everyone,

I’m quite a beginner on OpenFoam and I would need some help about a solver modification I’m trying to make.

The aim

I would like to build a model that respresents the behavior of activated sludge inside a secondary clarifier (basicly I need to make a model about the sedimentation of a non-newtonian fluid).
For this purpose I chose the solver “driftFluxFoam” (which might be my first mistake…)
My problem is that in “driftFluxFoam” the non-newtonian behaviours follow laws from this type :

mu = A x 10^(b.alpha) [1]

Whereas, from the literature I found, the activated sludge viscosity is calculated from :


mu = K1/γ + K2 [2]

Where, γ is the strain rate.
I found that in the viscosityModels, the viscosity was calculated from this strain rate (through the strainRate function). I then tried to adapt the driftFluxFoam solver to solve [2].

The code
In the driftFluxFoam solver, I added, inside the mixtureViscosityModels :
  • A “Casson” model – based on the Casson files from viscosityModel (see attached file);
  • The strainRateFunction - based on the strainRateFunction files from viscosityMode.
Code:
\*---------------------------------------------------------------------------*/

#include "strainRateFunction.H"
#include "addToRunTimeSelectionTable.H"
#include "surfaceFields.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
namespace mixtureViscosityModels
{
    defineTypeNameAndDebug(strainRateFunction, 0);

    addToRunTimeSelectionTable
    (
        mixtureViscosityModel,
        strainRateFunction,
        dictionary
    );
}
}


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::mixtureViscosityModels::strainRateFunction::strainRateFunction
(
    const word& name,
    const dictionary& viscosityProperties,
    const volVectorField& U,
    const surfaceScalarField& phi
)
:
    mixtureViscosityModel(name, viscosityProperties, U, phi),
    strainRateFunctionCoeffs_
    (
        viscosityProperties.optionalSubDict(typeName + "Coeffs")
    ),
    strainRateFunction_
    (
        Function1<scalar>::New("function", strainRateFunctionCoeffs_)
    ),

    mu_
    (
        IOobject
        (
            "mu",
            U_.time().timeName(),
            U_.db()
        ),
        U_.mesh(),
        dimensionedScalar("mu", dimensionSet(1, -1, -1, 0, 0), 0),
        calculatedFvPatchScalarField::typeName
    )

{
    correct();
}


// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //

Foam::tmp<Foam::volScalarField>
Foam::mixtureViscosityModels::strainRateFunction::mu() const
{
    return mu_;
}


Foam::tmp<Foam::scalarField>
Foam::mixtureViscosityModels::strainRateFunction::mu(const label patchi) const
{
    return mu_.boundaryField()[patchi];
}


void Foam::mixtureViscosityModels::strainRateFunction::correct()
{
    tmp<volScalarField> tsigma = strainRate();
    const volScalarField& sigma = tsigma();

   mu_.primitiveFieldRef() = strainRateFunction_->value(sigma());

    volScalarField::Boundary& muBf = mu_.boundaryFieldRef();
    const volScalarField::Boundary& sigmaBf = sigma.boundaryField();

    forAll(muBf, patchi)
    {
        muBf[patchi] = strainRateFunction_->value(sigmaBf[patchi]);
    }
}


bool Foam::mixtureViscosityModels::strainRateFunction::read
(
    const dictionary& viscosityProperties
)
{
    mixtureViscosityModel::read(viscosityProperties);

    strainRateFunctionCoeffs_ = viscosityProperties.optionalSubDict
    (
        typeName + "Coeffs"
    );

    strainRateFunction_.clear();
    strainRateFunction_ = Function1<scalar>::New
    (
        "function",
        strainRateFunctionCoeffs_
    );

    return true;
}
Code:
Class
    Foam::viscosityModels::strainRateFunction


SourceFiles
    strainRateFunction.C

\*---------------------------------------------------------------------------*/

#ifndef strainRateFunction_H
#define strainRateFunction_H

#include "mixtureViscosityModel.H"
#include "volFields.H"
#include "Function1.H"
#include "plastic.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace mixtureViscosityModels
{

/*---------------------------------------------------------------------------*\
                           Class strainRateFunction Declaration
\*---------------------------------------------------------------------------*/

class strainRateFunction
:
    public mixtureViscosityModel
{
    // Private data

        //- Coefficients dictionary
        dictionary strainRateFunctionCoeffs_;

        //- Strain-rate function
        autoPtr<Function1<scalar>> strainRateFunction_;

        //- Current viscosity field
        const volScalarField mu_;



public:

    //- Runtime type information
    TypeName("strainRateFunction");


    // Constructors

        //- Construct from components
        strainRateFunction
        (
            const word& name,
            const dictionary& viscosityProperties,
            const volVectorField& U,
            const surfaceScalarField& phi
        );


    //- Destructor
    virtual ~strainRateFunction()
    {}


    // Member Functions

        //- Return the viscosity
        virtual tmp<volScalarField> mu() const;

        //- Return the viscosity for patch
        virtual tmp<scalarField> mu(const label patchi) const;

        //- Correct the laminar viscosity
        virtual void correct();

        //- Read transportProperties dictionary
        virtual bool read(const dictionary& viscosityProperties);
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace viscosityModels
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //
You will also find the mixtureViscosityModel code which I modified a bit :

Code:
\*---------------------------------------------------------------------------*/

#include "mixtureViscosityModel.H"
#include "volFields.H"
#include "fvcGrad.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

namespace Foam
{
    defineTypeNameAndDebug(mixtureViscosityModel, 0);
    defineRunTimeSelectionTable(mixtureViscosityModel, dictionary);
}


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

Foam::mixtureViscosityModel::mixtureViscosityModel
(
    const word& name,
    const dictionary& viscosityProperties,
    const volVectorField& U,
    const surfaceScalarField& phi
)
:
    name_(name),
    viscosityProperties_(viscosityProperties),
    U_(U),
    phi_(phi)
{}


// * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //

Foam::tmp<Foam::volScalarField> Foam::mixtureViscosityModel::strainRate() const
{
    return sqrt(2.0)*mag(symm(fvc::grad(U_)));
}


bool Foam::mixtureViscosityModel::read(const dictionary& viscosityProperties)
{
    viscosityProperties_ = viscosityProperties;

    return true;
}


// ************************************************************************* //
Code:
SourceFiles
    mixtureViscosityModel.C
    mixtureViscosityModelNew.C

\*---------------------------------------------------------------------------*/

#ifndef mixtureViscosityModel_H
#define mixtureViscosityModel_H

#include "dictionary.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "dimensionedScalar.H"
#include "runTimeSelectionTables.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

/*---------------------------------------------------------------------------*\
                Class mixtureViscosityModel Declaration
\*---------------------------------------------------------------------------*/

class mixtureViscosityModel
{

protected:

    // Protected data

        word name_;
        dictionary viscosityProperties_;

        const volVectorField& U_;
        const surfaceScalarField& phi_;


    // Private Member Functions

        //- Disallow copy construct
        mixtureViscosityModel(const mixtureViscosityModel&);

        //- Disallow default bitwise assignment
        void operator=(const mixtureViscosityModel&);


public:

    //- Runtime type information
    TypeName("mixtureViscosityModel");


    // Declare run-time constructor selection table

        declareRunTimeSelectionTable
        (
            autoPtr,
            mixtureViscosityModel,
            dictionary,
            (
                const word& name,
                const dictionary& viscosityProperties,
                const volVectorField& U,
                const surfaceScalarField& phi
            ),
            (name, viscosityProperties, U, phi)
        );


    // Selectors

        //- Return a reference to the selected viscosity model
        static autoPtr<mixtureViscosityModel> New
        (
            const word& name,
            const dictionary& viscosityProperties,
            const volVectorField& U,
            const surfaceScalarField& phi
        );


    // Constructors

        //- Construct from components
        mixtureViscosityModel
        (
            const word& name,
            const dictionary& viscosityProperties,
            const volVectorField& U,
            const surfaceScalarField& phi
        );


    //- Destructor
    virtual ~mixtureViscosityModel()
    {}


    // Member Functions

        //- Return the phase transport properties dictionary
        const dictionary& viscosityProperties() const
        {
            return viscosityProperties_;
        }

        //- Return the strain rate
        tmp<volScalarField> strainRate() const;

        //- Return the mixture viscosity
        //  given the viscosity of the continuous phase
        virtual tmp<volScalarField> mu(const volScalarField& muc) const;
        //virtual tmp<volScalarField> mu(const volScalarField& muc) const = 0;

        //- Return the laminar viscosity for patch
        //virtual tmp<scalarField> mu(const label patchi) const = 0;   Cet ajout fait bugger la compilation de plastic.C...

        //- Read transportProperties dictionary
        virtual bool read(const dictionary& viscosityProperties) = 0;
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

}


The problem

When I try to compile the solver, I’m having some troubles with a part of the strainRateFunction (see attached file)
From what I understood, this problems comes from the fact that my code risks to modify a variable that shouldn’t be modified (const). But I have no idea about how to fix this…

What I have tried
I tried to avoid the parts of the code at the origin of my problem (with “//”), then the solver compiles, but when I try to run it, I’m getting an error message (“symbol look up error”).
I also tried to make my solver without the strainRateFunction replacing “strainRate()” with “sqrt(2.0)*mag(symm(fvc::grad(U_)))” directly inside “Casson.C”. The solver also compiles but crashes when I try to run it.
This time the problem came from LHS and RHS which didn’t have the same dimension.
As I said I’m very new to OpenFoam, and to be perfectly honest, I don’t really understand how the programming process… That is why I expect quite some huge mistakes and apologize about this…


Finally, I don't know if it's usefull, but attached the code about incompressibleTwoPhaseInteratingmixture.


As I said, maybe my first mistake was to choose driftFluxFoam… If you know another solver which would enable be to solve my problem, it would be a pleasure to try it !
I know it's quite time consuming to read all this... So thanks in advance for your help !
Attached Images
File Type: jpg strainRate.jpg (181.8 KB, 14 views)
Attached Files
File Type: c incompressibleTwoPhaseInteractingMixture.C (3.9 KB, 4 views)
File Type: h incompressibleTwoPhaseInteractingMixture.H (5.7 KB, 1 views)
File Type: c Casson.C (3.4 KB, 8 views)
File Type: h Casson.H (4.1 KB, 3 views)
dleduc is offline   Reply With Quote

Old   September 19, 2018, 06:41
Default
  #2
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Problem solved...

When I declared my variable mu_ in strainRateFunction.H, I used "const volScalarFiel mu_" where I should only have used "volScalarFiel mu_" in order to enable the correct() function to modify the mu_ variable !
dleduc is offline   Reply With Quote

Old   September 19, 2018, 09:40
Default
  #3
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Unfortunately, I'm running into another type of error :

Code:
symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZNK4Foam22mixtureViscosityModels18strainRateFunction2muERKNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE
When I check, where it comes from :

Code:
c++filt _ZNK4Foam22mixtureViscosityModels18strainRateFunction2muERKNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE
Foam::mixtureViscosityModels::strainRateFunction::mu(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const
I believe the part of my code which causes this error is in my file strainRateFunction.C :

Code:
Foam::tmp<Foam::volScalarField>
Foam::mixtureViscosityModels::strainRateFunction::mu() const
{
    return mu_;
}


Foam::tmp<Foam::scalarField>
Foam::mixtureViscosityModels::strainRateFunction::mu(const label patchi) const
{
    return mu_.boundaryField()[patchi];
}
Do you have any idea about the source of this particular problem ?
Any idea about how to fix this ?
dleduc is offline   Reply With Quote

Old   September 23, 2018, 14:40
Default
  #4
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
did you try to include the library you compiled in the controlDict
mAlletto is offline   Reply With Quote

Old   September 25, 2018, 09:37
Default
  #5
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Hi mAlleto,

Thank you very much for your answer, I just tried this :

Code:
oamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

libs            ("home/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxRelativeVelocityModels.so" "home/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so");

application     driftFluxFoam_Casson;
Unfortunatly, it didn't solve the problem.
From what I read, generally those problems come from the wmake files.

Here are the wmake files of my solver :

File

Code:
incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C
compressibleTurbulenceModels.C
driftFluxFoam_Casson.C

EXE = $(FOAM_USER_APPBIN)/driftFluxFoam_Casson
LIB = $(FOAM_USER_LIBBIN)/driftFluxFoam_Casson

Options

Code:
"EXE_INC = \
    -IincompressibleTwoPhaseInteractingMixture \
    -ImixtureViscosityModels/lnInclude \
    -IrelativeVelocityModels/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude

EXE_LIBS = \
    -ldriftFluxRelativeVelocityModels \
    -ldriftFluxTransportModels \
    -L$(FOAM_USER_LIBBIN) \
    -ltwoPhaseMixture \
    -lfiniteVolume \
    -lmeshTools \
    -lsampling \
    -lfvOptions \
    -lcompressibleTransportModels \
    -lturbulenceModels \
    -lcompressibleTurbulenceModels
Also, the incompressibleTwoPhaseInteractingMixture.C calls for mixtureViscosityModel.H which is in the mixtureViscosityModels folder.
The wmake files for the mixtureViscosityModels solver are :

Files

Code:
mixtureViscosityModel/mixtureViscosityModel.C
mixtureViscosityModel/mixtureViscosityModelNew.C
Casson/Casson.C
strainRateFunction/strainRateFunction.C

LIB = $(FOAM_USER_LIBBIN)/libdriftFluxTransportModels

Options

Code:
EXE_INC = \
    -I../incompressibleTwoPhaseInteractingMixture \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \


LIB_LIBS = \
    -ltwoPhaseMixture \
    -lfiniteVolume

The error I get tells me that it comes from the compiledlibdriftFluxTransportModels.so file. More precisely from the strainRateFunction.C (see previous post).

I'm not really used to link different libraries, and I suspect an error in my options files but can't find it...

Thanks again for the time you took mAlleto !
dleduc is offline   Reply With Quote

Old   September 25, 2018, 10:30
Default
  #6
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Quote:
Originally Posted by dleduc View Post
Unfortunately, I'm running into another type of error :

Code:
symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZNK4Foam22mixtureViscosityModels18strainRateFunction2muERKNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE
When I check, where it comes from :

Code:
c++filt _ZNK4Foam22mixtureViscosityModels18strainRateFunction2muERKNS_14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE
Foam::mixtureViscosityModels::strainRateFunction::mu(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const
I believe the part of my code which causes this error is in my file strainRateFunction.C :

Code:
Foam::tmp<Foam::volScalarField>
Foam::mixtureViscosityModels::strainRateFunction::mu() const
{
    return mu_;
}


Foam::tmp<Foam::scalarField>
Foam::mixtureViscosityModels::strainRateFunction::mu(const label patchi) const
{
    return mu_.boundaryField()[patchi];
}
Do you have any idea about the source of this particular problem ?
Any idea about how to fix this ?
The error you get means you declared the function but you don't defined it.

Did you define the function:

mu(const volScalarField& muc) const;

somewhere in the code a pice of code tries the execute the function mu which takes a const volScalarField as argument but it does not find it. So the error is generated from it.

Or better said it has found the declaration but not the definition. So I ask if you declared it
mAlletto is offline   Reply With Quote

Old   September 26, 2018, 10:15
Default
  #7
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
You were perfectly right :

In the mixtureViscosityModel.H, I declared :

Code:
        //- Return the mixture viscosity
        //- given the viscosity of the continuous phase
        virtual tmp<volScalarField> mu(const volScalarField &muc) const = 0
and in the strainRateFunction.H I declared :

Code:
        //- Return the mixture viscosity
        //  given the viscosity of the continuous phase
        virtual tmp<volScalarField> mu(const volScalarField& muc) const
whereas in strainRateFunction.C mu(const volScalarField& muc) was not defined...

I solved the problem by supressing the declaration of mu(const volScalarField& muc) in strainRateFunction.H and by modifying the declaration in mixtureViscosityModel.H as follows :

mixtureViscosityModel.H

Code:
      //- Return the mixture viscosity
        //- given the viscosity of the continuous phase
        virtual tmp<volScalarField> mu(const volScalarField &muc) const;
Thank you very much mAlletto !!

Unfortunately, as soon as a problem is solved, another comes up... The error message I'm getting now is :

Code:
driftFluxFoam_Casson: symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZTIN4Foam21mixtureViscosityModelE
Code:
c++filt  _ZTIN4Foam21mixtureViscosityModelE 
typeinfo for Foam::mixtureViscosityModel
It seems like the new problem is similar to the one with mu() definition... So, I checked definition and declaration of mixtureViscosityModel but it is exactly the same as the initial mixtureViscosityModel in driftFluxFoam solver... I then don't understand why the typeinfo would be missing...
dleduc is offline   Reply With Quote

Old   September 26, 2018, 14:46
Default
  #8
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Quote:
Originally Posted by dleduc View Post
Hi mAlleto,

Thank you very much for your answer, I just tried this :

Code:
oamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

libs            ("home/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxRelativeVelocityModels.so" "home/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so");

application     driftFluxFoam_Casson;
Unfortunatly, it didn't solve the problem.
From what I read, generally those problems come from the wmake files.

Here are the wmake files of my solver :

File

Code:
incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C
compressibleTurbulenceModels.C
driftFluxFoam_Casson.C

EXE = $(FOAM_USER_APPBIN)/driftFluxFoam_Casson
LIB = $(FOAM_USER_LIBBIN)/driftFluxFoam_Casson

Options

Code:
"EXE_INC = \
    -IincompressibleTwoPhaseInteractingMixture \
    -ImixtureViscosityModels/lnInclude \
    -IrelativeVelocityModels/lnInclude \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/sampling/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/compressible/lnInclude \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
    -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude

EXE_LIBS = \
    -ldriftFluxRelativeVelocityModels \
    -ldriftFluxTransportModels \
    -L$(FOAM_USER_LIBBIN) \
    -ltwoPhaseMixture \
    -lfiniteVolume \
    -lmeshTools \
    -lsampling \
    -lfvOptions \
    -lcompressibleTransportModels \
    -lturbulenceModels \
    -lcompressibleTurbulenceModels
Also, the incompressibleTwoPhaseInteractingMixture.C calls for mixtureViscosityModel.H which is in the mixtureViscosityModels folder.
The wmake files for the mixtureViscosityModels solver are :

Files

Code:
mixtureViscosityModel/mixtureViscosityModel.C
mixtureViscosityModel/mixtureViscosityModelNew.C
Casson/Casson.C
strainRateFunction/strainRateFunction.C

LIB = $(FOAM_USER_LIBBIN)/libdriftFluxTransportModels

Options

Code:
EXE_INC = \
    -I../incompressibleTwoPhaseInteractingMixture \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \


LIB_LIBS = \
    -ltwoPhaseMixture \
    -lfiniteVolume

The error I get tells me that it comes from the compiledlibdriftFluxTransportModels.so file. More precisely from the strainRateFunction.C (see previous post).

I'm not really used to link different libraries, and I suspect an error in my options files but can't find it...

Thanks again for the time you took mAlleto !

By the way why did you put

Code:
incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C
compressibleTurbulenceModels.C
driftFluxFoam_Casson.C

EXE = $(FOAM_USER_APPBIN)/driftFluxFoam_Casson
LIB = $(FOAM_USER_LIBBIN)/driftFluxFoam_Casson
the lib in the Make/files ?

usually you put only the EXE
mAlletto is offline   Reply With Quote

Old   September 27, 2018, 03:46
Default
  #9
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Code:
The error I get tells me that it comes from the compiledlibdriftFluxTransportModels.so file. More precisely from the strainRateFunction.C (see previous post).

I'm not really used to link different libraries, and I suspect an error in my options files but can't find it...

Thanks again for the time you took mAlleto !
The LIB is what remains of what I tried to do to solve my problem. When you gave me the solution I forgot to remove it. It is done now !

For the actual error :

Code:
driftFluxFoam_Casson: symbol lookup error: /home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so: undefined symbol: _ZTIN4Foam21mixtureViscosityModelE
Code:
c++filt  _ZTIN4Foam21mixtureViscosityModelE 
typeinfo for Foam::mixtureViscosityModel
Do you think that it could come from my libraries paths which could be wrong ?
Or is it again a declaration problem in the code ?

Just in case... Here's a wetransfer link to download my solver an the test case I use to see if it works : https://we.tl/t-7VZHXDPdKU

Last edited by dleduc; September 27, 2018 at 05:25.
dleduc is offline   Reply With Quote

Old   September 30, 2018, 05:10
Default
  #10
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
what version of OF did you use to compile your code?
mAlletto is offline   Reply With Quote

Old   September 30, 2018, 06:49
Default
  #11
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Hi mAlleto,


I'm using OF5.0 ! Do you think I should use the last version ?
dleduc is offline   Reply With Quote

Old   September 30, 2018, 10:12
Default
  #12
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
I compiled your code with OF6 and a bunch of errors popped up. Probably some classes have changed from OF5 and OF6.



Can you try to post a code which compiles with OF6? Otherwise it would take me too long to figure out what's going wrong.


best


michael
mAlletto is offline   Reply With Quote

Old   September 30, 2018, 15:01
Default
  #13
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Ok i was able to compile your code with OF6 by changing alphaEqn.H with the one of OF. I get the the same error as you when executing it.



when looking through Make/options I found that you included twice a the viscosity model:




EXE_INC = \
-IincompressibleTwoPhaseInteractingMixture \
-ImixtureViscosityModels/lnInclude \
-I./relativeVelocityModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude

EXE_LIBS = \
-ldriftFluxTransportModels \ -> the one of OF
-ldriftFluxRelativeVelocityModels \
-ltwoPhaseMixture \
-lfiniteVolume \
-lmeshTools \
-lsampling \
-lfvOptions \
-lcompressibleTransportModels \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-L$(FOAM_USER_LIBBIN)/libdriftFluxTransportModels -> your


when removing the library of OF i get similar errors as you but already at compile time. There must be a naming conflict somewhere.
mAlletto is offline   Reply With Quote

Old   October 1, 2018, 03:04
Default
  #14
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Hi mAlletto,

indeed there was a naming problem... I began to suspect it when I tried to run my test case with the original driftFluxFoam and got the same error...

driftFluxFoam tried to access my user library :

Code:
/home/leduc/OpenFOAM/leduc-5.0/platforms/linux64GccDPInt32Opt/lib/libdriftFluxTransportModels.so
For some reason, even if not stored in the same place, the fact that the original and the user library had the same name was the source of some confusion...

I then changed the names of my solver and library to Cassonsed and libCassonsed.so and the error went away...

Now the error I get is quite more basic :

Code:
-> FOAM FATAL ERROR: 
Unknown mixtureViscosityModel type transportModel

Valid mixtureViscosityModels are : 

3
(
BinghamPlastic
plastic
slurry
)
This error is the very reason why I wanted to compile a new solver... I thought that by compiling a solver only with my Casson viscosity model it would be recognised by Foam::mixtureViscosityModel::New, but it's unfortunatly not the case... For some reason, my Casson model is not considered as a transportModel :

Code:
{
    const word modelType(viscosityProperties.lookup("transportModel"));

    Info<< "Selecting incompressible transport model " << modelType << endl;

    dictionaryConstructorTable::iterator cstrIter =
        dictionaryConstructorTablePtr_->find(modelType);

    if (cstrIter == dictionaryConstructorTablePtr_->end())
    {
        FatalErrorInFunction
            << "Unknown viscosityModel type "
            << modelType << nl << nl
            << "Valid viscosityModels are : " << endl
            << dictionaryConstructorTablePtr_->sortedToc()
            << exit(FatalError);
    }
I don't know how to implement my Casson viscosity model so it can be found in the dictionaryConstructorTablePtr_...

Thank you very much for what you're doing, you're helping me a lot !
dleduc is offline   Reply With Quote

Old   October 1, 2018, 09:02
Default
  #15
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
Just looking at the other viscosity models I would have just copied one and renamed it.

Afterward I would have modified the mu and read function (letting the input arguments as they are).


By the way you don't need any strain rate functions. You can use the velocity U to calculate it.

By compiling the new viscosity model it should by selectable at run time.
mAlletto is offline   Reply With Quote

Old   October 1, 2018, 09:37
Default
  #16
New Member
 
Damien Leduc
Join Date: Sep 2018
Posts: 10
Rep Power: 7
dleduc is on a distinguished road
Yes, I already tried that :

Code:
I also tried to make my solver without the strainRateFunction replacing “strainRate()” with “sqrt(2.0)*mag(symm(fvc::grad(U_)))” directly inside “Casson.C”. The solver also compiles but crashes when I try to run it. 
This time the problem came from LHS and RHS which didn’t have the same dimension.
I admit that I wanted to do something "cleaner" with a new solver (it would have been some kind of practice with OpenFoam programmation)...

With my C++ level, it might indeed be more appriopriate just to modify the plastic solver just to fulfill my needs !
I'll try this again and hope I'll be able to find the solution about the LHS and RHS dimensions !

Thanks a lot michael !
dleduc 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
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 40 January 27, 2023 07:18
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
problem with solving lagrange reaction cloud Polli OpenFOAM Running, Solving & CFD 0 April 30, 2014 07:53
Low Mixing time Problem Mavier CFX 5 April 29, 2013 00:00
modelling solids viscosity in eulerian multiphase model derkaiser FLUENT 1 December 5, 2011 03:42


All times are GMT -4. The time now is 23:17.