Inlet boundary condition problem

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

davidm
Posts: 6
Joined: Sun Oct 07, 2018 2:38 am

Inlet boundary condition problem

Postby davidm » Sun Oct 07, 2018 6:15 am

I suspect this is a symptom of some other problem but here goes.

Just by the way, I found that the number of decimals you set in Preferences/Units impacts on the size of numbers you can use in cfdOF, like convergence criteria.

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git)
Build type: Release
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/Australia (en_AU)

I have an orifice in pipe, laminar flow. I could not get this to converge with a simple mesh generated by gmesh, cfMesh or even snappyHexMesh.

I did a mesh refinement in snappyHexMesh and improved things yesterday. Eventually I got very rapid convergence but the results were junk, totally nonphysical. Today I tried some changes but the solver kept stopping due to errors on the model that ran yesterday.

I reinstalled FreeCAD & cfdOF. no luck.

As soon as I do a mesh refinement I get errors. Currently I get this as soon as I try to run the model. In an earlier iteration, if I deleted the inlet boundary condition I could not replace it as that face on the model was no longer selectable (the pipe looked hollow ended) after I deleted the boundary condition. Currently I can select the face but I still get the error below.

I am specifying a uniform inlet velocity of 0.34 m/sec. I tried other options (volumetric flow, total pressure) with the same error.

Start to write case to folder c:\users\dmeyer~1.ori\CFD1
Traceback (most recent call last):
File "C:\Users\dmeyer.ORION\AppData\Roaming\FreeCAD\Mod\CfdOF\_TaskPanelCfdSolverControl.py", line 133, in write_input_file_handler
self.solver_runner.writer.writeCase()
File "C:\Users\dmeyer.ORION\AppData\Roaming\FreeCAD\Mod\CfdOF\CfdCaseWriterFoam.py", line 100, in writeCase
self.processInitialConditions()
File "C:\Users\dmeyer.ORION\AppData\Roaming\FreeCAD\Mod\CfdOF\CfdCaseWriterFoam.py", line 398, in processInitialConditions
raise RuntimeError("Inlet type not appropriate to determine initial velocity and pressure.")
RuntimeError: Inlet type not appropriate to determine initial velocity and pressure.

FYI, I get problems trying to run this model in Simscale also, it doesn't seem to like mesh refinement either. Though there, it won't mesh once I specify the refinement region.

Any help would be appreciated.
thschrader
Posts: 1366
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Inlet boundary condition problem

Postby thschrader » Sun Oct 07, 2018 7:12 pm

Hello David,
welcome to the freecad-forum. And to cfd :)
Which problem you will solve?
Can you post your freecad file?
To be clear: we both use bluecfdcore
Thomas
davidm
Posts: 6
Joined: Sun Oct 07, 2018 2:38 am

Re: Inlet boundary condition problem

Postby davidm » Sun Oct 07, 2018 9:17 pm

Thomas,

The file is here.https://www.orion-fire.com/EcoForum/Ori ... ter2.FCStd

Do you need the geometry file?

I am using the bluecfdcore.

I am not a complete novice with cfd but I do have a lot to learn:)

is there a way to directly upload files in this forum?
thschrader
Posts: 1366
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: Inlet boundary condition problem

Postby thschrader » Mon Oct 08, 2018 4:36 pm

Hi David,
did a little modification on your file (using half of the body).
Inlet: v=340 mm/s, fluid water, pipe-radius 12,5 mm at inlet.
The volume-flow at inlet is 8,34e-5 m^3/s.
In paraview, you can set a slice at the narrowing, then use
Filter “Integrate variables”. You get 8,25e-5 m^3/s, the error is 1%.
So the results seems plausible for me (I am not familiar with pipe-hydraulics...)
File-attachment: see help
https://forum.freecadweb.org/viewtopic.php?f=3&t=2264
Thomas
OrificeNew.FCStd
(23.93 KiB) Downloaded 10 times
davidm
Posts: 6
Joined: Sun Oct 07, 2018 2:38 am

Re: Inlet boundary condition problem

Postby davidm » Tue Oct 09, 2018 11:37 am

Thanks Thomas.

It defaulted to cfMesh but I assume I need to use snappyHexmesh where cfMesh exited with an error (but I could not find any information on the error, no log, nothing in the report frame). That meshed however,

0.0: Checking dependencies...
0.0: OpenFOAM case writer is called
0.2: Write OpenFOAM case is completed
1.3: Starting solver command:
1.3: C:\PROGRA~1\blueCFD-Core-2017\OpenFOAM-5.x\..\msys64\usr\bin\bash --login -O expand_aliases -c cd "/c/users/dmeyer~1.ori/CFD1/case" && ./Allrun
1.4: Solver started
11.1: OpenFOAM IO error: inconsistent patch and patchField types for file: C:/users/dmeyer~1.ori/CFD1/case/0/U.boundaryField.defaultFaces from line 65 to line 19.
11.1: Simulation exited with error


log.PotentialFOAM details this error.
--> FOAM FATAL IO ERROR:
inconsistent patch and patchField types for
patch type empty and patchField type slip

file: C:/users/dmeyer~1.ori/CFD1/case/0/U.boundaryField.defaultFaces from line 65 to line 19.

From function static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
in file X:/OpenFOAM-5.x/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C at line 160.

FOAM exiting

