|
[Sponsors] |
September 24, 2009, 09:25 |
Time selection in FoamToEnsight utility
|
#1 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Hello,
I would like to understand how works the time selection in foamToEnsight utility. In the beginning I thought that the new timeSelctor features were available, but finally it is not (no way to use the option -time 0.1:0.2 for instance). It seems to use the controlDict keywords startTime and endTime, at least that is what I understood from the source file, but by testing I am not convinced: in a case containing 4 time directories, changing startTime and/or endTime always results in the processing of all available time directories. Does anyone have a hint ? Thanks! melanie |
|
September 25, 2009, 06:45 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
The main issue with adding the timeSelector to the existing foamToEnsight is that this utility always removes an existing "EnSight" directory at the start, always writes the geometry and writes a *.case file. Thus if you wanted to convert things incrementally, for example, Code:
foamToEnsight -time time1:time2 ... some time later foamToEnsight -time time3:time4 In contrast, the foamZoneToEnsight utility is designed to allow incremental conversion. It not only leaves the ensight directory intact, but will attempt to reduce the number of times the geometry file is written (it uses a file cache with the foam->ensight geometry mapping). But doesn't work in parallel. |
||
September 25, 2009, 08:09 |
|
#3 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Thanks Mark.
Yes, I noticed that each call to foamToEnsight utility removes the existing EnSight directory. I downloaded your foamZonesToEnsight utility from an old thread, and compilation only produced one error: in OF-1.6 there is no addTimeOptionsNoConstant.H file. Did you compile it on OF-1.6? Anyway, I will try to modify the existing foamToEnsight utility to keep the parallel advantage, and I will see if I am also able to get it writing in an existing directory without removing it. melanie |
|
September 25, 2009, 08:26 |
|
#4 | ||
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
Quote:
If you had time though, I think it would be better just to add a -reconstruct option to foamToEnsightParts (eg, by stealing code from reconstructPar). This would allow you to convert existing parallel results to ensight as a serial process (eg, on your workstation) without having to startup a separate parallel process. |
|||
September 25, 2009, 09:34 |
|
#5 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
I did several tries with foamToEnsightParts, and I found some issues. The first point is that this utility is unable to work on time data created with the writeFieldsOften functionObject, since the uniform/time file is not present in this case. Moreover, I need to have Ensight data written in a list, without time directories, of the form
This is a naming convention closer to that used by foamToEnsight utility actually. And indeed, as you mentioned, I would need to add a -reconstruct option to post-process my data. In the end, I don't know what is the easier thing, modify one or the other utility... Regarding the -reconstruct option, are you aware of a utility that performs such a reconstruction as a pre-step ? |
|
September 25, 2009, 10:22 |
|
#6 | |||
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
Quote:
Code:
rm -rf Ensight/data/00000* Code:
rm -rf EnSight/rpm-1500.?.* rm -rf EnSight/rpm-1500.??.* rm -rf EnSight/rpm-1500.???.* Quote:
I think that adding -reconstructPar to foamToEnsightParts would be the better solution, but adding an '-append' option and the timeSelector to foamToEnsight would probably probably be much faster to do. |
||||
September 25, 2009, 10:49 |
|
#7 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
The writeFieldsOften functionObject comes from the simpleFunctionObjects library described on the Wiki here: http://openfoamwiki.net/index.php/Co...vailable_types. I am not sure whether I should submit a bug report since this is not included in the release version, but I am sure Bernhard can hear us !
Actually regarding the Ensight file structure, you are right and now I understand your choice, and this is a good choice also for what i'd like to do. Finally I will have to understand the reconstructPar code and classes! Thank you very much for all your advices Mark. melanie |
|
September 29, 2009, 18:01 |
|
#8 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The writeFieldsOften was just intended as a quick hack to .... äh .... write only certain fields often. I therefore never bothered to write the uniform-directory. And AFAIKS this is written in the Time::writeObject-method ... only if Time thinks it is the right time to write it .... something that the functionObject bypasses. So the best guess would be to emulate the uniform-writing stuff in the FO (but ONLY if Time doesn't think that it is write-time) I think we'll move that discussion to the other thread (it's more appropriate there) |
||
October 1, 2009, 05:31 |
|
#9 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Actually I am answering in this thread because I found a solution in the options of foamToEnsightParts utility. Indeed it is possible to supply a -index option that make the utility ''ignore the time index contained in the time file and use a simple indexing when creating the Ensight files''. This is a very smart feature since it allows to read time directories that do not contain uniform/time file! So I do not need to change the behavior of the functionObject.
I will just have to concentrate on adding a reconstruct option to foamToEnsightParts. Not a tiny thing for me ... ! melanie |
|
October 5, 2009, 13:19 |
|
#10 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
I have done some modifications in foamToEnsightParts.C to treat decomposed data sets. By adding a condition linked to the option -reconstruct
Code:
if (args.optionFound("reconstruct")) { // Perform reconstruction } Code:
#include "processorMeshes.H" #include "fvFieldReconstructor.H" Thanks! melanie |
|
October 6, 2009, 03:22 |
|
#11 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
I'm glad to see you're making progress.
Quote:
Code:
EXE_INC = \ -I$(FOAM_UTILITIES)/parallelProcessing/reconstructPar \ ... |
||
October 6, 2009, 08:45 |
|
#12 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Ok, thanks; for the moment I keep the 'dirty' solution and the file linking is working. I was able to compile the utility without errors, the compiling log shows the following:
Code:
tzntgq@caeldh05:~/OpenFOAM/tzntgq-1.6/applications/utilities/postProcessing/dataConversion/foamToEnsightParts_mine> wclean tzntgq@caeldh05:~/OpenFOAM/tzntgq-1.6/applications/utilities/postProcessing/dataConversion/foamToEnsightParts_mine> wmake libso make: Warning: File `linux64GccDPOpt/options' has modification time 0.57 s in the future make: warning: Clock skew detected. Your build may be incomplete. make: Warning: File `Make/linux64GccDPOpt/dontIncludeDeps' has modification time 0.57 s in the future make: warning: Clock skew detected. Your build may be incomplete. make: Warning: File `Make/linux64GccDPOpt/dontIncludeDeps' has modification time 0.54 s in the future Making dependency list for source file foamToEnsightParts_mine.C make: warning: Clock skew detected. Your build may be incomplete. make: Warning: File `foamToEnsightParts_mine.dep' has modification time 0.53 s in the future SOURCE=foamToEnsightParts_mine.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/lagrangian/basic/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/conversion/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/applications/utilities/parallelProcessing/reconstructPar -IlnInclude -I. -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/foamToEnsightParts_mine.o 'libNULL.so' is up to date. make: warning: Clock skew detected. Your build may be incomplete. Another issue for me is the variables declaration. Actually I modified the existing foamToEnsightParts code to include the reconstruct option. This option is handled with several if loops like described in my previous message. So for instance in one loop I will assign the variable timeDirs, differently if the reconstruct option is chosen or not: Code:
extern instantList timeDirs; if (args.optionFound("reconstruct")) { // use the times list from the master processor // and select a subset based on the command-line options instantList timeDirs = timeSelector::select ( databases[0].times(), args ); if (timeDirs.empty()) { FatalErrorIn(args.executable()) << "No times selected" << exit(FatalError); } } else { instantList timeDirs = timeSelector::select0(runTime, args); } |
|
October 6, 2009, 09:53 |
|
#13 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
I would probably do something like this: Code:
PtrList<Time> databases(1); const bool doReconstruct = args.optionFound("reconstruct"); label nProcs = 0; if (doReconstruct) { ... get nProcs, etc as per reconstructPar ... // Create the processor databases databases.setSize(nProcs); forAll(databases, procI) { databases.set ( procI, new Time ( Time::controlDictName, args.rootPath(), args.caseName()/fileName(word("processor") + name(procI)) ) ); } } else { databases.set ( 0, new Time ( Time::controlDictName, args.rootPath(), args.caseName() ) ); } } // get times for normal or from processor0 instantList timeDirs = timeSelector::select ( databases[0].times(), args ); ... |
||
October 6, 2009, 10:59 |
|
#14 | |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Quote:
I have corrected the code with your suggestions. Anyway, I cannot see the result since the executable is still not created... do you have an idea of what could be the problem, since compilation shows no warning? (except clock skew issues but this is not important for us). |
||
October 15, 2009, 11:38 |
|
#15 | |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Hello,
I am back with a referencing error; actually Mark's suggestion Quote:
melanie |
||
October 19, 2009, 12:54 |
|
#16 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Today I have a good news: I managed to compile and have something working! This is a first important step for me !
Now I still have some troubles. The main issue is that for the reconstruct option to work on decomposed cases, I have to define procMeshes like this: Code:
myProcessorMeshes procMeshes(databases, regionName); I tried to follow the advices given by Mark. But it is complicated to handle... If this is unclear let me know and I post the relevant piece of code! Thanks melanie |
|
October 20, 2009, 03:17 |
|
#17 | ||
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
Quote:
Code:
autoPtr<procMeshes> myProcMeshes; if (WANT_DECOMPOSED_TEST) { myProcMeshes = new procMeshes(databases, regionName); } ... later if (myProcMeshes.valid()) { // decomposed case } else { // standard logic } If you use autoPtr (or any pointer) it should work fine. /mark |
|||
October 20, 2009, 11:43 |
|
#18 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Thanks Mark. I tried your proposition but this does not work; when I implement:
Code:
autoPtr<myProcessorMeshes> myProcessorMeshes; if (doReconstruct) { // Set all times on processor meshes equal to reconstructed mesh ... // Read all meshes and addressing to reconstructed mesh myProcessorMeshes = new procMeshes(databases, regionName); } // do other things forAll(timeDirs, timeI) { if (doReconstruct) { // use procMeshes to reconstruct mesh and field data } } Code:
tzntgq@caeldh05:~/OpenFOAM/tzntgq-1.6/applications/utilities/postProcessing/dataConversion/foamToEnsightParts_mine> wmake make: Warning: File `Make/linux64GccDPOpt/dontIncludeDeps' has modification time 0.65 s in the future Making dependency list for source file foamToEnsightParts_mine.C make: warning: Clock skew detected. Your build may be incomplete. make: Warning: File `foamToEnsightParts_mine.dep' has modification time 0.55 s in the future SOURCE=foamToEnsightParts_mine.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/finiteVolume/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/lagrangian/basic/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/conversion/lnInclude -IlnInclude -I. -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/foamToEnsightParts_mine.o foamToEnsightParts_mine.C: In function ‘int main(int, char**)’: foamToEnsightParts_mine.C:250: error: expected type-specifier before ‘procMeshes’ foamToEnsightParts_mine.C:250: error: no match for ‘operator=’ in ‘myProcessorMeshes = (int*)operator new(4u)’ /home/tzntgq/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/autoPtrI.H:187: note: candidates are: void Foam::autoPtr<T>::operator=(const Foam::autoPtr<T>&) [with T = Foam::myProcessorMeshes] foamToEnsightParts_mine.C:250: error: expected `;' before ‘procMeshes’ foamToEnsightParts_mine.C:300: error: ‘procMeshes’ was not declared in this scope In file included from foamToEnsightParts_mine.C:361: doReconstruct.H:7: error: ‘procMeshes’ was not declared in this scope make: *** [Make/linux64GccDPOpt/foamToEnsightParts_mine.o] Error 1 Code:
if (doReconstruct) { // Set all times on processor meshes equal to reconstructed mesh ... } // Read all meshes and addressing to reconstructed mesh myProcessorMeshes procMeshes(databases, regionName); // do other things ... forAll(timeDirs, timeI) { if (doReconstruct) { // use procMeshes to reconstruct mesh and field data } } The class is named myProcessorMeshes. I studied this class, but I am unable to write a dummy class to treat serial cases, which would probably be the best solution... |
|
October 20, 2009, 12:09 |
|
#19 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
Do you have a typo, or did you really try to use 'myProcessorMeshes' both for the class name and the variable name? But in the reconstruct you have new procMeshes(). What is subclassed from what? I can't figure out what you are doing, but it looks like dangerous programming style. |
||
October 20, 2009, 13:03 |
|
#20 |
Member
Mélanie Piellard
Join Date: Mar 2009
Posts: 86
Rep Power: 17 |
Ok, I should have written
Code:
autoPtr<myProcessorMeshes> procMeshes; But still I do not understand the details of the implementation you suggested with the autoPtr, I did not find documentation about this. And I don't know either if there is a subclass in all this. And it still does not work ! Please excuse my mistakes that may seem trivial to you, I am just learning C++ and OF programming... melanie |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Physical Reason for stability of Implicit Schemes? | radhakrishnan | Main CFD Forum | 26 | October 3, 2023 23:05 |
SimpleFoam k and epsilon bounded | nedved | OpenFOAM Running, Solving & CFD | 16 | March 4, 2017 09:30 |
SimpleFoam k and epsilon bounded | nedved | OpenFOAM Running, Solving & CFD | 1 | November 25, 2008 21:21 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
time step selection | Jackie | Main CFD Forum | 5 | January 12, 2004 13:26 |