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

using dot products within fvOptions vectorCodedSource

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 11, 2022, 21:31
Default using dot products within fvOptions vectorCodedSource
  #1
New Member
 
Join Date: Oct 2021
Posts: 2
Rep Power: 0
brucethemuce is on a distinguished road
I am implementing marangoni convection in compressibleMultiphaseInterFoam. Modifying the source code directly works as expected by the same form does not work in with fvOptions.
Using just fvc::grad(T) works fine, but the equation needs the gradient tangential to the interface.

Any ideas or help is much appreciated.

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

MarangoniSource
  {
    type            vectorCodedSource;
    active          true;
    selectionMode   all;
    fields (rho, U);
    name MarangoniSource;

  codeLibs
  #{

  #};

    codeInclude
    #{
      #include "fvcDiv.H"
      #include "fvcGrad.H"
      #include "fvcSnGrad.H"
      #include "fvcFlux.H"
      #include "fvcMeshPhi.H"
      #include "surfaceInterpolate.H"
      #include "fvCFD.H"
      #include "fvc.H"
    #};

codeAddSup
#{
    vectorField& tangent_source = eqn.source(); //source will be a vector field
    const volScalarField& T = mesh_.lookupObject<volScalarField>("T");  
    const volScalarField& alpha1 = mesh_.lookupObject<volScalarField>("alpha.vapor");
    const volScalarField& alpha2 = mesh_.lookupObject<volScalarField>("alpha.pentane");
    const volVectorField& n      =( alpha2*fvc::grad(alpha1) - alpha1*fvc::grad(alpha2)  ); //normal vector to interface
    const volVectorField& nHat   = 
    (n /(( mag(n) ) 
    + dimensionedScalar("tinyNumber", dimensionSet(0, -1, 0, 0, 0, 0, 0), 1e-8))); //unit normal


    const volVectorField& Tangent=
      (
        mag(n)*
        dimensionedScalar("dSigma_dT", dimensionSet(1, 0, -2, -1, 0, 0, 0),-1e-4) *
        (
            (
                fvc::grad(T) 
                - (nHat & fvc::grad(T)) * (nHat) //problem is here
            )
        )
      ); //end field

    forAll(tangent_source, i){
      tangent_source[i][0] += Tangent[i][0];
      tangent_source[i][1] += Tangent[i][1];
      tangent_source[i][2] += Tangent[i][2];
    }

Pout << "*adding the tangent surface tension force*" << endl;
#}; //end of addsup

  codeCorrect
  #{

  #};

  codeConstrain
  #{

  #};

}//end of source

// ************************************************************************* //
brucethemuce is offline   Reply With Quote

Reply

Tags
fvoptions momentum source, multiphase flow, surface tension


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
Fixing U with vectorCodedSource via fvOptions Tibo99 OpenFOAM Running, Solving & CFD 2 January 25, 2022 11:48
cannot use fvOptions vectorCodedSource in parallel simulation Sgs OpenFOAM Running, Solving & CFD 3 October 13, 2020 01:36
Configuration of boundary conditions and fvOptions file Raza Javed OpenFOAM Running, Solving & CFD 16 May 3, 2019 17:35
Boundary conditions for a flame burning with wind David Main CFD Forum 2 February 4, 2005 06:59
chemical reaction - decompostition La S. Hyuck CFX 1 May 23, 2001 01:07


All times are GMT -4. The time now is 03:58.