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/)
-   -   Error when executing simpleFoam - FOAM FATAL ERROR:(openfoam-2206) cannot find file (https://www.cfd-online.com/Forums/openfoam-solving/246147-error-when-executing-simplefoam-foam-fatal-error-openfoam-2206-cannot-find-file.html)

astri November 15, 2022 12:18

Error when executing simpleFoam - FOAM FATAL ERROR:(openfoam-2206) cannot find file
 
Hi all,

I am running a case of natural ventilation of a simple building (box) with open windows. I created it as an outdoor case inside the wind tunnel, write the case in Butterfly then trying to run it in openFoam. Everything is fine when I execute blockMesh and snappyHexMesh. However, when I execute simpleFoam I've got an error message:


--> FOAM FATAL ERROR: (openfoam-2206)
cannot find file "/mnt/c/Users/astri/butterfly/boxexplode_45/2/p"

From virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::rea dStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 540.

FOAM exiting

I am trying different setting, but It always goes the same way. Would anyone share a thought why this is happen? Any advice would be very much appreciated

Best regards,

Astri

Yann November 16, 2022 03:32

Hello Astri,

You get this error because the solver does not find the files containing the boundary conditions for each variable (p, U, ...) as stated in the error message:

Code:

cannot find file "/mnt/c/Users/astri/butterfly/boxexplode_45/2/p"
Posting the whole log file would help to know exactly what is going on, but my best guess is that you ran snappyHexMesh without the -overwrite option and snappy created new timeStep folders (1, 2) to write the castellated and snapped mesh.

I'm quoting the documentation (https://www.openfoam.com/documentati...yhexmesh-usage)

Quote:

By default, each of snappyHexMesh's phases, i.e castellation, snapping and layer addition will write a complete mesh in time folders. This behaviour can be suppressed by using the option

snappyHexMesh `-overwrite`
To solve this issue you can use the overwrite option or manually move folders:
  • move the polyMesh folder from 2/constant to constant/
  • remove folders 1 and 2
  • run simpleFoam

Let us know if it solves the issue!

Regards,
Yann

astri November 16, 2022 18:24

1 Attachment(s)
Hi Yann,

Thank you very much for your kind response.
I've already done it as per your suggestion (the snappyHexMesh -overwrite), but another error message appears.



--> FOAM FATAL IO ERROR: (openfoam-2206)
Missing or invalid PatchFunction1 entry: d


file: 0/U.boundaryField.inlet at line 81.

From static Foam::autoPtr<Foam::PatchFunction1<Type> > Foam::PatchFunction1<Type>::New(const Foam::polyPatch&, const Foam::word&, const Foam::entry*, const Foam::dictionary&, bool, bool) [with Type = double]
in file /usr/src/packages/BUILD/src/meshTools/lnInclude/PatchFunction1New.C at line 124.

FOAM exiting
------------------------------------------------------

I really want to upload the U file from folder 0 to the attachment, but I always failed. It says invalid file. I don't know If I did it wrong, I am new to this forum.

What is written in line 81 of the script U is
type atmBoundaryLayerInletVelocity;


and this is I copy also the whole script.

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1706+ |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
/* Butterfly 0.0.4 https://github.com/ladybug-tools/butterfly *\
\*---------------------------------------------------------------------------*/
FoamFile
{
version 4.0;
format ascii;
class volVectorField;
location "0";
object U;
}

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

#include "initialConditions";

internalField uniform $flowVelocity;

boundaryField
{

right_side
{

type slip;

}

box
{

type fixedValue;

value uniform (0 0 0);

}

outlet
{

type inletOutlet;

inletValue uniform (0 0 0);

value $internalField;

}

left_side
{

type slip;

}

top
{

type slip;

}

ground
{

type fixedValue;

value uniform (0 0 0);

}

inlet
{

type atmBoundaryLayerInletVelocity;

#include "ABLConditions";

}

}





Do you know what happened, and could you advise me on what should I do?

Anyway, I can't open the documentation that you quoted in your reply. Is there any way for me to open it?

Thank you very much for your help.
Best regards,

Astri

Yann November 17, 2022 05:14

Hello,

It complains about your inlet boundary condition, more specifically about the d parameter.

Code:

--> FOAM FATAL IO ERROR: (openfoam-2206)
Missing or invalid PatchFunction1 entry: d


file: 0/U.boundaryField.inlet at line 81.

Your current condition:

Code:

inlet
{

type atmBoundaryLayerInletVelocity;

#include "ABLConditions";

}

You must have a file named ABLConditions in your 0 directory. Is there a parameter d defined there?

Regards,
Yann

EDIT: I fixed the dead link in my previous post.

astri November 17, 2022 19:10

Hi Yann, thank you so much!

Yes, you're right, there's no parameter d defined in my ABLConditions file.
Here's what's written in the file:


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1706+ |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
/* Butterfly 0.0.4 https://github.com/ladybug-tools/butterfly *\
\*---------------------------------------------------------------------------*/

Uref 2.97;

Zref 10;

z0 uniform 1.0;

flowDir (0.0 1.0 0.0);

zDir (0 0 1);

zGround uniform -0.10000000149;

value $internalField;


-------------------------------------------------------------------

I have no idea how to define the parameter d. I've checked the OpenFOAM user guide, the example of ABLConditions in this link https://www.openfoam.com/documentati...daryLayer.html



inlet
{
// Mandatory and other optional entries
...

// Mandatory (inherited) entries (runtime modifiable)
flowDir (1 0 0);
zDir (0 0 1);
Uref 10.0;
Zref 0.0;
z0 uniform 0.1;
d uniform 0.0;
-----------------------------------------------------------

Should I just copy the definition for parameter d just like the example?
Thank you so very much Yann for your advice.

Best regards,
astri

Yann November 18, 2022 03:11

Hi Astri,

You're welcome. About the d parameter, I have no idea since I never used this boundary condition.
There is a note about it in the documentation:

Quote:

d is the displacement height, and "is relevant for flows over forests and cities" ([17], p. 28). "The displacement height gives the vertical displacement of the entire flow regime over areas which are densely covered with obstacles such as trees or buildings" ([17], p. 28).
Up to you to decide how to define this parameter. Checking the cited reference might help.

Cheers,
Yann


All times are GMT -4. The time now is 12:52.