CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Problem calculating the residual of momentum eq. in a dynamically changing mesh

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   September 26, 2015, 11:35
Default Problem calculating the residual of momentum eq. in a dynamically changing mesh
New Member
Join Date: Aug 2014
Posts: 14
Rep Power: 3
towanda is on a distinguished road
I am trying to do some programming in OF and I need some help. I have added to the pimpleDyMFoam solver the calculation of some kind of residual of the momentum equation (I attach the corresponding file, also I am working with OF 2.4.0) lines 134-160. In the problem at hand, the code also make a dynamic refinement of the mesh at each time step (I have use dynamicMeshDict to do it). The thing is:

1) I have first tested the coding of the calculation of the residual on a simpler case with a fix mesh in icoFoam and it works.
2)When I run the case with the dynamic mesh refinement, the field uResidual is created but when I try to visualize the solution with paraFoam I get the following error:

p, li { white-space: pre-wrap; } ERROR: In /build/buildd/paraview-4.0.1/VTK/IO/Geometry/vtkOpenFOAMReader.cxx, line 6584
vtkOpenFOAMReaderPrivate (0x27de4a0): Number of cells/points in mesh and field don't match: mesh = 5960, field = 6002

Then I think that I am missing some detail between the calculation of the uResidual with the dynamic mesh. Does anyone could give me a clue of what I am doing wrong?

Thank you very much for your time.
Attached Files
File Type: c scalarPimpleDyMFoam.C (5.0 KB, 5 views)
towanda is offline   Reply With Quote

Old   October 2, 2015, 15:07
Senior Member
kmooney's Avatar
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 297
Rep Power: 9
kmooney is on a distinguished road
Hi towanda,

The issue here is that you're writing out your residual field at a different frequency as the rest of the case (other fields + mesh).

Because you're adding dynamic refinement the mesh is changing (i.e. addiing/removing cells) but you're not writing out the mesh along with the residual field. Thus the size of the field you're writing out doesn't match the size of the latest mesh you're writing out. Manual .write() calls can be troublesome with dynamic mesh cases.

If you remove

and have the field write out normally via setting AUTO_WRITE in the IO constructor like this:

        volScalarField uResidual
                  + fvc::div(phi, U)
		  - fvc::laplacian(nuEff,U)	
                  + fvc::grad(p)
it should resolve your problem.

good luck!
kmooney is offline   Reply With Quote

Old   October 2, 2015, 16:58
New Member
Join Date: Aug 2014
Posts: 14
Rep Power: 3
towanda is on a distinguished road
Hello Kyle,
Thanks for the answer, you are right I was writing the outputs at different times, it works now. I also solved the problem by using the runTime.outputTime() function and I get the same result.

Info<<"ESCRIBE: "<<runTime.value()<<endl;

Thank you very much indeed for your time.
towanda is offline   Reply With Quote


Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with chtMultiregionFoam radiation boundary condition baran_foam OpenFOAM Running, Solving & CFD 9 September 4, 2015 07:31
Wrong fluctuation of pressure in transient simulation caitao OpenFOAM Running, Solving & CFD 2 March 5, 2015 22:33
Why RNGkepsilon model gives floating error shipman OpenFOAM Running, Solving & CFD 3 September 7, 2013 08:00
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 04:34
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55

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