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 Warning : (https://www.cfd-online.com/Forums/openfoam-solving/251053-foam-warning.html)

Amirthaa July 24, 2023 03:00

FOAM Warning :
 
I've been working on the WindAroundBuildings tutorial and have been trying to just replace the geometry for start. I have replaced the original geometry with a .stl file. Now, when I run the snappyHexMesh, I get the following warning:

Reading refinement surfaces...
--> FOAM Warning :
From function Foam::refinementSurfaces::refinementSurfaces(const Foam::searchableSurfaces&, const Foam::dictionary&, Foam::label)
in file refinementSurfaces/refinementSurfaces.C at line 215
Reading "/home/amirthaa/OpenFOAM/amirthaa-10/run/WABEx2/system/snappyHexMeshDict/castellatedMeshControls/refinementSurfaces" from line 49 to line 50
Not all entries in refinementSurfaces dictionary were used. The following entries were not used : 1(av1)

My snappyHexMeshDict code:

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 10
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#includeEtc "caseDicts/mesh/generation/snappyHexMeshDict.cfg"

castellatedMesh on;
snap on;
addLayers off;

geometry
{
av1.stl
{
type triSurfaceMesh;
file "av1.obj";
}

refinementBox
{
type searchableBox;
min ( 0 0 0);
max (250 180 90);
}
};

castellatedMeshControls
{
features
(
{ file "av1.obj"; level 1; }
);

refinementSurfaces
{
av1
{
level (3 3);
patchInfo { type wall; }
}
}

refinementRegions
{
refinementBox
{
mode inside;
level 2;
}
}

insidePoint (1 1 1);
}

snapControls
{
explicitFeatureSnap true;
implicitFeatureSnap false;
}

addLayersControls
{
layers
{
stlSurface
{
nSurfaceLayers 2;
}
}

relativeSizes true;
expansionRatio 1.2;
finalLayerThickness 0.5;
minThickness 1e-3;
}

meshQualityControls
{}

writeFlags
(
// scalarLevels
// layerSets
// layerFields
);

mergeTolerance 1e-6;

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

It would be useful if someone can guide me on the cause of this warning.

Yann July 24, 2023 03:39

Hello,

In the geometry section of your snappyHexMeshDict, you geometry is named "av1.stl" but in the refinementSurfaces section you define refinement levels for "av1". You can either rename your geometry or modify your refinementSurfaces but names have to be consistent.

You can have a look at the tutorials using snappyHexMesh to have some examples. For instance here: https://github.com/OpenFOAM/OpenFOAM...ppyHexMeshDict

Cheers,
Yann

Amirthaa July 24, 2023 04:52

Thank you, that was helpful.
I also had and have another warning following the earlier one as :

--> FOAM Warning :
From function Foam::treeBoundBox::treeBoundBox(const Foam::UList<Foam::Vector<double> >&)
in file meshes/treeBoundBox/treeBoundBox.C at line 136
cannot find bounding box for zero-sized pointField, returning zero

Would you know what causes this?

Yann July 24, 2023 05:24

Quote:

Originally Posted by Amirthaa (Post 853910)
Would you know what causes this?

Not with that few information. But you can post the full snappy log file (or at least the beginning of the log, up to the part where you get the warning) which would be more helpful to have an idea about what is happening.

Regards,
Yann

Amirthaa July 24, 2023 05:36

Sure. Below is the log from start until the warning:

Create time

Create mesh for time = 0

Read mesh in = 0.013785 s
Reading "snappyHexMeshDict"


Overall mesh bounding box : (-20 -50 0) (330 230 140)
Relative tolerance : 1e-06
Absolute matching distance : 0.000469574

Reading refinement surfaces...
Read refinement surfaces in = 0.001651 s

Reading refinement regions...
Refinement level 2 for all cells inside refinementBox
Read refinement regions in = 0.000121 s

Reading features...
Read edgeMesh av1.obj
points : 0
edges : 0
boundingBox : (0 0 0) (0 0 0)

Refinement level according to distance to "av1.obj" (0 points, 0 edges).
level 1 for all cells within 0 metre.
--> FOAM Warning :
From function Foam::treeBoundBox::treeBoundBox(const Foam::UList<Foam::Vector<double> >&)
in file meshes/treeBoundBox/treeBoundBox.C at line 136
cannot find bounding box for zero-sized pointField, returning zero

Do let me know, if you'd require any additional information.

Yann July 24, 2023 05:51

OK, I think this is related to your features refinement:

Code:

Reading features...
Read edgeMesh av1.obj
points : 0
edges : 0
boundingBox : (0 0 0) (0 0 0)

Refinement level according to distance to "av1.obj" (0 points, 0 edges).
level 1 for all cells within 0 metre.
--> FOAM Warning :
From function Foam::treeBoundBox::treeBoundBox(const Foam::UList<Foam::Vector<double> >&)
in file meshes/treeBoundBox/treeBoundBox.C at line 136
cannot find bounding box for zero-sized pointField, returning zero

As you can see, there is nothing detected here (0 points, edges, and bounding box).
In the features section, you are not supposed to provide your geometry obj file, but a file containing the feature edges of your geometry (extension eMesh or extendedFeatureEdgeMesh).
You create this file using the surfaceFeatures utility.

Have a look at the tutorial I've linked in my previous post, especially the Allrun script to see the workflow, and the surfaceFeaturesDict and snappyHexMeshDict to check syntax: https://github.com/OpenFOAM/OpenFOAM...HexMesh/flange

Amirthaa July 24, 2023 08:31

Thank You! I have made the required change with your help.

I have an issue in post processing. I'm not able to view my geometry in ParaView. Am not certain of what can be the reason. Would you be able to guide me on this? Do let me know of what files you may require if you have to check on it.

Yann July 25, 2023 03:17

Hello,

I cannot help if I don't know what you are doing :D
  1. Are you running in serial or parallel?
  2. Did snappy complete without error?
  3. How do you load your case in paraView?
  4. What are you visualizing in ParaView?

Yann

Amirthaa July 25, 2023 04:45

1 Attachment(s)
Yes, I understand.
1) I am running in serial.
2) Yes, snappyHexMesh had run without any error
3) By executing paraFoam after executing surfaceFeatures, blockMesh and snappyHexMesh
4) Currently am only able to visualise the mesh

