CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How Does 'kinematicLookupTableInjection' Locate 'parcelInjectionProperties' (https://www.cfd-online.com/Forums/openfoam-programming-development/227745-how-does-kinematiclookuptableinjection-locate-parcelinjectionproperties.html)

cjc96 June 8, 2020 14:54

How Does 'kinematicLookupTableInjection' Locate 'parcelInjectionProperties'
 
Good evening everyone,
Apologies for what is probably a pretty simple question, but I'm just not seeing the solution. I have a feeling it is a result of staring at the same few sources files constantly for the past few days.

I'm working on a custom Lagrangian framework where I extract particles from a user-derived plane in simulation A and inject them from a related plane in simulation B. I'm accomplishing this by making some relatively significant modifications to 'kinematicLookupTableInjection' such that it injects specific particles from specific injectors at specific times (equivalent to the extracted data). While this isn't entirely relevant, it does provide some context at least.

The solver works perfectly in serial, but fails when run in parallel. The problem I am having is that the solver looks for 'parcelInjectionProperties' in the constant directory of each processor, as opposed to the 'global' constant directory where 'kinematicCloudProperties'. While it is possible to manually copy the file into all desired directories and successfully run the solver, my application will utilise significant parallelisation (once the European HPC clusters are back up and running). To that end, I'd rather modify the solver to read the file from the global constant directory, or at the very least automate the copying process.

If someone could identify how 'kinematicLookupTableInjection' locates 'parcelInjectionProperties' so I can modify it accordingly, I'd be immensely grateful!

Thanks for your help, and let me know if you need any additional info!

**EDIT**
As is the way of the world, I was just being incredibly blind and I think I have found the relevant section near enough immediately after making the thread...

Code:

    injectors_
    (
        IOobject
        (
            inputFileName_,
            owner.db().time().constant(),
            owner.db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    ),

However, I'm still getting used to OpenFOAMs file structure, and I'm not sure how to redirect said IOobject to the global constant directory.

As I said previously, the solver is currently looking in 'case/processor*/constant' but this IOobject is seemingly referencing time, which doesn't make sense to me.

Again, I appreciate any input!

cjc96 June 10, 2020 08:18

Just thought I'd post an update in case anyone else has a similar issue in the future.

A colleague pointed me towards 'caseConstant()' (as opposed to the standard 'constant()' which provided the functionality I required, the solver now locates 'parcelInjectionProperties' in the case constant folder.

The modified code (in src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/KinematicLookupTableInjection/KinematicLookupTableInjection.C) is as follows:

Code:

    injectors_
    (
        IOobject
        (
            inputFileName_,
            owner.db().time().caseConstant(),
            owner.db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    ),

'inputFileName' is defined in 'kinematicCloudProperties' and as always, it's recommended you make these changes to a user-based src directory as opposed to the main OpenFOAM source.

Hopefully this helps someone!


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