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

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

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 26, 2015, 12:35
Default Problem calculating the residual of momentum eq. in a dynamically changing mesh
  #1
New Member
 
towanda
Join Date: Aug 2014
Posts: 20
Rep Power: 12
towanda is on a distinguished road
Hello,
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, 18 views)
towanda is offline   Reply With Quote

Old   October 2, 2015, 16:07
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18
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

Code:
    uResidual.write();
and have the field write out normally via setting AUTO_WRITE in the IO constructor like this:

Code:
        volScalarField uResidual
        (
                IOobject
                (
                    "uResidual",
                    runTime.timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::AUTO_WRITE
                ),
                mag
                (
		    fvc::ddt(U)	
                  + fvc::div(phi, U)
		  - fvc::laplacian(nuEff,U)	
                  + fvc::grad(p)
                )
         );
it should resolve your problem.

good luck!
Cheers,
Kyle
kmooney is offline   Reply With Quote

Old   October 2, 2015, 17:58
Default
  #3
New Member
 
towanda
Join Date: Aug 2014
Posts: 20
Rep Power: 12
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.

if(runTime.outputTime()){
uResidual.write();
Info<<"ESCRIBE: "<<runTime.value()<<endl;
}

Thank you very much indeed for your time.
towanda 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
Problem with chtMultiregionFoam radiation boundary condition baran_foam OpenFOAM Running, Solving & CFD 10 December 17, 2019 18:36
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 09: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 05:29.