I have attached the main directory for your reference.

Yann July 25, 2023 05:04

1 Attachment(s)
If you ran snappyHexMesh without the -overwrite option, you should see additional timeStep directories written in your case directory.
When loading the case in ParaView, you need to display the last timeStep to see the final mesh.

Also, I'm not sure what you mean by "only able to visualize the mesh".
If you want to display your geometry surfaces rather than the internal mesh, you need to load it in the "Mesh Regions" section in ParaView (something like in the screenshot attached). By default it only loads the internalMesh.

Yann

Amirthaa July 25, 2023 05:38

Got it. I realise I was missing the step to load geometry seperately. Am able to visualise now.
Thanks for guiding me through =)

Amirthaa July 26, 2023 08:22

Hello. So, I'm visualising my geometry and domain in paraview but my U values are wrong. They are high. I wonder what can be the error as I have merely made any changes to the base files except changing the geometry.

Yann July 26, 2023 08:31

Then probably it is related to the new geometry and/or mesh. ;)

have you run checkMesh on your last mesh?

Amirthaa July 26, 2023 08:36

No, I have not in my trials. But I just did and it has run without errors. What should one check in it?

Yann July 26, 2023 09:08

If checkMesh does not report any errors, you'll have to investigate your case to know what's wrong.
Have you check boundary conditions are properly defined for your new geometry?
What wrong with the flow? High velocity everywhere or only locally?
Did your simulation converge? Have you checked the residuals?

Amirthaa July 27, 2023 00:27

