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

accesing lagrangian data in run time using coded function object

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 26, 2024, 04:19
Default accesing lagrangian data in run time using coded function object
  #1
Senior Member
 
Franco
Join Date: Nov 2019
Location: Compiègne, France
Posts: 129
Rep Power: 6
otaolafr is on a distinguished road
Hello,
I am having troubles with 'programming' on a function object of a solver that uses `basicKinematicCollidingCloud`. I have on my mesh a volumetric scalar field I, and I have particlesCloud which are basicKinematicCollidingCloud.
I wanted to use the coded function object, to:
1. recover the I field
2. recover the cloud
3. find the ID of the cell where each particle is located
4. save the evolution of the field I over each particle (so at each time step note the I where the particle is)
5. ideally extend it to make a linear interpolation between the center of the particle and the center of the location of cell center so it is more precise.

but I am struggling to recover the cloud field, I havent found much about using the lagrangian data in run time with exception of this posts:
Access particle data from functionObject
Lagrangian particloe Tracking and getting values back

what I have up to now:
the function object (if I uncomend any of the commends parts the compilation fails):
Code:
    fieldLagrangeanVol
    {
        libs            (utilityFunctionObjects);
        type            coded;
        name            fieldLagrangeanVol;
        writeControl    timeStep;
        writeInterval   10;
        // codeInclude
        // #{
        //     #include "basicKinematicCollidingCloud.H"
        // #};

        codeWrite
        #{
            const auto& banana = mesh().lookupObject<volScalarField>("banana");
            // const auto& t = mesh().lookupObject<basicKinematicCollidingCloud>("cellCloud");
            // const auto* t1 = mesh().findObject<cloud>("cellCloud");
        #};
    }
and the cellCloud is defined in the create field:

Code:
word cellCloudName("cellCloud");
basicKinematicCollidingCloud cellCloud
(
    cellCloudName,
    rhoInf,
    U,
    mu,
    g
);
I am getting the following errors while compiling (if I remove the commend from the corresponding line)
if I active t:
Code:
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol: In member function ‘virtual bool Foam::ILagrangeanVolFunctionObject::write()’:
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol:179:49: error: ‘basicKinematicCollidingCloud’ was not declared in this scope
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol:179:78: error: no matching function for call to ‘Foam::fvMesh::lookupObject<<expression error> >(const char [10]) const’
In file included from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/objectRegistry.H:759,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/Time.H:45,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/timeFunctionObject.H:44,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/stateFunctionObject.H:52,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/regionFunctionObject.H:56,
                 from functionObjectTemplate.H:38,
                 from functionObjectTemplate.C:29:
/usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/objectRegistryTemplates.C:598:13: note: candidate: ‘template<class Type> const Type& Foam::objectRegistry::lookupObject(const Foam::word&, bool) const’
  598 | const Type& Foam::objectRegistry::lookupObject
if it turn on t2;
Code:
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol: In member function ‘virtual bool Foam::ILagrangeanVolFunctionObject::write()’:
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol:180:49: error: ‘cloud’ was not declared in this scope
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol:180:55: error: no matching function for call to ‘Foam::fvMesh::findObject<<expression error> >(const char [10]) const’
In file included from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/objectRegistry.H:759,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/Time.H:45,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/timeFunctionObject.H:44,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/stateFunctionObject.H:52,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/regionFunctionObject.H:56,
                 from functionObjectTemplate.H:38,
                 from functionObjectTemplate.C:29:
/usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/objectRegistryTemplates.C:565:13: note: candidate: ‘template<class Type> const Type* Foam::objectRegistry::findObject(const Foam::word&, bool) const’
  565 | const Type* Foam::objectRegistry::findObject
      |             ^~~~
/usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/objectRegistryTemplates.C:565:13: note:   template argument deduction/substitution failed:
/home/franco/Git/psufoam/Test_Cases/baseCaseWithCyclic/system/controlDict/functions/ILagrangeanVol:180:55: error: template argument 1 is invalid
In file included from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/Time.H:45,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/timeFunctionObject.H:44,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/stateFunctionObject.H:52,
                 from /usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/regionFunctionObject.H:56,
                 from functionObjectTemplate.H:38,
                 from functionObjectTemplate.C:29:
/usr/lib/openfoam/openfoam2312/src/OpenFOAM/lnInclude/objectRegistry.H:530:15: note: candidate: ‘template<class Type> Type* Foam::objectRegistry::findObject(const Foam::word&, bool)’
  530 |         Type* findObject

Last edited by otaolafr; March 26, 2024 at 06:52.
otaolafr is offline   Reply With Quote

Reply

Tags
function object, lagrangian data, run time


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
courant number increases to rather large values 6863523 OpenFOAM Running, Solving & CFD 22 July 6, 2023 00:48
error in fireFoam, when running the case wallFireSpread2D zhoubiao1088 OpenFOAM Running, Solving & CFD 9 February 1, 2018 19:45
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 01:01
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23
plot over time fferroni OpenFOAM Post-Processing 7 June 8, 2012 08:56


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