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

[Other] Writing the old 'positions' file in Lagrangian solvers as of OpenFOAM 5.x

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

Like Tree12Likes
  • 12 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 13, 2019, 17:04
Default Writing the old 'positions' file in Lagrangian solvers as of OpenFOAM 5.x
  #1
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
I've seen this asked here on the forum at least a couple of times in the past, but I haven't gone looking for those threads yet.

Essentially the problem is that ever since the barycentric positions were implemented in OpenFOAM-dev and released in OpenFOAM 5.x (OpenFOAM Foundation), it hasn't been possible to load the Lagrangian data into ParaView when using the internal reader, namely with the file extension ".foam", for example if you open the case with this command:
Code:
paraFoam -builtin
To work around this issue, there are at least three possibilities:
  1. Use OpenFOAM's standard reader for ParaView, namely with the file extension ".OpenFOAM".
    • Although this doesn't work when ParaView is not built in the same Operating System as OpenFOAM.
  2. You can export the Lagrangian clouds into VTK files by running:
    Code:
    foamToVTK -fields '()' -noInternal -excludePatches '(".*")'
  3. Or use the new alternative with a function object that I've finished working on an hour or so ago: https://github.com/blueCFD/lagrangia...unctionObjects
If you are using OpenFOAM from OpenFOAM.com (ESI-OpenCFD), you do not need these methods, because they support the old and new formats as follows:
  • Old format is written to "positions".
  • New format is written to "coordinates".
__________________
wyldckat is offline   Reply With Quote

Old   March 4, 2021, 11:06
Default
  #2
Member
 
UOCFD
Join Date: Oct 2020
Posts: 40
Rep Power: 5
uosilos is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
  1. Or use the new alternative with a function object that I've finished working on an hour or so ago: https://github.com/blueCFD/lagrangia...unctionObjects
If you are using OpenFOAM from OpenFOAM.com (ESI-OpenCFD), you do not need these methods, because they support the old and new formats as follows:
  • Old format is written to "positions".
  • New format is written to "coordinates".

Hi Bruno,

I am facing a problem with your tool (this is the same post I wrote in blueCFD github).

I am tryingto use the function with coalChemistryFoam (OF8), so maybe this coalCloud class is not recognised in the script (only MPPIC, colliding, spray and reacting multiphase). But actually this latter is included to form the coalCloud.

In my case positions.orig are properly written in processorx/lagrangian/coalCloud1 but when reconstructing they do not reconstruct.


Trying to reconstruct and then running postProcess -dict system/positionConvertDict gives me this error:
Code:
Executing functionObjects   --> FOAM FATAL ERROR:    

   request for kinematicCloud coalCloud1 from objectRegistry region0 failed 

    available objects of type kinematicCloud are 0()    

   From function const Type& Foam::objectRegistry::lookupObject(const Foam::word&)


 const [with Type = Foam::kinematicCloud]   
 
  in file /opt/openfoam8/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 211. 

 FOAM aborting
uosilos is offline   Reply With Quote

Old   June 17, 2021, 14:42
Default position conversion accuracy
  #3
New Member
 
Negar Naghash
Join Date: Mar 2017
Posts: 5
Rep Power: 9
negarnaghash is on a distinguished road
Hi Bruno,

I am trying to use your function object on OF7 to convert barycentric to old positions for a coaxial nozzle flow. The code has compiled with no error but when I do the postprocessing the conversion moves the particle elsewhere.
AS you can see the particles are injected in the core nozzle but in the converted position visualization there are particles in the secondary exhaust.

converted.jpg
original.jpg

So I'm trying to see what causes the deviation from the exact positions.
Thanks
Negar
negarnaghash is offline   Reply With Quote

Old   November 30, 2021, 21:52
Default
  #4
New Member
 
Luis Felipe López
Join Date: Apr 2020
Posts: 7
Rep Power: 6
lf.lopez18 is on a distinguished road
Quote:
Originally Posted by uosilos View Post
Hi Bruno,

I am facing a problem with your tool (this is the same post I wrote in blueCFD github).

I am tryingto use the function with coalChemistryFoam (OF8), so maybe this coalCloud class is not recognised in the script (only MPPIC, colliding, spray and reacting multiphase). But actually this latter is included to form the coalCloud.

In my case positions.orig are properly written in processorx/lagrangian/coalCloud1 but when reconstructing they do not reconstruct.


Trying to reconstruct and then running postProcess -dict system/positionConvertDict gives me this error:
Code:
Executing functionObjects   --> FOAM FATAL ERROR:    

   request for kinematicCloud coalCloud1 from objectRegistry region0 failed 

    available objects of type kinematicCloud are 0()    

   From function const Type& Foam::objectRegistry::lookupObject(const Foam::word&)


 const [with Type = Foam::kinematicCloud]   
 
  in file /opt/openfoam8/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 211. 

  FOAM aborting

I have the same problem when I want to generate the positions.orig file as post-processing with the sprayFoam solver. It's frustrating because parallelization accelerates my simulations with droplets. I think the program is not detecting the cloud type and using kinematicCloud as default. If anyone knows a solution about this, it would be great, please let us know.


Thanks,
Luis.
lf.lopez18 is offline   Reply With Quote

Old   December 3, 2021, 08:41
Default
  #5
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,680
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by lf.lopez18 View Post
I have the same problem when I want to generate the positions.orig file as post-processing with the sprayFoam solver. It's frustrating because parallelization accelerates my simulations with droplets. I think the program is not detecting the cloud type and using kinematicCloud as default. If anyone knows a solution about this, it would be great, please let us know.

Is running with one of the openfoam.com versions an option? There you continue to have positions (xyz) and coordinates (barycentric), which makes it simple to post-process in paraview.
olesen is offline   Reply With Quote

Old   December 3, 2021, 09:33
Default
  #6
New Member
 
Luis Felipe López
Join Date: Apr 2020
Posts: 7
Rep Power: 6
lf.lopez18 is on a distinguished road
Quote:
Originally Posted by olesen View Post
Is running with one of the openfoam.com versions an option? There you continue to have positions (xyz) and coordinates (barycentric), which makes it simple to post-process in paraview.

Unfortunately, the server I use and my custom solver are in OF5 (.org), so it would be difficult to change it. Despite this, I solved the problem by adding the following text in file "OpenFOAM-5.x/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C" in these lines:


Line 222:
Code:
IOField<vector> positions_orig(c.fieldIOobject("positions_orig", IOobject::NO_READ), np);
Line 239:
Code:
positions_orig[i] = p.position();
Line 255:
Code:
positions_orig.write(valid);
It is possible that in other versions the lines are different. This will generate a "positions_orig" file in cartesian coordinates, which can be reconstructed from decomposed results. To change the file in barycentric coordinates to cartesian, I use a similar code as the functionObject posted by wyldckat:


Code:
find -name positions | while read line; do mv $line $line.coord; mv $line_orig $line; done
find -name positions | while read line; do sed -i -e 's=^\(.*object.*\)positions_orig;=\1positions;=' $line; done
lf.lopez18 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Thermophysical Properties wsmith02 OpenFOAM 4 June 1, 2023 14:30
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 03:30
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
[swak4Foam] build problem swak4Foam OF 2.2.0 mcathela OpenFOAM Community Contributions 14 April 23, 2013 13:59
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 05:18


All times are GMT -4. The time now is 17:34.