Yes, Boundary conditions are properly defined for my geometry. (It's a simple cuboid block)
Yes, I can see that it shows high velocity throughout the domain in paraview.
I just checked the residuals properly and the simulation has not converged.

Amirthaa July 27, 2023 07:30

I'm not able to figure out the reason as to of why the solutions are not converging. What can be the reason?

Yann July 27, 2023 07:41

Hello,

It's impossible to tell without knowing the details of your case. It can be pretty much anything: mesh, boundary conditions, numerical setup, or even physics itself...

Yann

Amirthaa July 27, 2023 07:44

Will you be able to check if I attach the files?
I have attached the main directory in one of my previous messages for your reference.

Yann July 27, 2023 08:11

I dont know if the case you have uploaded here is your latest setup, but the locationInMesh in your snappyHexMeshDict is wrong: you are meshing the inside of your geometry rather than the outside.

Nothing happens during the simulation because there is nothing to do and the velocity is 0 everywhere (it's basically an enclosure with nothing to create a flow)

Since you mentioned high velocities, I guess you must be doing something different than me. Please provide your latest setup and a script to run the case as you are doing it.

Thanks,
Yann

Amirthaa July 28, 2023 02:10

1 Attachment(s)
This is my latest setup and you are right, the velocity is minimum for the geometry (and shows maximum for the domain).
By locationInMesh you mean insidePoint in SnappyHexMeshDict?

I have attached image of my view in paraView.

Yann July 28, 2023 03:24

Yes, the locationInMesh parameter in snappy, which defines which part of the mesh is kept.

However, your screenshot is different from the mesh I got from the test case you uploaded in previous post. Please provide your latest setup and a script to run the case.

Yann

Amirthaa July 28, 2023 05:14

5 Attachment(s)
Got it. But shouldn't the co.ordinates for it be a point inside the geometry?
Also, attaching here few directories created after my last run.

Amirthaa July 28, 2023 05:18

5 Attachment(s)
Remaining file attachments:

Amirthaa July 28, 2023 05:20

1 Attachment(s)
System directory:

Yann July 28, 2023 05:36

Quote:

Originally Posted by Amirthaa (Post 854234)
Got it. But shouldn't the co.ordinates for it be a point inside the geometry?
Also, attaching here few directories created after my last run.

the coordinate should be in the volume you want to simulate.
If your geometry is a cube, and you want to simulate the flow around the cube, the coordinate should be outside the cube (but inside your mesh, usually defined by your blockMesh boundaries)
If you want to simulate the flow inside the cube, then yes the coordinates needs to be inside the cube. (so it's basically for internal flows)

Have a look at the user guide: https://www.openfoam.com/documentati...exmesh-utility

Yann July 28, 2023 05:55

About the results you posted:

Your geometry is not meshed. You are running your solver on an empty mesh (it's basically only the mesh created by blockMesh).
You end up with a 10m/s flow in a domain without any obstacle.

Now, I think this is due to the fact you probably didn't use the overwrite option for snappyHexMesh. You can run snappyHexMesh -overwrite and it might solve the issue.

But this is only a guess since I have no idea of the commands you are using to run your case. This is why I asked for a script to run the case, so I can know what exact commands you are using. Without it it's not really possible to help you.

Amirthaa July 29, 2023 00:20

1 Attachment(s)
You are right. Usage of snappyHexMesh -overwrite works. I have been able to get results. Thanks, Yann.

Amirthaa July 31, 2023 00:03

Hello.
I have certain general doubts regarding OpenFOAM and ParaView which I haven't been able to find out clear answers for yet. It would be helpful if you are able to provide answers:
1) How to work and run files in OpenFOAM without having to close ParaView?
2) How to view the last run result in ParaView when opened again?
3) Is it possible to have ParaView open with multiple tabs (for different cases)?

AtoHM July 31, 2023 01:51

1) you cannot "run" OpenFOAM "files" from Paraview. You open the .foam or .OpenFOAM file in the folder. This acts as an indicator to Paraview how to interprete the data in the folder -> as an OpenFOAM case.
2) You can select the displayed timestep in the toolbar at the top. Paraview can only display timesteps which have been written out to the disc. You cannot follow along each iteration, as long as you don't write the data out each step. Don't do that, unless you have alot of time and disc space. Once a new step has been written out, you must go to the .foam-Node in Paraview and hit "reload" to make PV detect the latest time steps. Whether you see the timesteps also depends if you run in parallel or not. If you run in parallel, you must select Case Type "decomposed case" at the .foam-Node in Paraview. Otherwise, you need to reconstruct the case to obtain a single timestep folder with the collected results from each processor folder.
3) Paraview does not have tabs. Instead you can run as many instances as you like. If you want two views side by side, you can split the viewport. At the top right of the default viewport, there are controls to split the view horizontally or vertically. Then you can display a case in the left view and another one in the right one, just load in another .foam file.