log.createPatch contains some lines like this.
--> FOAM Warning :
From function Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 798
Cannot find any patch or group names matching face7
--> FOAM Warning :
From function Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 798
Cannot find any patch or group names matching face8
User avatar
oliveroxtoby
Posts: 219
Joined: Fri Dec 23, 2016 9:43 am

Re: Inlet boundary condition problem

Postby oliveroxtoby » Tue Oct 09, 2018 8:34 pm

davidm wrote:
Tue Oct 09, 2018 11:37 am
It defaulted to cfMesh but I assume I need to use snappyHexmesh where cfMesh exited with an error (but I could not find any information on the error, no log, nothing in the report frame). That meshed however,
Have you checked that cfMesh is installed (Edit | Preferences | CFD | Dependency checker)? For me it works fine on the downloaded file from thschrader.
0.0: Checking dependencies...
0.0: OpenFOAM case writer is called
0.2: Write OpenFOAM case is completed
1.3: Starting solver command:
1.3: C:\PROGRA~1\blueCFD-Core-2017\OpenFOAM-5.x\..\msys64\usr\bin\bash --login -O expand_aliases -c cd "/c/users/dmeyer~1.ori/CFD1/case" && ./Allrun
1.4: Solver started
11.1: OpenFOAM IO error: inconsistent patch and patchField types for file: C:/users/dmeyer~1.ori/CFD1/case/0/U.boundaryField.defaultFaces from line 65 to line 19.
11.1: Simulation exited with error


log.PotentialFOAM details this error.
--> FOAM FATAL IO ERROR:
inconsistent patch and patchField types for
patch type empty and patchField type slip

file: C:/users/dmeyer~1.ori/CFD1/case/0/U.boundaryField.defaultFaces from line 65 to line 19.

From function static Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = Foam::Vector<double>]
in file X:/OpenFOAM-5.x/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C at line 160.

FOAM exiting

log.createPatch contains some lines like this.
--> FOAM Warning :
From function Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 798
Cannot find any patch or group names matching face7
--> FOAM Warning :
From function Foam::labelHashSet Foam::polyBoundaryMesh::patchSet(const Foam::UList<Foam::wordRe>&, bool, bool) const
in file meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C at line 798
Cannot find any patch or group names matching face8
For me, snappyHexMesh works fine provided I use the 'search' button to select a point inside the mesh first. Did you do this, and check that the mesh looks sensible?
davidm
Posts: 6
Joined: Sun Oct 07, 2018 2:38 am

Re: Inlet boundary condition problem

Postby davidm » Wed Oct 10, 2018 9:51 am

Thanks for the help guys.

Something is not quite right about the cfMesh installation. I tried installing again and it seems to install but the log has errors relating to not finding foamTime.H. cfMesh generates what looks like part of the mesh only.

You are correct Oliver, I had forgotten to find the interior point. Now I get a mesh from snappyHexMesh.

What convergence criteria did you use for the simulation? Mine didn't seem to converge but the result was more realistic than previously. It is set to 0.001 at present (for some reason it won't let me change that).

Thanks for the pointer on using a symmetry condition Thomas, I hadn't worked out how to do that with cdfOF, I didn't look in Constraint for that. I also have a lot to learn abut Paraview.
User avatar
oliveroxtoby
Posts: 219
Joined: Fri Dec 23, 2016 9:43 am

Re: Inlet boundary condition problem

Postby oliveroxtoby » Wed Oct 10, 2018 8:22 pm

davidm wrote:
Wed Oct 10, 2018 9:51 am
Thanks for the help guys.

Something is not quite right about the cfMesh installation. I tried installing again and it seems to install but the log has errors relating to not finding foamTime.H.
This is a natural byproduct of the build process, and nothing to worry about. If the dependency checker doesn't complain, the installation should be good.
cfMesh generates what looks like part of the mesh only.
That is really strange.
What convergence criteria did you use for the simulation? Mine didn't seem to converge but the result was more realistic than previously. It is set to 0.001 at present (for some reason it won't let me change that).
I don't get a converged solution, probably because the flow is too unsteady (there is not always a steady-state solution). If you were to run a transient simulation, you would probably see the time-dependence of the solution.
davidm
Posts: 6
Joined: Sun Oct 07, 2018 2:38 am

Re: Inlet boundary condition problem

Postby davidm » Wed Oct 10, 2018 11:25 pm

Thanks, I could have spent a lot of time trying for a converged solution.

This is the U plot from the last run. It is not quite what I expected, but maybe for laminar flow it is realistic. I am mostly interested in the unrecoverable pressure loss right now.
Attachments
Orifice.PNG
Orifice.PNG (107.22 KiB) Viewed 266 times
davidm
Posts: 6
Joined: Sun Oct 07, 2018 2:38 am

Re: Inlet boundary condition problem

Postby davidm » Thu Oct 11, 2018 8:52 pm

For the learning experience I ran a series of computations with increasing viscosity and the solution would converge at higher viscosity (lower Reynolds number). The Reynolds number in the pipe & restriction is turbulent at water viscosity, so I then ran this case as a turbulent flow and this converged in 2600 iterations.

It didn't change the solution much and the plume downstream of the orifice still seems a bit odd. I am not sure why there is a W shape to it.


Thanks for your help Oliver & Thomas.
Attachments
Orifice2.PNG
Orifice2.PNG (48.57 KiB) Viewed 240 times