CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   epsiloncodedSource: 'error: could not load dynamicCode' (https://www.cfd-online.com/Forums/openfoam-solving/236393-epsiloncodedsource-error-could-not-load-dynamiccode.html)

Kbshariff May 27, 2021 14:51

epsiloncodedSource: 'error: could not load dynamicCode'
 
1 Attachment(s)
Hello Foamers,


I want to add a source term in the k-epsilon (see attachment) model in a defined region.

I want to use the coded source to write my expression and solve the equation.

I am having an error when running the simulation, it crashes on 1st iteration.

Here is my code in fvOptions. (I try to add epsilon only first to make sure the code id OK, later on, I will include the k-source)

Code:

epsilonSource
{
    type            scalarCodedSource;
    selectionMode  cellSet;
    cellSet        actuationDisk1;
    fields          (epsilon);
    name            epsilonSource;

    codeInclude
            #{
                #include "OFstream.H"
        #};

    codeAddSup
    #{
        const Time& time = mesh().time();

        //declare constants
        const scalar Ce_ = 1.92;
        const scalar epAmb_ = 1.61e-3;
        const scalar kAmb_ = 4.57e-3;

        // define mesh
        const vectorField& CellC = mesh_.C();

        // declare source
        scalarField& epsilonSource = eqn.source();

        // Apply the source
            forAll(cellC, i)
            {
                // epsilon source
                epsilonSource[i] += rho()*Ce_*sqr(epAmb_)/kAmb_;

                std::ofstream file;
                file.open ("Epsilonterm.txt", std::ofstream::out | std::ofstream::app);
                file << time.value() << "        " << epsilonSource[i] << "        " << CellC[i].y() << std::endl << "\n";
                file.close();                               
            };
       
    #};
    codeCorrect
    #{
    #};
   
    codeConstrain
    #{
    #};
}

and here is the error during simulation

Code:

Selecting finite volume options type scalarCodedSource
    Source: epsilonSource
    - selecting cells using cellSet actuationDisk1
    - selected 1968 cell(s) with volume 0.00115206175747


Time = 1

smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 0.0847902582144, No Iterations 1
smoothSolver:  Solving for Uy, Initial residual = 0.999826124119, Final residual = 0.0478604369223, No Iterations 1
smoothSolver:  Solving for Uz, Initial residual = 1, Final residual = 0.0284598334923, No Iterations 3
GAMG:  Solving for p, Initial residual = 1, Final residual = 0.000848836521673, No Iterations 17
time step continuity errors : sum local = 3.2538733323e-05, global = -9.57013476506e-07, cumulative = -9.57013476506e-07
Could not load "/dlocal/run/8251943/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libepsilonSource_868e6b493283f3b08eed87e0a7187b68c731d1e4.so"
/dlocal/run/8251943/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libepsilonSource_868e6b493283f3b08eed87e0a7187b68c731d1e4.so: cannot open shared object file: No such file or directory
Using dynamicCode for fvOption::epsilonSource at line 39 in "/dlocal/run/8251943/constant/fvOptions.epsilonSource"


Invoking wmake libso /dlocal/run/8251943/dynamicCode/epsilonSource
/dlocal/run/8251943/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libepsilonSource_868e6b493283f3b08eed87e0a7187b68c731d1e4.so: cannot open shared object file: No such file or directory
/dlocal/run/8251943/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libepsilonSource_868e6b493283f3b08eed87e0a7187b68c731d1e4.so: cannot open shared object file: No such file or directory
wmake libso /dlocal/run/8251943/dynamicCode/epsilonSource
    ln: ./lnInclude
    dep: codedFvOptionTemplate.C
    Ctoo: codedFvOptionTemplate.C
In file included from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/keyType.H:46:0,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/Ostream.H:43,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/OSstream.H:42,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/messageStream.H:255,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/error.H:54,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/VectorSpaceI.H:29,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/VectorSpace.H:276,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/Vector.H:48,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/vector.H:42,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/fieldTypes.H:37,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/finiteVolume/lnInclude/fvMatricesFwd.H:34,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/finiteVolume/lnInclude/fvOption.H:50,
                from /soft/OpenFOAM-v2006/OpenFOAM-v2006/src/fvOptions/lnInclude/cellSetOption.H:57,
                from codedFvOptionTemplate.H:105,
                from codedFvOptionTemplate.C:29:


/dlocal/run/8251943/constant/fvOptions.epsilonSource: In member function ‘virtual void Foam::fv::epsilonSourceFvOptionscalarSource::addSup(const volScalarField&, Foam::fvMatrix<double>&, Foam::label)’:
/dlocal/run/8251943/constant/fvOptions.epsilonSource:66:20: error: ‘cellC’ was not declared in this scope
/soft/OpenFOAM-v2006/OpenFOAM-v2006/src/OpenFOAM/lnInclude/stdFoam.H:297:30: note: in definition of macro ‘forAll’
    for (Foam::label i=0; i<(list).size(); ++i)
                              ^
/dlocal/run/8251943/constant/fvOptions.epsilonSource:69:34: error: no match for ‘operator+=’ (operand types are ‘double’ and ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’)
/dlocal/run/8251943/constant/fvOptions.epsilonSource:69:34: note: candidate is:
/dlocal/run/8251943/constant/fvOptions.epsilonSource:69:34: note: operator+=(double&, int) <built-in>
/dlocal/run/8251943/constant/fvOptions.epsilonSource:69:34: note:  no known conversion for argument 2 from ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’ to ‘int’
make: *** [Make/linux64GccDPInt32Opt/codedFvOptionTemplate.o] Error 1
 
 --> FOAM FATAL IO ERROR:
 Failed wmake "dynamicCode/epsilonSource/platforms/linux64GccDPInt32Opt/lib/libepsilonSource_868e6b493283f3b08eed87e0a7187b68c731d1e4.so"


 file: /dlocal/run/8251943/constant/fvOptions.epsilonSource at line 39 to 83.
 
    From void Foam::codedBase::createLibrary(Foam::dynamicCode&, const Foam::dynamicCodeContext&) const
    in file db/dynamicLibrary/codedBase/codedBase.C at line 237.

FOAM parallel run exiting

application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
In: PMI_Abort(1, application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0)
srun: Job step aborted: Waiting up to 32 seconds for job step to finish.
slurmstepd: error: *** STEP 8251943.2 ON my336 CANCELLED AT 2021-05-27T13:25:55 ***
srun: error: my342: tasks 28-55: Killed
srun: Terminating job step 8251943.2
srun: error: my349: tasks 56-83: Killed
srun: error: my336: tasks 0-27: Killed

Thanks in advance

Kabir


All times are GMT -4. The time now is 21:24.