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

How to add Surface Tension in cavitatingFoam solver

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 29, 2016, 13:24
Smile How to add Surface Tension in cavitatingFoam solver
  #1
New Member
 
Xin Tang
Join Date: Feb 2016
Location: College Station, Texas, USA
Posts: 2
Rep Power: 0
jamestangx is on a distinguished road
Dear Foamers,

I am new to OpenFoam and want to add surface tension to the cavitatingFoam solver. Is it possible to add surface tension in cavitatingFoam?

[Background]
I want to add surface tension term in cavitatingFoam solver to calculate collapsing cavitation (need compressible two phase solver). And I tried to implement surface tension according to interFoam solver. The new solver called cavitatingSTFoam is created and major files are attached. (The zip file of the whole solver exceeds the maxfilesize 195.3K, so I just upload the modified major files)

In interFoam.C, the immiscibleIncompressibleTwoPhaseMixture.H is included and the following code is used for surface tension term:

Code:
fvc::reconstruct
             (
                (
                    mixture.surfaceTensionForce()
                ) * mesh.magSf()
             )
However, the cavitatingFoam solver uses a different model and include "incompressibleTwoPhaseMixture.H" which dose not have surfaceTensionForce().

I tried to use the same continuum method to model the surface tension and add it in UEqn.H of cavitatingFoam refer to the previous thread Plotting suface tension with interFoam. New problem pops up for "interface","alpha1" and reconstruct function in "UEqn.H".

error message for "interface"
Code:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:78:44: error: ‘interface’ was not declared in this scope
         fvc::reconstruct((fvc::interpolate(interface.sigmaK())*fvc::snGrad(alphal))* mesh.magSf())
error message for "alpha1"
Code:
cavitatingSTFoam.C:100:55: error: ‘alpha1’ was not declared in this scope
  f = fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1);
error message for "reconstruct"

Code:
In file included from cavitatingSTFoam.C:86:0:
UEqn.H:39:14: error: no matching function for call to ‘reconstruct(Foam::tmp<Foam::Field<Foam::Vector<double> > >)’
              )
              ^
UEqn.H:39:14: note: candidates are:
In file included from /opt/openfoam240/src/finiteVolume/lnInclude/fvcReconstruct.H:85:0,
                 from /opt/openfoam240/src/finiteVolume/lnInclude/fvc.H:43,
                 from /opt/openfoam240/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from cavitatingSTFoam.C:35:
/opt/openfoam240/src/finiteVolume/lnInclude/fvcReconstruct.C:53:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::reconstruct(const Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>&)
 reconstruct
 ^
/opt/openfoam240/src/finiteVolume/lnInclude/fvcReconstruct.C:53:1: note:   template argument deduction/substitution failed:
In file included from cavitatingSTFoam.C:86:0:
UEqn.H:39:14: note:   ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ is not derived from ‘const Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>’
              )
              ^
In file included from /opt/openfoam240/src/finiteVolume/lnInclude/fvcReconstruct.H:85:0,
                 from /opt/openfoam240/src/finiteVolume/lnInclude/fvc.H:43,
                 from /opt/openfoam240/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from cavitatingSTFoam.C:35:
/opt/openfoam240/src/finiteVolume/lnInclude/fvcReconstruct.C:95:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::outerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::reconstruct(const Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >&)
 reconstruct
 ^
/opt/openfoam240/src/finiteVolume/lnInclude/fvcReconstruct.C:95:1: note:   template argument deduction/substitution failed:
In file included from cavitatingSTFoam.C:86:0:
UEqn.H:39:14: note:   mismatched types ‘Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>’ and ‘Foam::Field<Foam::Vector<double> >’
              )
              ^
UEqn.H:39:14: note:   ‘Foam::tmp<Foam::Field<Foam::Vector<double> > >’ is not derived from ‘const Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >’
Any ideas?
Thanks for your time,any help and advice is appreciated!
Attached Files
File Type: h UEqn.H (926 Bytes, 23 views)
File Type: h createFields.H (2.6 KB, 16 views)
File Type: c cavitatingSTFoam.C (3.5 KB, 10 views)

Last edited by jamestangx; March 29, 2016 at 22:34. Reason: English statements
jamestangx is offline   Reply With Quote

Old   April 6, 2016, 16:39
Default Surface Tension Added
  #2
New Member
 
Xin Tang
Join Date: Feb 2016
Location: College Station, Texas, USA
Posts: 2
Rep Power: 0
jamestangx is on a distinguished road
I finally added the surface tension term successfully by trial and error. I will share with everyone in case you met the same problem.

error message for "interface"
I included the following header files compared to OpenFoam 2.1 interFoam solver in my solver source code

Code:
// imported from interFoam 2.1
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"
error message for "alpha1"
in createFields.H file, there is declarators for alphav, alphal. I don't know why it does not work with alpha1, however, when I change alpha1 ->alphal, the solver can be wmake sucessfully.
Code:
    incompressibleTwoPhaseMixture mixture(U, phi);
    volScalarField& alphav(mixture.alpha1());
    alphav.oldTime();
    volScalarField& alphal(mixture.alpha2());
error message for "reconstruct"
Also in "creatFields.H", the following codes should be added. And call the function of interface from "interfaceProperties.H"
Code:
// surface tension force is the same to the previous thread plotting surface tension with interFoam
// Construct interface from alphal distribution
    interfaceProperties interface(alphal, U, mixture);
    volVectorField f
    (
        IOobject
        (
            "f",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        fvc::reconstruct((fvc::interpolate(interface.sigmaK())*fvc::snGrad(alphal))* mesh.magSf())
    );
Finally, you can also add f=fvc::reconstruct((fvc::interpolate(interface.sig maK())*fvc::snGrad(alphal))* mesh.magSf()) in the source file for further postprocessing. And the following figure are the final results of surface tension magnitude and tangent vector in the slice view of the cavitation in water using tecplot 360.
Attached Images
File Type: png ST_mag.PNG (39.7 KB, 67 views)

Last edited by jamestangx; April 6, 2016 at 22:32.
jamestangx 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
Help!! customize surface tension term in interFoam w051cxw OpenFOAM Programming & Development 5 February 12, 2016 14:56
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan OpenFOAM Meshing & Mesh Conversion 3 October 22, 2015 11:05
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 02:09
VOF +surface tension force modeling+ open channel flow+cyclic region= fatal error? SJSW Fluent Multiphase 2 November 18, 2014 04:15
Surface Tension Test Cases sega OpenFOAM Running, Solving & CFD 2 March 8, 2011 12:19


All times are GMT -4. The time now is 09:02.