Amirthaa July 31, 2023 08:19

1) Understood. I meant running in OpenFOAM, as in to work in OpenFOAM without having to close ParaView.
2) I shall check that.
3) Oh, yes. Thanks. I had assumed the viewport was just to view 1 case in different views.

Yann July 31, 2023 08:48

Quote:

Originally Posted by Amirthaa (Post 854380)
1) Understood. I meant running in OpenFOAM, as in to work in OpenFOAM without having to close ParaView.

Open 2 terminals : one to run you case and another one to launch paraview ;)

Amirthaa August 1, 2023 03:27

1 Attachment(s)
Quote:

Originally Posted by AtoHM (Post 854353)
1) you cannot "run" OpenFOAM "files" from Paraview. You open the .foam or .OpenFOAM file in the folder. This acts as an indicator to Paraview how to interprete the data in the folder -> as an OpenFOAM case.

So I created a log file by simpleFoam > log.simpleFoam & but I'm unable to view .foam file in OpenFoam. What am I missing?
I have attached the image of folders list am seeing in paraview and in linux folder.

Amirthaa August 1, 2023 03:29

1 Attachment(s)
What I view in Linux folders:

Yann August 1, 2023 04:35

There are 2 readers for ParaView to open an OpenFOAM case:
  1. The native reader from ParaView: it uses a empty file using the .foam extension to trigger the OpenFOAM reader in ParaView. You can create this file with the command touch myCase.foam. The name of the file does not matter, it is just a trick to tell ParaView it has to open the case with the OpenFOAM reader. This reader will allow you to load a decomposed case, so you don't have to reconstruct your case before loading it in ParaView (just select "Case Type : Decomposed case" in ParaView)
  2. The paraFoam command launches ParaView with a another reader which is shipped with OpenFOAM. This reader won't let you load a decomposed case, so you will need to reconstruct the case first. It has other features though, like the ability to display cellZones.

You can use the native reader from ParaView and avoid create a .foam case by using the command paraFoam -builtin which basically start PataView with the native OpenFOAM reader.

Cheers,
Yann

Amirthaa August 8, 2023 06:55

Okay. I understand a bit better now. I tried opening by the first method also now.
I now get an error, while executing simpleFoam
Code:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 400


SIMPLE: Convergence criteria found
        p: tolerance 0.0001
        U: tolerance 0.0001
        "(k|omega|epsilon)": tolerance 0.0001

Reading field p



--> FOAM FATAL IO ERROR:
size 112446 is not equal to the given value of 112474

Would you be able to help me on this?

Yann August 8, 2023 07:02

There is a mismatch between the size of your mesh and the size of your variables.
Since it seems your simulation is starting at iteration 400, You are probably trying to restart a case after changing the mesh, or something like this.

If you want to start a simulation using previous results on a new mesh, you should use mapFields or mapFieldsPar to map the results on the new mesh before running the case.

Yann

Amirthaa August 8, 2023 07:13

Noted. Yes, I'm restarting the case but I have not made any changes to the mesh.
mapFields is new to me. I shall check that.

Yann August 8, 2023 07:31

If you didn't change anything, it should restart flawlessly.
But the error you get indicates there is something different somewhere between the moment you stopped the simulation and the moment you restarted it.

Have you modified anything? Or restarted the solver with a different command?

Amirthaa August 8, 2023 07:44

I have changed the position of geometry inside the mesh. Other than that I don't think I have made any changes in any files or usage of commands.


All times are GMT -4. The time now is 20:43.