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

nuEff()()[patchI] and nuEff()

Register Blogs Community New Posts Updated Threads Search

Like Tree9Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 8, 2016, 07:16
Default nuEff()()[patchI] and nuEff()
  #1
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear all,

I have a simple question about the following. In the fixedShearStress BC we find this:
Code:
    const label patchI = patch().index();

    const surfaceScalarField& phi =
        db().lookupObject<surfaceScalarField>(phiName_);

    scalarField nuEff;
    if (phi.dimensions() == dimVelocity*dimArea)
    {
        const incompressible::turbulenceModel& turbModel =
            db().lookupObject<incompressible::turbulenceModel>
            (
                "turbulenceModel"
            );

        nuEff = turbModel.nuEff()()[patchI];
    }
As far as I understand it, turbModel.nuEff()()[patchI] should return the values of each face at the patch [patchI]. Therefore the scalarField nuEff should have a size of the nFaces.

At least nuEff is empty:

Code:
nuEff
0()
If I output the nuEff() field like that:
Code:
Info<< turbModel.nuEff() << endl;
I get the list of all boundary's. So far so good. But the access to the patchI is somehow destroyed.

If I use this one, that is exactly the same, I get some complete different values:
Code:
        scalarField nuEff2(turbModel.nuEff()()[patch().index()]);

        Info<< "nuEff2: " << nuEff2 << endl;


Result:

