CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Bugs

Bug in patchInternalField()

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By psosnows

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2011, 11:57
Default Bug in patchInternalField()
  #1
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Greetings,

I believe that there is a problem in implementation of the function patchInternalField().

The distribution is OpenFoam-1.7.1.

The problem was discovered while working on updateCoeffs() function of derivedFvPatchField (derived from mixedFvPatchField):
Code:
void Foam::myFvPatchScalarField::updateCoeffs()
{
        // <some code>

        const scalarField& thisIntField = patchInternalField();
        Info << thisIntField << endl;

        // <some more code>
}
In the log we should obtain values of internal field next to the studied patch (in tested case they were set to 300).

Instead, some cells contain zero value.
Code:
value nonuniform List<scalar> 
2160
(
6.92193e-310
6.92193e-310
0
0
300
300
300
<...>
);
The mesh was generated using blockMesh. The geometry is shown in the figure attached. Mesh has only 2 patches- the outside one and the inside one.

New boundary condition is applied only on the inner patch.
Anomalies appear only on the faces that are next to the edges, selective, not all. Usually several first ones (like in the example above).

If the "inner" patch is divided into 6 ones, with applied new derivedBC, anomalies are not observed.

Presented usage of the function is quite basic- this drives to conclusion that there is something wrong deeper in the code. Please this bug into consideration.

I would also be very grateful for any other possible explanation of the described problem.

Best,
Pawel S
Attached Images
File Type: jpg geom.jpg (18.5 KB, 32 views)
psosnows is offline   Reply With Quote

Old   July 24, 2011, 16:14
Default
  #2
Senior Member
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0
chegdan will become famous soon enoughchegdan will become famous soon enough
Did this get resolved? Maybe you should report it directly to http://www.openfoam.com/bugs/

and/or

http://sourceforge.net/apps/mantisbt..._view_page.php


Cheers,

Dan
chegdan is offline   Reply With Quote

Old   September 21, 2011, 13:12
Default
  #3
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
Pawel,

did you create a bug report for this? I have not been able to find one...

At the moment, I am facing the same problem (using OF 1.6-ext), as patch values calculated by patchInternalField() are different from internal field values in the patch near cells.
Or did you find a solution for this in the meantime?

Arne

Edit: Could someone check if the following is right or wrong:

Quote:
Unw.boundaryField()[patchi] = U.boundaryField()[patchi].patchInternalField();
I'd like to compute U at the patch nearest cells and store it to a Unw volVectorField.

Last edited by Arnoldinho; September 22, 2011 at 01:50. Reason: typos
Arnoldinho is offline   Reply With Quote

Old   September 22, 2011, 07:46
Default
  #4
Senior Member
 
Arne Stahlmann
Join Date: Nov 2009
Location: Hanover, Germany
Posts: 209
Rep Power: 17
Arnoldinho is on a distinguished road
Ok, having a deeper look at my results, I can so far state that the "bug" in my case only resulted from the interpolation/display scheme in ParaView:

Values from U.boundaryField()[patchi].patchInternalField() were different from U internalField values at regarded probe locations, because ParaView normally seems to use (mesh) point values instead of cell values for display. Using a CellDatatoPointData filter before setting the probe location in contrast results in identical values.

Arne
Arnoldinho is offline   Reply With Quote

Old   October 12, 2011, 03:53
Default
  #5
New Member
 
Tim Gronarz
Join Date: Sep 2011
Location: Aachen
Posts: 4
Rep Power: 14
TimG is on a distinguished road
Hi,

i am facing exactly the same Problem as Pawel does. I also get four wrong values as the first entries in my Field list.
Is there a Solution to this? Is it even a Bug or did i do something wrong?

Cheers, Tim
TimG is offline   Reply With Quote

Old   October 12, 2011, 04:22
Default
  #6
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
Hello Tim,

this issue disappeared when I moved to OF-2.0.0. In the end I did not find out what caused it, but used a "walk around".

You can create a function and use it instead of patchInternalField
In the .H file:
Code:
virtual tmp<scalarField> ppatchInternalField() const;
In the .C file:
Code:
Foam::tmp<Foam::scalarField> Foam::NAME_OF_YOUR_BOUNDARY_CONDITION::ppatchInternalField() const
{
	tmp<scalarField> tField(new scalarField(size()));
	scalarField& refF=tField();
	forAll(patch().faceCells(),cellI)
	{
		refF[cellI]=(*this).internalField()[patch().faceCells()[cellI]];
	}
	return tField;
}
This one does exactly the same thing as original one, but did not cause the problem mentioned (note that OF function is a template, here you have direct specification of the type). You simply use it instead patchInternalField(). I changed the name just to know that I am using my own code, not the standard OF stuff. If you like, there should be no problem for simply overloading original function.

Hope it helps a bit.
Best,
Pawel
randolph likes this.
psosnows is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Serious bug in LES interface fs82 OpenFOAM Bugs 21 November 16, 2009 08:15
On Bug of Fluent 12.0 lzgwhy FLUENT 0 August 26, 2009 06:41
Bug in twoPhaseEulerFoam wallfunctions alberto OpenFOAM Bugs 1 February 9, 2007 14:15
Bug reports Mattijs Janssens (Mattijs) OpenFOAM 0 January 10, 2005 10:05
Forum y2k Bug Jonas Larsson Main CFD Forum 1 January 5, 2000 10:22


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