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

new curvature model with interFoam

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 19, 2009, 13:13
Default new curvature model with interFoam
  #1
New Member
 
Chris
Join Date: Oct 2009
Posts: 5
Rep Power: 8
DaChris is on a distinguished road
Hi,

I want to test a new curvature model by using InterFoam. When I try to compile the following code I get an error, but I don't know how to fix it. I hope, someone can help me.

Code:
//Cell gradient of gamma
    volVectorField gradGamma = fvc::grad(gamma);
    // Interpolated face-gradient of gamma
    
    surfaceScalarField phiGradGamma = fvc::interpolate(gradGamma)& mesh.Sf();
     
    //curvature  
    surfaceScalarField kappa =     ((1) / mag(gradGamma))
                    * (((gradGamma)/(mag(gradGamma))) 
                    * fvc::grad(mag(gradGamma)) 
      //line.29=>              - fvc::div(phiGradGamma));
And this is the first error:
Quote:
curvature.H:29: error: conversion from ‘Foam::tmp<Foam::GeometricField<Foam::Tensor<doubl e>, Foam::fvPatchField, Foam::volMesh> >’ to non-scalar type ‘Foam::surfaceScalarField’ requested
DaChris is offline   Reply With Quote

Old   November 20, 2009, 11:01
Default
  #2
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 9
kathrin_kissling is on a distinguished road
Dear Chris,

the error you get tells you your problem quite clearly. You just need to check carefully.
You want to calculate a surfaceScalarField for the curvature. Obviosly there is a volTensorField somewhere inside your calculation. Because it is not possible to initialize a surfaceScalarField by a volTensorField you get an error.
Go carefully through your expression and you will find

//curvature
surfaceScalarField kappa = ((1) / mag(gradGamma))
* (((gradGamma)/(mag(gradGamma)))
* fvc::grad(mag(gradGamma))
//line.29=> - fvc::div(phiGradGamma));(1)/mag(gradGamma) gives you a volScalarField (remember you want to have a surfaceScalarField, at least you seam to initialize it that way)

you multiply it by the volVectorField (gradGamma)/mag(gradGamma)
now you have a volVectorField

now you perform another multiplication and I'm not sure what you inted to do. you multiply it by another volVectorField. The * operator gives you the outer product of two vectors and produces a tensor. Now we have your volTensorField. In addition you now want to subtract the divergence of a scalar? What is that?

In summary:

1. you are not allowed to mix fields defined on the faces and on the volumes.

2. you should go over your mathematics, I think theres a bug inside your implementation or inside the equation you are trying to implement. If you need help on that, we would need the equation

Hope this helps
Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   November 21, 2009, 11:42
Default
  #3
New Member
 
Chris
Join Date: Oct 2009
Posts: 5
Rep Power: 8
DaChris is on a distinguished road
Dear Kathrin,

thank you for the hints. I think my implementation is blemished. I'll go through my implementation and try to correct it. If this doesn't work, I would post the equation.


Best

Chris
DaChris is offline   Reply With Quote

Old   December 2, 2009, 07:26
Default
  #4
New Member
 
Chris
Join Date: Oct 2009
Posts: 5
Rep Power: 8
DaChris is on a distinguished road
Hi,

I did it and compiled the solver, but a new problem appears.

Here is the equation: \kappa=\frac{1}{|\nabla\gamma|}\ast\left[\frac{\nabla\gamma}{|\nabla\gamma|}\circ\nabla|\nabla\gamma|-\nabla\circ\nabla\gamma\right]


Code:
volVectorField gradGamma = fvc::grad(gamma);

volScalarField kappa =     ((1) / mag(gradGamma))
                    *((((gradGamma)/(mag(gradGamma)))  
                    & fvc::grad(mag(gradGamma)))
                     - (fvc::div(gradGamma)
                    ));
Further the undefined keyword is caused by (fvc::div(gradGamma)).
Quote:
keyword div(grad(gamma)) is undefined in dictionary "~/case/yTestCase2/system/fvSchemes::divSchemes"

file: ~/case/yTestCase2/system/fvSchemes::divSchemes from line 33 to line 40.

From function dictionary::lookupEntry(const word& keyword) const
in file db/dictionary/dictionary.C at line 213.

FOAM exiting
When I define the keyword in fvSchemes, I get an EOF error for Gauss upwind e.g and when I try Gauss linear, I get a floating Point exception.

Quote:
#0 Foam::error:rintStack(Foam::Ostream&) in "/home/caelinux/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/caelinux/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib/libc.so.6"
#3 Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) in "/home/caelinux/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#4 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:perator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/caelinux/OpenFOAM/caelinux-1.5/applications/bin/linux64GccDPOpt/myFoam"
#5 main in "/home/caelinux/OpenFOAM/caelinux-1.5/applications/bin/linux64GccDPOpt/myFoam"
#6 __libc_start_main in "/lib/libc.so.6"
#7 Foam::regIOobject::readIfModified() in "/home/caelinux/OpenFOAM/caelinux-1.5/applications/bin/linux64GccDPOpt/myFoam"
Floating point exception
DaChris is offline   Reply With Quote

Old   December 2, 2009, 07:47
Default
  #5
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 9
kathrin_kissling is on a distinguished road
Hi Chris,

what you yre trying to do is applying a laplacian. So you should do something like

fvc::laplacian(gamma)

instead of

fvc::div(gradGamma)

be very carefull with the mathematics!

of course, then you need to specify a laplacian scheme.

You can also go


fvc::laplacian(gamma, nameOfYourDesiredScheme)

then the scheme is hardcoded and cannot be changed from fvSchemes.

Check on src/finiteVolume/finiteVolume/fvc/fvcLaplacian.H/.C

for details.

Hope this helps

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   December 2, 2009, 08:41
Default
  #6
New Member
 
Chris
Join Date: Oct 2009
Posts: 5
Rep Power: 8
DaChris is on a distinguished road
Hi kathrin,

I tried fvc::laplacian(gamma) with Gauss linear corrected, running the case and I get a floating point exception.

Quote:
#0 Foam::error:rintStack(Foam::Ostream&) in "/home/caelinux/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/caelinux/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib/libc.so.6"
#3 Foam::divide(Foam::Field<double>&, double const&, Foam::UList<double> const&) in "/home/caelinux/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#4 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:perator/<Foam::fvPatchField, Foam::volMesh>(Foam::dimensioned<double> const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/caelinux/OpenFOAM/caelinux-1.5/applications/bin/linux64GccDPOpt/cstFoam"
#5 main in "/home/caelinux/OpenFOAM/caelinux-1.5/applications/bin/linux64GccDPOpt/myFoam"
#6 __libc_start_main in "/lib/libc.so.6"
#7 Foam::regIOobject::readIfModified() in "/home/caelinux/OpenFOAM/caelinux-1.5/applications/bin/linux64GccDPOpt/myFoam"
Floating point exception
Unfortunately, my OpenFoam skills are too low to interpret this error.
DaChris is offline   Reply With Quote

Old   December 2, 2009, 09:57
Default
  #7
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 9
kathrin_kissling is on a distinguished road
Could you do me a favour?

Get rid of the laplacian term for a second, and check whether the problem really is in that one.

If this is not the point.

Maybe your dividing by zero somewhere.
Try

1/(mag(gradGamma)+SMALL)
where SMALL is a small number rescueing you from dividing by zero, which will definitly give you a floating point exeption.

Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   December 2, 2009, 13:37
Default
  #8
New Member
 
Chris
Join Date: Oct 2009
Posts: 5
Rep Power: 8
DaChris is on a distinguished road
Hi Kathrin,

I tried +SMALL, but it seems there are more divisions by zero. I think this division makes problems:

gradGamma/mag(gradGamma)

When I look into interfaceProperties, I find this:
surfaceVectorField nHatfv = gradGammaf/(mag(gradGammaf) + deltaN_)

I'm not sure, but I think that this missing deltaN_ causes the floating point exceptions.

deltaN_ ( "deltaN" 1e-8/pow(average(gamma.mesh().V()), 1.0/3.0) )


Edit:
I fixed the floating point exception. The problem was a couple of division by zero. Thank you very much Kathrin for the hint. But now, there is a dimension problem.

Best

Chris

Last edited by DaChris; December 2, 2009 at 18:02.
DaChris is offline   Reply With Quote

Old   October 22, 2010, 08:45
Default
  #9
Member
 
Duong A. Hoang
Join Date: Apr 2009
Location: Delft, Netherlands
Posts: 92
Rep Power: 9
duongquaphim is on a distinguished road
Send a message via Yahoo to duongquaphim
Hi Chris,

I am doing Taylor bubble simulation with OF. I also have some problems with curvature since it is very important in my flow.

Do you get a better result with your model of calculating curvature? Can you share some of your tests?

Regards,

Duong
duongquaphim is offline   Reply With Quote

Old   March 2, 2011, 10:18
Default
  #10
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 296
Rep Power: 8
Andrea_85 is on a distinguished road
Hi,

I also try to define the curvature of the interface for my simulation using interFoam. Has anyone found a good way to get it?? because with the classical definition in interfaceProperties.C i get strange results.

Thanks
andrea
Andrea_85 is offline   Reply With Quote

Old   May 31, 2013, 09:53
Default
  #11
Member
 
Join Date: Aug 2011
Posts: 82
Rep Power: 6
idefix is on a distinguished road
Hi,

I am a little confused of how the interface in a cell is modeled in the interFoam-solver. I´ve got difficulties to imagine one step.

If I am right, the following steps are repeated:
- alpha1 is calculated
- interface unit normal vector is calculated (PhD Rusche eq(4.17))
- the curvature is calculated with this normal vector.

I can´t really understand how I get the interface from the curvature.

Can somebody help me please?

Thanks a lot
Idefix
idefix is offline   Reply With Quote

Old   July 10, 2014, 10:24
Default
  #12
Member
 
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 36
Rep Power: 5
vigneshTG is on a distinguished road
Hi all !!

I am also trying to model the surface tension force with a new formulation :F_{\sigma}=\sigma* \nabla^{2}\alpha* \hat{n}

I have modified some of the lines (in bold letters) in PEqn.H file in interfoam solver directory to model the force.
Code:
volScalarField lapalpha(fvc::laplacian(alpha1));
surfaceScalarField phig
    (
        (

                 fvc::interpolate(lapalpha)*interface.sigma()*interface.nHatf()
           - ghf*fvc::snGrad(rho)
        )*rAUf*mesh.magSf()
    );
I was able to compile the solver but, when i run a test case, i get floating point exception (core dumped) error. Can someone help me with this ?
Also, I want to know whether i have coded correctly ?

I am new to Openfoam !!

Thanks and Regards
Vignesh TG
vigneshTG is offline   Reply With Quote

Old   February 6, 2015, 05:36
Default
  #13
New Member
 
Martin K
Join Date: Jan 2013
Location: Germany
Posts: 28
Rep Power: 5
Martin_K_lalelu is on a distinguished road
Hi Vignesh,

curvature calculation seems to be crucial in interfoam/CSF, did you make any progress with this approach?


best regards

Martin


Martin_K_lalelu is offline   Reply With Quote

Old   February 6, 2015, 06:04
Default
  #14
Member
 
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 36
Rep Power: 5
vigneshTG is on a distinguished road
Hi Martin,

I implemented the above formulation but it doesn't work properly. I suggest you to give a try to the code interfoamssf posted in this thread !! There is also a paper by the same person regarding its formulation.

also this thread how is parasitic currents now ?
__________________
Thanks and Regards

Vignesh TG
vigneshTG is offline   Reply With Quote

Old   February 6, 2015, 08:19
Default
  #15
New Member
 
Martin K
Join Date: Jan 2013
Location: Germany
Posts: 28
Rep Power: 5
Martin_K_lalelu is on a distinguished road
Thanks a lot for your answer, I will have a look!
Martin_K_lalelu is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems bout CFD model of biomass gasification, Downdraft gasifier wanglong FLUENT 2 November 26, 2009 00:27
help for different between les model (subgrid-scale model) liuyuxuan FLUENT 1 October 2, 2009 15:25
Grid resolution for full-scale and down scaled model gravis Main CFD Forum 0 October 2, 2009 10:27
references about the fan/radiator model Mihai ARGHIR FLUENT 0 December 17, 2000 07:40
Advanced Turbulence Modeling in Fluent, Realizable k-epsilon Model Jonas Larsson FLUENT 5 March 13, 2000 04:27


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