https://linen.dev logo
Join Discord
Powered by
# programming
  • t

    tkeskita

    08/17/2025, 11:43 AM
    When I change number of cores I'm getting so strange parallel run errors that I must be doing something wrong with syncPointList shown above.
  • m

    Moose

    08/18/2025, 10:42 AM
    Hum, I do not know if it is the right channel for this : anyone know if a native velocity parabola (Poiseuille flow) is embedded as boundary condition in OF ? Because if I understand this document, one can have this poiseuille profile with uniform pressure boundary condition ? https://www.wolfdynamics.com/wiki/tut_hagen_poiseuille.pdf But considering I want a fixed mass flow, isn't better to code myself a parabola profile like in there

    https://www.youtube.com/watch?v=_jjYmW8sBNAβ–Ύ

    ? This is the one I tried btw, for now the profile after t0 is WEIRD, I am guessing a problem in my equation ?
  • m

    Moose

    08/18/2025, 10:42 AM
    https://cdn.discordapp.com/attachments/814043123810304041/1406951417373003887/image.png?ex=68a4551d&is=68a3039d&hm=5c00b37608ddfc881f7d3f84dcd2985f233185d4d658412a73267b278a6eae4c& https://cdn.discordapp.com/attachments/814043123810304041/1406951417683644476/image.png?ex=68a4551d&is=68a3039d&hm=aa747c5f4e3300bf7fe3d01149a119d210078f24bacaaf32e31544673a6c8642& https://cdn.discordapp.com/attachments/814043123810304041/1406951418165854329/image.png?ex=68a4551d&is=68a3039d&hm=e6a693bdd86504ed064a7335e72df601bce03a2860145b5b2b4b1de75891a7c0& https://cdn.discordapp.com/attachments/814043123810304041/1406951418669301760/image.png?ex=68a4551e&is=68a3039e&hm=58ad05db056f7b90a328d85429fb2dd8874e761befd92631c61762c6696c35ff&
  • m

    Mitch

    08/18/2025, 2:29 PM
    Thank you
  • f

    finn

    08/18/2025, 3:12 PM
    I use funkySetBoundaryDict from SWAK4 but that is I think only part of foam extend
  • f

    finn

    08/18/2025, 3:12 PM
    But you could write a python function that interpolates onto mesh and writes it. But more difficult though
  • t

    tkeskita

    08/18/2025, 5:19 PM
    This is so weird, I run with
    mpirun -np 4 smoothMesh -parallel
    , decomposeParDict says
    numberOfSubDomains 4
    , it runs fine till the end but and at the very end of run it says
    Copy code
    [0] --> FOAM FATAL ERROR: 
    [0] "/path/to/smoothMesh/run_tests/testcase4/system/decomposeParDict" specifies 4 processors but job was started with 3 processors.
    When I run with
    mpirun -np 2
    with
    numberOfSubDomains 2
    it runs happily till the end and says
    number of processor directories = 2 is not equal to the number of processors = 3
    When I run with three processors, it does not complain anything. 🀷 What is going on?
  • t

    tkeskita

    08/19/2025, 3:24 PM
    Ok my mistake, I forgot there was checkMesh being run afterwards with grep, so it hid everything but the error message 🀦
  • t

    tkeskita

    08/19/2025, 3:34 PM
    Found the issue here: Apparently it is a Bad Idea to use
    syncPointList
    several times in a loop for syncing the same list. I'm not sure why it does not work right, some MPI thing maybe..?
  • f

    finn

    08/20/2025, 8:59 AM
    I did just finish it, I wrote my """"own"""" rhoPimpleFoam. Or as you can see own with a large quotation because yeah it is just loads of copy paste but it is in a different kindoff class framework now thanks for the advice. I am not going to perform the multiregion including the solid now. Still now running a simulation to see if the numerical values i get make any sense πŸ™‚ need to compare with rhoPimpleFoam
  • m

    Mateo

    08/21/2025, 12:54 AM
    Hey All, I am running a case in hy2Foam I did implement a Riemann solver, AUSMPlus. I was trying a high speed scenario over a axisymmetric double cone. It seems that the temperature diverges early on and an aberration forms on the area with some cell skewness (the mean Co is small while the MaxCo is over 1). I changed the Co calculation from cell centers to face values which helps a bit. It seems to work with the Kurganov method and was wondering if (a) just improve the mesh (b) something I was missing in how I handle flux calculations. Thanks in advance. I can post the relevant code(s) as well.
  • f

    finn

    08/22/2025, 12:06 PM
    I actually just used funkySetBoundary πŸ™‚ for my study works, but yeah this aint parabolic but its super easy https://cdn.discordapp.com/attachments/814043123810304041/1408421988652814458/image.png?ex=68a9aeb1&is=68a85d31&hm=ed4c9c0f64ec6cf01f28213feff1b72872095bae2fcb0f7f023317ab5e1ab04a&
  • m

    Moose

    08/22/2025, 2:09 PM
    Nice though πŸ‘πŸΌ
  • f

    finn

    08/26/2025, 2:03 PM
    Your probably won't need it anymore (but I needed it myself)
    Copy code
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | foam-extend: Open Source CFD                    |
    |  \\    /   O peration     | Version:     4.0                                |
    |   \\  /    A nd           | Web:         http://www.foam-extend.org         |
    |    \\/     M anipulation  | For copyright notice see file Copyright         |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        object      funkySetBoundaryDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    velocities
    {
        field                 U;
    
        expressions
        (
            {
                target        value;
                patchName     "inlet";
                variables
                (
                "Uavg=0.042;"
                "xCoord=pos().x;"
                "yCoord=pos().y;"
                "xCoordMax=max(xCoord);"
                "yCoordMax=max(yCoord);"
                "CoordMax=max(xCoordMax, yCoordMax);"
                "r=sqrt(pow(xCoord, 2) + pow(yCoord, 2));"
                );
                expression "(1-pow(r / CoordMax, 2)) * 2 * Uavg * vector(0, 0, -1)";
            }
    
        );
    }
    
    // ************************************************************************* //
    https://cdn.discordapp.com/attachments/814043123810304041/1409900953087508488/image.png?ex=68af1015&is=68adbe95&hm=3cae348eadcacd2fcbd115c7b6c15442c45cb6212d4f41bee626306dcee4432b&
  • m

    Moose

    08/26/2025, 2:13 PM
    Thank you, that is very kind of you !
  • f

    finn

    08/26/2025, 2:16 PM
    I think you can install it run it and still use it in your 0's folder regardless of the OpenFOAM version. Note that it will overwrite your old file, so it is handy to keep them backed up in e.g. 0.org
  • m

    Mairon

    08/31/2025, 2:14 PM
    I spent quite a while trying out different approaches for the parabolic inlet boundary condition, and finally found that the coded boundary condition is the right tool for thisβ€”at least in my case. Have a look:
    Copy code
    inlet
        {
            type            codedFixedValue;
            value           uniform (0 0 0);
            name            parabolicProfile;
            code
            #{
                const fvPatch& boundaryPatch = patch();
                vectorField& field = *this;
                scalar H = 0.41; // Total height
                scalar Umax = 1.5; // Re = 100
    
                forAll(field, i)
                {
                    scalar y = boundaryPatch.Cf()[i].y(); // Get y-coordinate of face center
                    scalar yShifted = y + 0.2;  // Shift y to start from 0
                    field[i] = vector( 4 * Umax * (yShifted * (H - yShifted) / (H * H)), 0, 0);
                }
            #};
        }
  • m

    Moose

    08/31/2025, 5:24 PM
    Thanks for sharing ! I used a different formula than you but yeah I used a similar process ! Could you share by any chance the "plot over line" paraview filter on the boundary condition ? I assumed that using a fixedValue would create eventually what I was needing due to viscosity on walls but I am still interested ✨
  • o

    otaolafr

    09/01/2025, 7:15 AM
    is there any clean way to grab a value from a file in dictionaries? for example, defining Ux=10 in a 'variables file' and then in the U file use something like:
    value uniform (foamFind(Ux,filePath) 0 0)
    ? should I simply sed the thing directly using bash? I am having a lot of trouble with this, not that i can am not able of doing my simulation, but i can not find a 'clean' way to do it, and then the hole folder with all the simulations in a parametric study that i re runned several times becomes really hard to find 'what i changed'/'what this simulation was for'. currently my workflow is: 1. master bash script where i loop over a list of a variable 2. master script copies base case folder and seds the variable to change in respective file (such as 0.orig/U) 3. runs the ./Allrun of the copied case folder. i did in the past also: 1. master bash script where i loop over a list of a variable 2. master script copies base case folder and seds the variable to change in a variables.sh file inside the copied case folder 3. runs the ./Allrun which itself reads the variables.sh file and changes respectibly the desired file, (such as 0.orig/U) and then runs the simulation the second i would say is a little bit 'cleaner' but by any means clean. the first makes more complex the master script, where the second the Allrun i would like (if exist, but doubt since i never saw it used in foam files) do something in the middle, where the files would 'look for' on the variables.sh file and have a default value. or other people around do it in a different way? it gets convoluted quite fast and would like to clean my workflow. maybe using python? i dont know... just curious what others do here
  • m

    muehhlllerr

    09/01/2025, 7:35 AM
    not sure if I exactly what you want but you can look at e.g. the turbineSiting Tutorial Case. There they use a "master" file where they set the variables and then within the 0 folder they include that file and use the substitution mechanism. With this you could keep all the changes in one file
  • o

    otaolafr

    09/01/2025, 7:39 AM
    thanks a lot! this is a possibility that I will keep in mind 🧐
  • k

    kandelabr

    09/01/2025, 8:06 AM
    I used to have jinja2 templates that I'd copy and populate with variables but since I found this (very fresh) library, it's all I need: https://github.com/gerlero/foamlib
  • o

    otaolafr

    09/01/2025, 8:15 AM
    great will check!
  • f

    finn

    09/02/2025, 1:20 PM
    Copy code
    ecs.Q().rmap(Region::CONDUCTOR);
                ecs.Q().mapInternalField(Region::THERMAL);
                //fvc::extrapolate(ecs.Q()[Region::THERMAL]);
    I have this mapping of region fields The fields overlap, but when doing extrapolate I get floating point errors, I am also not so sure if I need to extrapolate as mentioned they overlap, and the values are cellCentered for instance this is volumetric heating W/m^3
  • q

    qr

    09/02/2025, 7:54 PM
    By itself the mapping will do an interpolation of some kind between the source and target domains
  • q

    qr

    09/02/2025, 7:55 PM
    Also, what do we know about the use-case (documented in .H files) of these functions
  • m

    Moose

    09/08/2025, 6:58 PM
    Context : I am trying to finalize the implementation of evaporations models in VoF for OpenFOAM 12/13. So I saw that "compressibleCavitation" and incompressibleCavitation models both use the constantPressure files. Analogically I wanted to add the evaporation/condensation model using the constantTemperature files. Question : Physically speaking, when I use cavitation or evaporation/condensation respectively, I observe a mass transfer depending on the pressure gradient for a given temperature (constant) and temperature gradient for a given pressure (constant). Thus, why is the "saturationPressure" (for cavitation) uses "constantPressure" titled files and "saturationTemperature" (for evaporation/condensation) uses "constantTemperature" titled files ?
  • m

    Moose

    09/08/2025, 7:03 PM
    or it is just to stipulate that the saturation value provided must be constant ?
  • e

    Euge

    09/09/2025, 9:37 AM
    Hi all! I am trying to compute the sum of the concentration (c) field on the outlet patch using the following fuctionObject dictionary in controlDict: functions { outlet { type surfaceFieldValue; libs ("libfieldFunctionObjects.so"); writeControl timeStep; writeInterval 1; writeFields no; surfaceFormat vtk; enabled true; log true; fields (c); regionType patch; name outlet; operation sum; } } however, no matter what I change or if I try to code the functionObject directly in the controlDict, I keep getting the following error: --> FOAM FATAL IO ERROR: error in IOstream "OSHA1stream.sinkFile_" for operation Ostream& operator<<(Ostream&, const word&) file: OSHA1stream.sinkFile_ at line 0. From function virtual bool Foam::IOstream::check(const char*) const in file db/IOstreams/IOstreams/IOstream.C at line 96. It seems that OF cannot open or write the result on the log file. Does anyone have any suggestion?
  • m

    muehhlllerr

    09/15/2025, 8:43 AM
    General Question regarding the pointer implementation in openFoam and the "best practice". When I dynamically construct an object I "put" its address into a autoPtr (e.g. how the turbulence model is handled). But when I want to access a field e.g. the U field in a class by looking it up via the mesh refrence what pointer class should I use? So far refPtr has worked for me but no clue if thats the right approach. And what is the point of the tmp Class. Is that just for clarity in the code because shouldnt the autoPtr etc. also delete the object they are pointing towards when going out of scope? Any Insight from a more experienced programmer would be very much appreciated πŸ˜„