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

Solver modification [noob question]

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 2, 2019, 10:49
Default Solver modification [noob question]
  #1
New Member
 
Cagkan
Join Date: Aug 2015
Posts: 8
Rep Power: 10
cagkn is on a distinguished road
Hello everyone,

I'm trying to form a 2D numerical wave tank in OF and using interFoam solver with turbulence. When you try to include both turbulence and wave action in the same model waves starts to dampen as they propagate. VOF scheme in the interFoam is the reason for that, and I'm experiencing the exact thing.

In "Multiphase and Free-Surface Flow Simulations" presentation, Mr. Paterson showed a way to overcome that problem by modifying the air convection eq. by multiplying it with phase fraction, gamma.

in UEqn.H, I've add the red line but,

Code:
MRF.correctBoundaryVelocity(U);

    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U) 
      + gamma*fvm::div(rhoPhi, U)
      + MRF.DDt(rho, U)
      + turbulence->divDevRhoReff(rho, U)
     ==
        fvOptions(rho, U)
    );
when I try to compile it, ends with this error.

Code:
/opt/OpenFOAM/OpenFOAM-v1812/src/finiteVolume/lnInclude/fvMatrix.C:2310:33: note: candidate: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator*(const Foam::dimensioned<double>&, const Foam::tmp<Foam::fvMatrix<Type> >&)
 Foam::tmp<Foam::fvMatrix<Type>> Foam::operator*
                                 ^~~~
/opt/OpenFOAM/OpenFOAM-v1812/src/finiteVolume/lnInclude/fvMatrix.C:2310:33: note:   template argument deduction/substitution failed:
In file included from interFoamMod.C:159:0:
UEqn.H:6:33: note:   cannot convert ‘gamma’ (type ‘double(double) throw ()’) to type ‘const Foam::dimensioned<double>&’
       + gamma*fvm::div(rhoPhi, U)
What is the right way to add phase fraction value in the equation?

Sorry for the long post

Thanks in advance

Cagkan
cagkn is offline   Reply With Quote

Old   March 5, 2019, 06:32
Default
  #2
Member
 
Mat
Join Date: Jan 2012
Posts: 60
Rep Power: 14
Mat_fr is on a distinguished road
Hi,


Which solver did you use ?
How is gamma declared ?
This is just a compatibility problem.


Regards,
Mat
Mat_fr is offline   Reply With Quote

Old   March 5, 2019, 06:39
Default
  #3
New Member
 
Cagkan
Join Date: Aug 2015
Posts: 8
Rep Power: 10
cagkn is on a distinguished road
Quote:
Originally Posted by Mat_fr View Post
Hi,


Which solver did you use ?
How is gamma declared ?
This is just a compatibility problem.


Regards,
Mat
Hi Mat,

I'm using openFoam v1812. The Base solver that I'm modifying is interFoam solver.

What do you mean with gamma declaration? sorry but I didn't get it
cagkn is offline   Reply With Quote

Old   March 5, 2019, 07:30
Default
  #4
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Quote:
Originally Posted by cagkn View Post
Hello everyone,

I'm trying to form a 2D numerical wave tank in OF and using interFoam solver with turbulence. When you try to include both turbulence and wave action in the same model waves starts to dampen as they propagate. VOF scheme in the interFoam is the reason for that, and I'm experiencing the exact thing.

In "Multiphase and Free-Surface Flow Simulations" presentation, Mr. Paterson showed a way to overcome that problem by modifying the air convection eq. by multiplying it with phase fraction, gamma.

in UEqn.H, I've add the red line but,

Code:
MRF.correctBoundaryVelocity(U);

    fvVectorMatrix UEqn
    (
        fvm::ddt(rho, U) 
      + gamma*fvm::div(rhoPhi, U)
      + MRF.DDt(rho, U)
      + turbulence->divDevRhoReff(rho, U)
     ==
        fvOptions(rho, U)
    );
when I try to compile it, ends with this error.

Code:
/opt/OpenFOAM/OpenFOAM-v1812/src/finiteVolume/lnInclude/fvMatrix.C:2310:33: note: candidate: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator*(const Foam::dimensioned<double>&, const Foam::tmp<Foam::fvMatrix<Type> >&)
 Foam::tmp<Foam::fvMatrix<Type>> Foam::operator*
                                 ^~~~
/opt/OpenFOAM/OpenFOAM-v1812/src/finiteVolume/lnInclude/fvMatrix.C:2310:33: note:   template argument deduction/substitution failed:
In file included from interFoamMod.C:159:0:
UEqn.H:6:33: note:   cannot convert ‘gamma’ (type ‘double(double) throw ()’) to type ‘const Foam::dimensioned<double>&’
       + gamma*fvm::div(rhoPhi, U)
What is the right way to add phase fraction value in the equation?

Sorry for the long post

Thanks in advance

Cagkan

Hi!


Your gamma declaration is wrong. You have to declare gamma as a dimensioned double.
Read these lines:
Code:
UEqn.H:6:33: note:   cannot convert ‘gamma’ (type ‘double(double) throw  ()’) to type ‘const Foam::dimensioned<double>&’
       + gamma*fvm::div(rhoPhi, U)
simrego is offline   Reply With Quote

Old   March 5, 2019, 07:39
Default
  #5
New Member
 
Cagkan
Join Date: Aug 2015
Posts: 8
Rep Power: 10
cagkn is on a distinguished road
Hi,

Thank you for responding

I've read the error code, my question is how to declare gamma correctly.

I've tried "gamma()" and "gamma.value()" but couldn't managed to compile it.
cagkn is offline   Reply With Quote

Old   March 5, 2019, 07:59
Default
  #6
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
You can find constructors for a dimensionedScalar here:
https://cpp.openfoam.org/v6/dimensio...ce.html#l00076


BUT! You said "multiplying it with phase fraction, gamma."
Then why don't you use the alpha instead? If I'm correct you can access it with alpha1 or alpha2, or maybe mixture.alpha1() and mixture.alpha2(), honestly I'm not sure which is the correct one. These are volScalarFields and I think you can use them in the equation.
simrego is offline   Reply With Quote

Old   March 8, 2019, 07:17
Default Declare gamma as a scalar
  #7
New Member
 
Ramzy
Join Date: Apr 2018
Location: Raleigh, NC
Posts: 1
Rep Power: 0
Ramzy1990 is on a distinguished road
Good Day,

You will have to declare gamma for the code to understand it. In other words, the code does not know what is gamma, or, it is defined inside the code already with another definition that is not suitable for the equation.

1- The gamma you mentioned seems to be a scalar. Hence, you want to tell the code that. This is done by declaration in side a file called creatFields ( probably) related to the solver you are using. If you open it, just copy the definition used for "rho" and use it for gamma, it will be a volScalarField. Moreover, you have to search where the "rho" is mentioned ( i.e. not only its definition as a volScalarField) and do that for gamma as well.

Note that you will have to initialize it then, i.e. use a boundary file for it like you do for velocity for e.g.

2- Another better method is to define it as a constant ( if it is indeed a constant ). You will then have to declare it as a scalar, and make it to be read from a dictionary and such.
Ramzy1990 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
thobois class engineTopoChangerMesh error Peter_600 OpenFOAM 4 August 2, 2014 09:52
Divergence problem Smaras FLUENT 13 February 21, 2013 05:03
3d vof Smaras FLUENT 2 February 19, 2013 06:58
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 14:08
Error during Solver cfd guy CFX 4 May 8, 2001 06:04


All times are GMT -4. The time now is 21:57.