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/)
-   -   --> FOAM FATAL IO ERROR: (openfoam-2012) Cannot find patchField entry for testCube (https://www.cfd-online.com/Forums/openfoam-solving/250756-foam-fatal-io-error-openfoam-2012-cannot-find-patchfield-entry-testcube.html)

DCanas July 7, 2023 06:38

--> FOAM FATAL IO ERROR: (openfoam-2012) Cannot find patchField entry for testCube
 
I am trying to simulate a river flow so i'm using snappyhexmesh and blockMesh.

When running "interFoam" to start the simulation it gives me the error in the title followed by this:
"file: /river/0/U.boundaryField at line 25."

Here is my U file

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (1 0 0);

boundaryField
{
inlet
{
type flowRateInletVelocity; //line 25
volumetricFlowRate constant 350;
}

walls
{
type noSlip;
}

atmosphere
{
type pressureInletOutletVelocity;
value uniform (0 0 0);
}

outlet
{
type inletOutlet;
inletValue uniform (0 0 0);
value $internalField;
}
}


// ************************************************** *********************** //

On another test where I didn't use snappyhexmesh so I only had the outer box it worked just fine but i need it to get the river simulation.

If you know anything that can fix my problem please reply.

Yann July 7, 2023 06:56

Hello,

You mesh contains a patch named "testCube" and the solver complains there is no boundary condition defined for this patch.

If you do expect to have a testCube patch, then you need to define a boundary condition for it for each variable in the 0 directory.

If you don't expect to have a testCube patch, it means something is wrong with your mesh. You need to check it and fix it to get your expected mesh.

Regards,
Yann

DCanas July 7, 2023 07:14

Thanks for the fast reply but how do I define the boundary condition?
You mean do this?
cubeGroup
{
type slip;
}

Yann July 7, 2023 08:08

Yes, and choose the appropriate condition for each variable.

(If necessary you can have a look to the user guide: https://www.openfoam.com/documentati...ary-conditions)

Cheers,
Yann

DCanas July 7, 2023 09:37

Thank you for answering.
I did try a few but I don't seem to find the right one. Do you know what would be the best one for a river simulation?

Yann July 7, 2023 10:02

I cannot really answer that without knowing what you are trying to simulate. I don't know what is "testCube" and I don't know what conditions you tried. There are not enough information to help you.

Have a look at the interFoam tutorials and search for something close to what you want to simulate. Run it and see how it works, what boundary conditions are used, etc...

Cheers,
Yann

DCanas July 7, 2023 10:05

Thanks for the help it seems to have solved the error using "fixed value" but now when I do run it, it works for awhile but then stops the simulation without giving any errors do you now what could be happening?

Yann July 7, 2023 11:22

Unfortunately no I cannot really help without having more information about your case. (at least the log file of the simulation)

(you can have a look there: https://www.cfd-online.com/Forums/op...-get-help.html)

Regards,
Yann

DCanas July 7, 2023 12:47

5 Attachment(s)
Ok I'm sorry for not providing all the information needed previously.
I've attached the checkMesh and the interFoam logs and both fvSchemes and fvSolution plus the blockMeshDict file.
Additional info, the object for the snappyHexMesh is just a 5x5x4 cube to be replaced with the 3D terrain model of the river once I can do it with the cube.

Yann July 8, 2023 05:51

Nothing bad in the files you've posted, but the solver stops before starting time loop so probably there is an error somewhere in your case setup.

It's a bit weird you don't get any error though. What command do you use to start the solver, and how do you create your log file?

DCanas July 10, 2023 03:47

I start solver using: mpirun interFoam (I also tried with just interFoam and it also didn't give any errors)
And I got the log file using: interFoam > interFoam.log

Yann July 10, 2023 07:28

OK then try running this instead:
Code:

interFoam > interFoam.log 2>&1
Your original command redirects the standard output to your log file, but not the standard error, so errors won't show up in your log file.
(Have a look there for more information about that: https://www.cyberciti.biz/faq/redire...err-to-stdout/)

DCanas July 10, 2023 09:27

1 Attachment(s)
The attached file is the result of the command u sent.
There don't seem to be any differences.

Yann July 11, 2023 14:25

Well, at this point I cannot really help.
The solver stops during initialization, it doesn't even get to start time loop. The next step should be to read the g file to set gravity. Do you have a properly defined g file in constant?

Also, can you post your whole case setup?

DCanas July 19, 2023 10:13

Thank you for your help but I've been on holidays and I'll only be able to send the files next week.

DCanas July 24, 2023 03:50

The ZIP file was too large so I put it on a google drive and here is the link.

https://drive.google.com/drive/folde...usp=share_link

Yann July 24, 2023 04:21

Hello,

I don't know why you don't get an error message when running the solver. Here is the error message I get when running your case:

Code:

RAS
{
    RASModel        kOmegaSST;
    turbulence      on;
    printCoeffs    on;
    alphaK1        0.85;
    alphaK2        1;
    alphaOmega1    0.5;
    alphaOmega2    0.856;
    gamma1          0.555556;
    gamma2          0.44;
    beta1          0.075;
    beta2          0.0828;
    betaStar        0.09;
    a1              0.31;
    b1              1;
    c1              10;
    F3              false;
    decayControl    false;
    kInf            0;
    omegaInf        0;
}

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in /lib/x86_64-linux-gnu/libpthread.so.0
#3  Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) at ??:?
#4  void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#5  Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::operator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) at ??:?
#6  Foam::kOmegaSSTBase<Foam::eddyViscosity<Foam::RASModel<Foam::IncompressibleTurbulenceModel<Foam::transportModel> > > >::F2() const at ??:?
#7  Foam::kOmegaSSTBase<Foam::eddyViscosity<Foam::RASModel<Foam::IncompressibleTurbulenceModel<Foam::transportModel> > > >::F23() const at ??:?
#8  Foam::kOmegaSSTBase<Foam::eddyViscosity<Foam::RASModel<Foam::IncompressibleTurbulenceModel<Foam::transportModel> > > >::correctNut(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) at ??:?
#9  Foam::RASModels::kOmegaSST<Foam::IncompressibleTurbulenceModel<Foam::transportModel> >::correctNut() at ??:?

#10  ? at ??:?
#11  ? at ??:?
#12  __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
#13  ? at ??:?

This indicates there is some math going wrong (often related to dividing by 0) somewhere.
The message leads to the kOmegaSST model and something wrong with the correctNut function.

Having a look at your boundary conditions, I see you set a fixedValue 0 on the testCubeGroup patch for nut, k and omega. This might be the source of the issue.

Setting omega to a small value rather than 0 solves the issue. (I tried with 1e-6 and the solver starts properly. Didn't check the results though, but this is another story)

Cheers!
Yann

DCanas July 24, 2023 05:41

Thanks for all the help it already works with the cube.

When I change the model to the terrain (a simplified version of the final) it starts the simulation but after one second the courant number is already at 1e-7 which also decreases the deltaT, do you know how to fix this?

Yann July 24, 2023 06:06

You have to check what is going on in your case. The deltaT drops to respect the max Courant number defined in your controlDict:

Code:

adjustTimeStep  yes;

maxCo          60;
maxAlphaCo      60;
maxDeltaT      1;

This is most likely due to high velocity in a relatively small cell. It can be physical if the order of magnitude of the velocity is reasonable for the case you are simulating. Or it can be a numerical error with an unrealistic velocity being computed somewhere due to... something! (like bad quality cell(s))

To help diagnose your case you can save timeStep and investigate the results in paraView, or use some function objects to monitor your case.
For instance the fieldMinMax function object is handy to monitor maximum velocity values (or min/max value of other variables of interest): https://develop.openfoam.com/Develop.../fieldMinMax.H

Yann

DCanas July 24, 2023 06:36

I've tried changing the value in meshQualityDict but it doesn't seem to work.
And how do I use the fieldMinMax function?


All times are GMT -4. The time now is 22:28.