nuEff2
124   (boundary has 500 faces)
(
6.91743e-310
2.3774e-316
4.24399e-314
2.34004e-316
8.3003e-321
4.74303e-322
.
.
.
And if I output it directly I get:
Code:
Info<< "nueff: " << turbModel.nuEff()()[patchI] << endl;


Result:

nueff: 124.601
In a programming point of view this makes not real sense to me (especially the first two):

Code:
        scalarField nuEff2(turbModel.nuEff()()[patch().index()]);
        nuEff = turbModel.nuEff()()[patchI];
Okay there are differences but the field "turbModel.nuEff()()[patchI]" has to be the same as "turbModel.nuEff()()[patch().index()]".

At least the BC will fail because we use nuEff to divide:
Code:
    operator==(tauHat*(tauHat & (tau0_*(1.0/(ry*nuEff)) + Uc)));
Any advice?


Finally, if we output the turbModel.nuEff() we get the correct values:
Code:
.
.
.

    movingWall
    {
        type            calculated;
        value           nonuniform List<scalar> 
500
(
0.285685
0.285685
0.285685
0.285685
0.285685
0.285685
0.285685
0.285685
.
.
.

I also made a bug report now because it seems really strange. http://openfoam.org/mantisbt/view.php?id=2020
rajibroy likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 8, 2016, 08:22
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Maybe I am missing something but, turbulenceModel::nuEff() returns tmp<volScalarField>, so nuEff()() (http://foam.sourceforge.net/docs/cpp...2d975c8876d3d6) is volScalarField and nuEff()()[index] should be scalar.

Yet there is turbulenceModel::nuEff(label patchI), which returns viscosity on a patch.

Could you post whole code snippet (so it could be compiled and tested)?
alexeym is offline   Reply With Quote

Old   March 8, 2016, 08:41
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey Bruno,

thanks for the reference about ()() ... here is the link to the file.
If you are correct and ()()[patchI] returns a scalar, why we use a scalarField nuEff than and can you tell me what scalar is returned? Mean value of the patch or sth. like that?

http://www.openfoam.com/documentatio...36_source.html
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 8, 2016, 09:04
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Not quite Bruno, but OK

Do you talk about line 112 of fixedShearStressFvPatchVectorField.C? It uses turbulenceModel::nuEff(label patchI), which returns tmp<scalarField> (http://www.openfoam.com/documentatio...4f85f6644d2d6a).
alexeym is offline   Reply With Quote

Old   March 8, 2016, 09:14
Default
  #5
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Aaa its version 3.0 Here it the file I was talking about...
Attached Files
File Type: gz fixedShearStress.tar.gz (5.7 KB, 20 views)
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 8, 2016, 09:17
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by alexeym View Post
Hi,

Not quite Bruno, but OK

Do you talk about line 112 of fixedShearStressFvPatchVectorField.C? It uses turbulenceModel::nuEff(label patchI), which returns tmp<scalarField> (http://www.openfoam.com/documentatio...4f85f6644d2d6a).
As I read
Code:
Return the effective viscosity on patch.
it is that i have a scalarField with the size of faces and each field stores one face value, am I right?
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 8, 2016, 09:31
Default
  #7
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
You have scalarField with the size of the patch and it is has scalar for each face value.

Though BC uses this - turbModel.nuEff()()[patchI] - strange construction, turbulenceModel class has nuEff(label patchI) method even in 2.3.1.
Tobi likes this.

Last edited by alexeym; March 8, 2016 at 09:37. Reason: rephrasing
alexeym is offline   Reply With Quote

Old   March 8, 2016, 09:56
Default
  #8
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

Henry changed it: https://github.com/OpenFOAM/OpenFOAM...1fe57e8a140c7c

For 3.0.x it is working now but for 2.3.1 I get an error if I use the code you (or henry) mentioned:
Code:
fixedShearStress/fixedShearStressFvPatchVectorField.C: In member function 'virtual void Foam::fixedShearStressFvPatchVectorField::updateCoeffs()':
fixedShearStress/fixedShearStressFvPatchVectorField.C:136:55: error: no matching function for call to 'Foam::incompressible::turbulenceModel::nuEff(const label&) const'
       const scalarField& nuEff2(turbModel.nuEff(patchI));
                                                       ^
fixedShearStress/fixedShearStressFvPatchVectorField.C:136:55: note: candidate is:
In file included from fixedShearStress/fixedShearStressFvPatchVectorField.C:31:0:
/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:199:37: note: virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::incompressible::turbulenceModel::nuEff() const
         virtual tmp<volScalarField> nuEff() const = 0;
                                     ^
/home/shorty/OpenFOAM/OpenFOAM-2.3.1/src/turbulenceModels/incompressible/turbulenceModel/turbulenceModel.H:199:37: note:   candidate expects 0 arguments, 1 provided
fixedShearStress/fixedShearStressFvPatchVectorField.C:136:26: warning: unused variable 'nuEff2' [-Wunused-variable]
       const scalarField& nuEff2(turbModel.nuEff(patchI));
                          ^
So at last, there is no method for nuEff(label)
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 8, 2016, 10:47
Default
  #9
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Even in 2.3.1 there are two types of turbulence models ones in src/turbulenceModels and another in src/TurbulenceModels (surprise, surprise). First type does not have nuEff(const label), second type has it and for RASModel it is implemented as:

Code:
        //- Return the effective viscosity on patch
        virtual tmp<scalarField> nuEff(const label patchi) const
        {
            return this->nut(patchi) + this->nu(patchi);
        }
nu(patchi) is implemented as (example from Newtonian.H):

Code:
        //- Return the laminar viscosity for patch
        tmp<scalarField> nu(const label patchi) const
        {
            return nu_.boundaryField()[patchi];
        }
nut(patchi) is implemented as (example from eddyViscosity.H):

Code:
        //- Return the turbulence viscosity on patch
        virtual tmp<scalarField> nut(const label patchi) const
        {
            return nut_.boundaryField()[patchi];
        }
so your (well, OpenFOAM's) quite frightening

Code:
nuEff = turbModel.nuEff()()[patchI]
could be in fact

Code:
scalarField nuEff(turbModel.nuEff().boundaryField()[patchI]);
Or you can use transportModel's ability to return nu for a given patch using

Code:
transport().nu(patchI)
so it would be

Code:
scalarField nuEff(transport().nu(patchI) + nut().boundaryField()[patchI]);
Tobi likes this.
alexeym is offline   Reply With Quote

Old   March 8, 2016, 11:58
Default
  #10
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

I will try it tomorrow but today I tried it with boundaryField() without success. Maybe I made a simple mistake. Thanks in advance.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 11, 2016, 07:08
Default
  #11
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I think there might also be problems with memory management. You receive a tmp<volScalarField> without storing it, and only access the boundary. I had a similar issue before and for me it helped to initialize a copy of the volScalarField before accessing the patch values like this:

volScalarField copy(turb->nuEff());

Afterwards you can use the boundaries of the copied field without worrying about the scope of the classes contained in the temporary object. In my case I even regarded it as a bug or atleast a design error.
chriss85 is offline   Reply With Quote

Old   March 11, 2016, 07:29
Default
  #12
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hey,

thanks for the hint. At last the code has to be:
Code:
nuEff = turbModel.nuEff()().boundaryField()[patchI];
I think I will also make a copy (:
rajibroy likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 11, 2016, 18:16
Default strange things explained
  #13
Member
 
Thomas Boucheres
Join Date: May 2013
Posts: 41
Rep Power: 12
thomasArk47 is on a distinguished road
Hello Tobi.
First thanks for your tuto and videos. Good job which could help some people and help OF to be more widely used than it is

For your problem described here, Alexeym gave you good answer (using turbModel.nuEf()().boundaryField()[patchI]).

To complete the post, I can give you some answers to the "strange" things you have mentioned in your first post. All things are related to the fact that turbModel.nuEff()()[patchI] (which is clearly a bug) is a scalar as mentioned by alexeym.

A) What happens is the following:
scalarField nuEff
--> create a scalarField of size 0
nuEff = turbModel.nuEff()()[patchI]
--> it is the UList<Type>:perator =(Type& v) (with Type=scalar) which assign all values of the List to v. But do nothing here since nuEff is of size 0! So nuEff is still empty list and Info << nuEff gives 0().

B) Other thing: your "scalarField nuEff2(turbmodel.nuEff()()[patchI])"...
In fact, you try to construct a scalarField with a constructor scalarField (scalar& v)
But this constructor doesn't exist...
You have scalarField(label i, scalar v) (build a scalarField of size i and all values equal v) but clearly it is not this one you use. In fact, you use the base constructor scalarField(label i) which construct a scalarField of size i and no prescribed values (so compiler dependant / something like VSMALL for most compilers). And what is your i? The integer part of the scalar turbModel.nuEff()()[patchI] (124 for your example).

These things explain what you have seen.
Tobi likes this.
thomasArk47 is offline   Reply With Quote

Old   March 11, 2016, 19:32
Default
  #14
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear Thomas,

thanks for completing the topic and the feedback to my webpage. I am familiar with c++ but the error reported here was from a collegue in the german openfoam forum, that I just investigated during other investigations (: So at last I wanted to report you the bug, learn new things (thanks to you and Alexeym) but I did not investigate into the code deeply and of course I am not a FOAM - code expert (what function will return what or what is doing that). Its good that there are people like you that will clear the questions.

So just one question. If I will create my scalarField nuEff with the size of the real field (lets say 200), and use
Code:
nuEff = turbModel.nuEff()()[patchI]
will it work? I could test it but its 01:32 a.m. and I am too tierd (:

Nice dreams,
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 12, 2016, 15:30
Default
  #15
Member
 
Thomas Boucheres
Join Date: May 2013
Posts: 41
Rep Power: 12
thomasArk47 is on a distinguished road
Well if you write:

"
scalarField nuEff(200) // create a scalarField with size 200 (not yet inialized here)
....
nuEff = turbModel.nuEff()()[patchI] // assign all values of the scalarField as equal to the scalar on the right; comes from UList:perator =(scalar &v); doesn't change the size of the container as said in th previous post
"

at end, all the 200 values of the nuEff list will be equal to the same scalar value turbModel.nuEff()()[patchI]. It takes sense from informatic point of view but it is clearly not what you want I think. You should prefer the scalarField nuEff being equal to the scalarField turbModel.nuEff()().boundaryField()[patchI]. For this, you must use alexeym correct expression:

"
scalarField nuEff // create zero sized List (size doesn't matter here -- see later)
nuEff = turbModel.nuEff()().boundaryField()[patchI] // it is the UList:perator =(UList& f) function. This function resizes the calling list (nuEff here) to the size of the called one (f in the prototype / turbModel..... in the example -- this is why the instanciation of nuEff as a zero sized list doesn't matter) and equals the values.
"
thomasArk47 is offline   Reply With Quote

Old   October 26, 2017, 08:10
Default
  #16
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Quote:
Originally Posted by thomasArk47 View Post
Well if you write:

"
scalarField nuEff(200) // create a scalarField with size 200 (not yet inialized here)
....
nuEff = turbModel.nuEff()()[patchI] // assign all values of the scalarField as equal to the scalar on the right; comes from UList:perator =(scalar &v); doesn't change the size of the container as said in th previous post
"

at end, all the 200 values of the nuEff list will be equal to the same scalar value turbModel.nuEff()()[patchI]. It takes sense from informatic point of view but it is clearly not what you want I think. You should prefer the scalarField nuEff being equal to the scalarField turbModel.nuEff()().boundaryField()[patchI]. For this, you must use alexeym correct expression:

"
scalarField nuEff // create zero sized List (size doesn't matter here -- see later)
nuEff = turbModel.nuEff()().boundaryField()[patchI] // it is the UList:perator =(UList& f) function. This function resizes the calling list (nuEff here) to the size of the called one (f in the prototype / turbModel..... in the example -- this is why the instanciation of nuEff as a zero sized list doesn't matter) and equals the values.
"
Hi
I have a problem with nuEff() because as you said it creates list with size zero.

How to force nuEff() to create a list of mesh size?
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   October 26, 2017, 08:45
Default
  #17
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Basically I overriden nu() to return my volScalarField.
And Now I get the error in nuEff() = this->nut() + this->nu()
that nut() returns zero size list and nu() returns the size equal to e.g. 1400
So the sizes are not equal during summation.

So I am wondering how to force nut() to return the same list size as nu()??
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   October 27, 2017, 03:40
Default
  #18
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Hi
In the RASModel.H we have a function nuEff()
Code:
        //- Return the effective viscosity

         virtual tmp<volScalarField> nuEff() const

         {

             return tmp<volScalarField>

             (

                 new volScalarField

                 (

                     IOobject::groupName("nuEff", this->U_.group()),

                     this->nut() + this->nu()

                 )

             );

         }
I have overriden nu() as
Code:
Foam::tmp<Foam::volScalarField> nu()
{
    return tmp<volScalarField>(dynamicVisc/density);
}
where dynamicVisc is a volScalarField and density is a dimensionedScalar.

When in the UEqn.H I have a code
Code:
turbulence->divDevReff()
nuEff() is run and it sums nut() and nu(). However there is an error because nut() returns zero size list and nu() returns non zero size list (it is equal to the mesh size).

How can I change the code to nut() returns also mesh size list?
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   November 4, 2017, 05:06
Default
  #19
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 15
gaza is on a distinguished road
Quote:
Originally Posted by gaza View Post
Hi
In the RASModel.H we have a function nuEff()
Code:
        //- Return the effective viscosity

         virtual tmp<volScalarField> nuEff() const

         {

             return tmp<volScalarField>

             (

                 new volScalarField

                 (

                     IOobject::groupName("nuEff", this->U_.group()),

                     this->nut() + this->nu()

                 )

             );

         }
I have overriden nu() as
Code:
Foam::tmp<Foam::volScalarField> nu()
{
    return tmp<volScalarField>(dynamicVisc/density);
}
where dynamicVisc is a volScalarField and density is a dimensionedScalar.

When in the UEqn.H I have a code
Code:
turbulence->divDevReff()
nuEff() is run and it sums nut() and nu(). However there is an error because nut() returns zero size list and nu() returns non zero size list (it is equal to the mesh size).

How can I change the code to nut() returns also mesh size list?
Hi
I found how to solve the problem.
I had something like this
Code:
Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::Helium::calcNu() 
{
    volScalarField nu
    (
        IOobject
        (
            "nuLocal",
            U_.time().timeName(),
            U_.db(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        eta_/rho_
    );
    return nu;
}
It compiled however during calculation I got errors like:
Code:
Selecting incompressible transport model Helium
#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-v1606+/src/OSspecific/POSIX/printStack.C:218
#1  Foam::sigSegv::sigHandler(int) at ~/OpenFOAM/OpenFOAM-v1606+/src/OSspecific/POSIX/signals/sigSegv.C:56
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::List<double>::List(Foam::List<double>&, bool) at ~/OpenFOAM/OpenFOAM-v1606+/src/OpenFOAM/lnInclude/List.C:166
#4  Foam::Field<double>::Field(Foam::Field<double>&, bool) at ~/OpenFOAM/OpenFOAM-v1606+/src/OpenFOAM/lnInclude/Field.C:223
#5  Foam::DimensionedField<double, Foam::volMesh>::DimensionedField(Foam::IOobject const&, Foam::DimensionedField<double, Foam::volMesh>&, bool) at ~/OpenFOAM/OpenFOAM-v1606+/src/OpenFOAM/lnInclude/DimensionedField.C:203 (discriminator 2)
#6  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ~/OpenFOAM/OpenFOAM-v1606+/src/OpenFOAM/lnInclude/GeometricField.C:498
#7  Foam::viscosityModels::Helium::Helium(Foam::word const&, Foam::dictionary const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/przemek-v1606+/src/transportModels/incompressible/viscosityModels/Helium/Helium.C:276 (discriminator 86)
#8  Foam::viscosityModel::adddictionaryConstructorToTable<Foam::viscosityModels::Helium>::New(Foam::word const&, Foam::dictionary const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/przemek-v1606+/src/transportModels/incompressible/lnInclude/viscosityModel.H:96 (discriminator 2)
#9  Foam::viscosityModel::New(Foam::word const&, Foam::dictionary const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/OpenFOAM-v1606+/src/transportModels/incompressible/viscosityModels/viscosityModel/viscosityModelNew.C:58
#10  Foam::singlePhaseTransportModel::singlePhaseTransportModel(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ~/OpenFOAM/OpenFOAM-v1606+/src/transportModels/incompressible/singlePhaseTransportModel/singlePhaseTransportModel.C:50 (discriminator 12)
#11  ? at ~/OpenFOAM/OpenFOAM-v1606+/applications/solvers/heatTransfer/buoyantBoussinesqPimpleFoam/../buoyantBoussinesqSimpleFoam/readTransportProperties.H:7
#12  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#13  ? at ??:?
Segmentation fault (core dumped)
where Helium is my viscosityModel.

When I changed the nuCalc() function like this:

Code:
Foam::tmp<Foam::volScalarField>
Foam::viscosityModels::Helium::calcNu() 
{
    volScalarField nu
    (
        IOobject
        (
            "nuLocal",
            U_.time().timeName(),
            U_.db(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        eta_/rho_
    );

    return max
    (
        nuMin_,
        min
        (
            nuMax_,
            nu
        )
    );
}
everything works well (at least solver runs). In my code eta_ is a volScalarField and rho_ is a dimensionedScalar.

Can anybody explain why this second solution works and the first doesn't?
__________________
best regards
pblasiak
gaza is offline   Reply With Quote

Old   November 5, 2017, 14:43
Default
  #20
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Can you tell us how you access the field nuHelium() in your solver.
__________________
Keep foaming,
Tobias Holzmann
Tobi 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
Calculating divDevReff jposunz OpenFOAM Running, Solving & CFD 82 June 12, 2022 14:01
Add new nuEff() law to simpleFoam T.D. OpenFOAM Running, Solving & CFD 2 July 16, 2015 07:27
Calculate and display eddy viscosity ceyrows OpenFOAM Running, Solving & CFD 4 February 16, 2009 12:57


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