https://linen.dev logo
Join Discord
Powered by
# function-objects
  • m

    Moose

    07/10/2025, 9:06 AM
    if I understand this, we can add our own forces even if they are not listed there right ? Like shear lift, we would have to type directly the formula ?
  • y

    Yann

    07/10/2025, 9:09 AM
    you can use semi implicit source to add source on a variable (typically used to add a heat source in a heat transfer case) there is also a coded source where you can basically do whatever you need to as long as you code it yourself
  • m

    Moose

    07/10/2025, 9:10 AM
    okay that was my second guess, making my own functions in the class
  • y

    Yann

    07/10/2025, 9:10 AM
    and of course you can compile your own model
  • y

    Yann

    07/10/2025, 9:11 AM
    gotta use the resources when it exists!!
  • y

    Yann

    07/10/2025, 9:12 AM
    despite I feel like the .com doc is kinda abandoned
  • m

    Moose

    07/10/2025, 9:12 AM
    https://www.cfd-online.com/Forums/openfoam-programming-development/251466-unable-apply-fvconstraints-custom-solver.html this post made me realize that in the compilation of the solver we can see if they have fvOptions/fvConstraints !
  • m

    Moose

    07/10/2025, 9:13 AM
    (so for those wondering, here is a way to find it !)
  • m

    Moose

    07/10/2025, 9:13 AM
    I mean, they release a lot, but I assume they play on retrocompatibility not to need too much new documentation ?
  • o

    otaolafr

    07/10/2025, 9:14 AM
    oh I meant 'how the F. you find them' ahahah but for sure it is nice!
  • y

    Yann

    07/10/2025, 9:16 AM
    the thing is, this doc is only partial, and some part are just wrong / not up to date
  • y

    Yann

    07/10/2025, 9:17 AM
    Yeah, you can see in in the solver.C file, eg for ``simpleFoam``:
    Copy code
    #include "fvCFD.H"
    #include "dynamicFvMesh.H"
    #include "singlePhaseTransportModel.H"
    #include "turbulentTransportModel.H"
    #include "simpleControl.H"
    #include "fvOptions.H"
    https://develop.openfoam.com/Development/openfoam/-/blob/master/applications/solvers/incompressible/simpleFoam/simpleFoam.C
  • y

    Yann

    07/10/2025, 9:20 AM
    And it also shows up in the equations, for instance in ``UEqn.H``:
    Copy code
    tmp<fvVectorMatrix> tUEqn
        (
            fvm::div(phi, U)
          + MRF.DDt(U)
          + turbulence->divDevReff(U)
         ==
            fvOptions(U)
        );
  • m

    Moose

    07/10/2025, 9:28 AM
    Thanks a lot, that is exactly what I was searching for ! Now I will put this in interCondensatingEvaporatingFoam ✨
  • y

    Yann

    07/10/2025, 9:32 AM
    it already supports fvOptions, so you just need to use the model you want, or code your own if nothing suits your need
  • k

    Kringel

    07/23/2025, 10:46 AM
    I want to be able to track the velocity of my "particles" (volume fraction) in a VoF solver with a function object. With time, preferably the velocity of the center of mass of my volume fraction field. Is there a function object that does this already, or what would be an appropriate starting point to make it myself?
  • j

    June

    07/25/2025, 5:58 AM
    You can try below one as the starting point and keep the outputs you need: https://github.com/tmaric/TwoPhaseFlow/blob/feature/density-ratio/run/rhoVoF/translatingDropletInQuiescentFluid3D/NewU-templateCase/system/FObubbleProcessing
  • a

    anshulg

    08/07/2025, 10:39 PM
    so im trying to get cut planes to visualize flow but for some reason it is not saving the vtk files in the postprocessing file. is there something wrong with the way i have it set up
    Copy code
    functions
    {
        myCutPlane
        {
            type            surfaces;
            libs            ("libsampling.so");
            writeControl    writeTime;
            surfaceFormat   vtk;
            writeFormat     binary;
            fields          (p U); 
            interpolationScheme cellPoint;
    
            surfaces
            {
                myCutPlane
                {
                    type            cutPlane;
                    planeType       pointAndNormal;
                    point           (0 0 0);
                    normal          (0 0 1);
                    interpolate     true;
                }
            }
        }
    }
    or does it pop up after i do
    Copy code
    foamToVTK
  • a

    anshulg

    08/07/2025, 10:40 PM
    i am using decomposePar as weel, wondering if that is causing the issue
  • y

    Yann

    08/08/2025, 7:19 AM
    the function is supposed to write the vtk files while the solver is running, no need for foamToVTK
  • y

    Yann

    08/08/2025, 7:22 AM
    and the files should be written every time the solver write to disk
  • y

    Yann

    08/08/2025, 7:22 AM
    what OpenFOAM version are you using?
  • a

    anshulg

    08/08/2025, 9:34 AM
    OpenFOAM -13
  • a

    anshulg

    08/08/2025, 9:40 AM
    The postProcessing/myCutPlane/0/ is always empty
  • a

    anshulg

    08/08/2025, 9:42 AM
    Wait
  • a

    anshulg

    08/08/2025, 9:43 AM
    I think I might be dumb, I'm running a 2d sim so the cut plane might not work for that
  • y

    Yann

    08/08/2025, 9:56 AM
    well, the function definition looks fine so my next question would be "are you sure about your point and normal values"
  • a

    anshulg

    08/08/2025, 10:23 AM
    Point not so sure, but the plane is a xy plane so the normal will be the zplane
  • m

    Moose

    09/02/2025, 9:30 AM
    what was the script to link the path of a custom solver in the control dict again ? I cannot remember :/
  • m

    Moose

    09/02/2025, 10:14 AM
    Nvm, here is the solution 😉 solver compressibleLeeVoF; libs ( "libcompressibleLeeVoF.so" // your solver module (in $FOAM_USER_LIBBIN) // add any extra model libs you need too // "libLeeBoilingModels.so" );