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

How to re-run the case with updated/corrected boundary condition

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes
  • 2 Post By Krao
  • 1 Post By Krao
  • 1 Post By chandra shekhar pant
  • 2 Post By fra76
  • 1 Post By fra76
  • 1 Post By fra76
  • 1 Post By Krao
  • 1 Post By chandra shekhar pant

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2019, 04:58
Default How to re-run the case with updated/corrected boundary condition
  #1
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
Dear Foamers,


I was running a case of propellor and realized after many days that the boundary condition for the outer cylinder (top, bottom, front back etc) are not proper, thus wanted to change the present boundary condition of pressure from p=0 to zero gradient. Now since, I have been running the case for a week and don't want to spoil the time, thus is there any way to simply change the boundary condition at the present solution time step?



I found that in the recent folder (suppose t=5 s) I had the files for pressure, velocity etc and in that the boundary heading is there, by changing this to the desired one will do the work ?



Also for the 3D case the file is huge and to search the keyword boundary is cumbersome, is there any way to make it faster?



Thanks!
chandra shekhar pant is offline   Reply With Quote

Old   October 28, 2019, 06:03
Default
  #2
Senior Member
 
Kmeti Rao
Join Date: May 2019
Posts: 145
Rep Power: 8
Krao is on a distinguished road
Hi Chandra Shekar.

Quote:
Originally Posted by chandra shekhar pant View Post

I found that in the recent folder (suppose t=5 s) I had the files for pressure, velocity etc and in that the boundary heading is there, by changing this to the desired one will do the work ?
If you are running it parallel, use 'reconstructPar -latestTime' to reconstruct the case at 5s and then edit the required boundary conditions, and decompose the case and run it further.

If it is a serial case then it is a straight forward task, edit the required BC and continue running.

Importnant: don't forget to change the startFrom to latestTime in controlDict.

Quote:
Also for the 3D case the file is huge and to search the keyword boundary is cumbersome, is there any way to make it faster?
Yes, opening the file using gedit or other text editor requires a lot of memory and it is very difficult to edit. Therefore use the 'vi editor' in the terminal. For more information about using vi editor visit the following link and go to page 68 http://www.wolfdynamics.com/images/O...rash_intro.pdf. Hope it helps.

K. Rao
Krao is offline   Reply With Quote

Old   October 28, 2019, 06:16
Default
  #3
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
Hello Kmeti Rao,


Thanks, great! But now I could see that the files are in binary format, and after using the utility, "foamFormatConvert", this is sending an error which says:


--> FOAM FATAL ERROR:
Point motion detected but number of points 595219 in "/home/csp/OpenFOAM/csp-v1906/run/propeller_actual/trial_binary_ascii/0.09/polyMesh/points" does not correspond to current 3549

From function virtual Foam:olyMesh::readUpdateState Foam:olyMesh::readUpdate() in file meshes/polyMesh/polyMeshIO.C at line 447.



Just wondering am I doing something silly?
chandra shekhar pant is offline   Reply With Quote

Old   October 28, 2019, 06:22
Default
  #4
Senior Member
 
Kmeti Rao
Join Date: May 2019
Posts: 145
Rep Power: 8
Krao is on a distinguished road
I have never used this utility "foamFormatConvert". Why do you want to convert? Use the binary format file itself. Search for the particular boundary condition, edit it and save.
Krao is offline   Reply With Quote

Old   October 28, 2019, 06:28
Default
  #5
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
Thanks, make sense.
Krao likes this.
chandra shekhar pant is offline   Reply With Quote

Old   October 29, 2019, 02:51
Default
  #6
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Quote:
Originally Posted by chandra shekhar pant View Post
Thanks, make sense.
No no, you do not need to reconstruct, convert to ascii and edit by hand.
You can use changeDictionary to modify boundary conditions and boundary types on an existing solution, in parallel.

Hope this helps,
Francesco

By the way, you cannot edit a binary file as if it was ascii, a text editor like vi would not treat the binary blocks correctly, so foamFormatConvert was the right thing, but changeDictionary is a much better solution in my opinion.
chandra shekhar pant and Krao like this.

Last edited by fra76; October 29, 2019 at 02:53. Reason: Notes on binary
fra76 is offline   Reply With Quote

Old   October 29, 2019, 02:59
Default
  #7
Senior Member
 
Kmeti Rao
Join Date: May 2019
Posts: 145
Rep Power: 8
Krao is on a distinguished road
Quote:
Originally Posted by fra76 View Post
No no, you do not need to reconstruct, convert to ascii and edit by hand.
You can use changeDictionary to modify boundary conditions and boundary types on an existing solution, in parallel.

Hope this helps,
Francesco

By the way, you cannot edit a binary file as if it was ascii, a text editor like vi would not treat the binary blocks correctly, so foamFormatConvert was the right thing, but changeDictionary is a much better solution in my opinion.
For this very reason, I would like to interact with the community, always there is a room for improvement and nice to learn something new everyday. Improving our skills in OpenFOAM in a more effective way.

Cheers!!!

K. Rao
Krao is offline   Reply With Quote

Old   October 29, 2019, 03:21
Default
  #8
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
Many thanks K Rao and Francesco Del Citto for your valuable input.


Francesco Del Citto, could you please elaborate how to work with "changeDictionary" . I think I am clear in my question, so please help how to proceed in this?

I am having binary files and I intend to change the boundary condition, does the same procedure is valid even if the ASCII files are there?


To use the "foamFormatConvert" I first modified the controlDict in which I changed the "writeFormat" from binary to ASCII and then ran the "foamFormatConvert" to get the final folder in the ASCII, and finally modified the "boundary" keyword with "inlet, outlet" etc.



Is it the same for "changeDictionary"? I had just started to use the OPenFoam, thus may be a little naive.



Thanks a lot!
chandra shekhar pant is offline   Reply With Quote

Old   October 29, 2019, 05:25
Default
  #9
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Do it the openfoam way!
Go to the installation directory, under applications/utilities/preProcessing or something like that you will find the changeDictionary application. Inside the directory there is a sample changeDictionaryDict you can use as reference.

Copy it to your case, inside system, edit it and then run mpirun changeDictionary -latestTime.

I’d make a copy of the whole case before, just to have a backup if something fails...

Hope this helps,
Francesco
fra76 is offline   Reply With Quote

Old   October 29, 2019, 07:25
Default
  #10
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
Many thanks Francesco Del Citto for your help, I find the desired dictionary at OpenFOAM-v1906/applications/utilities/preProcessing/changeDictionary


Copied the whole changeDictionary into the system of my running folder, modified the C++ file (attached herewith, as for now just for trial), but still when trying to run the changeDictionary -latestTime, it is showing the error:



--> FOAM FATAL ERROR:
cannot find file "/home/csp/OpenFOAM/csp-v1906/run/2D_blunt_edge_rans_sigma0.93_aoa3_flowcontrol_comb ine_2sec/system/changeDictionaryDict"

From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::rea dStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const
in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 548.

FOAM exiting


Is something else should be done, or something carefully be done. Sorry for being iterative in the questions. Thanks!
Attached Files
File Type: c changeDictionary.C (20.4 KB, 10 views)
chandra shekhar pant is offline   Reply With Quote

Old   October 29, 2019, 08:40
Default
  #11
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
A lot of confusion here.
You do not need to change the C++ code. changeDictionary is an application that requires an input dictionary, called changeDictionaryDict. You can find an example of Thurman dictionary in the source directory of the application, but this does not mean you need to change the C++ code.
The error message is clear as well, it cannot find system/changeDictionaryDict, so all you need to do is to copy that file to the system directory (just the dictionary, not the whole source directory), modify it according to your case and run the application changeDictionary.

More than that, I cannot help...

Cheers,
Francesco
fra76 is offline   Reply With Quote

Old   October 29, 2019, 09:46
Default
  #12
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
I am sincerely thankful to you Mr. Francesco Del Citto for your help, support and patience.

I think I misunderstood you, as you might have been knowing that, I was looking for that "changeDictionaryDict" and you eventually directed straight to the source code, that was a bit confusing for me. Now, I found that its actually been there at the:
tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater


and when I tried it, it works fine.



I am highly thankful for your valuable time and inputs.



Thanks again!
chandra shekhar pant is offline   Reply With Quote

Old   October 29, 2019, 10:47
Default
  #13
Senior Member
 
Kmeti Rao
Join Date: May 2019
Posts: 145
Rep Power: 8
Krao is on a distinguished road
Quote:
Originally Posted by chandra shekhar pant View Post
I am sincerely thankful to you Mr. Francesco Del Citto for your help, support and patience.

I think I misunderstood you, as you might have been knowing that, I was looking for that "changeDictionaryDict" and you eventually directed straight to the source code, that was a bit confusing for me. Now, I found that its actually been there at the:
tutorials/heatTransfer/chtMultiRegionSimpleFoam/externalCoupledHeater/system/bottomWater


and when I tried it, it works fine.



I am highly thankful for your valuable time and inputs.



Thanks again!
No he did not directed you to the source code! He directed you to find the sample examples. In the installation folder, you can find a folder name called 'etc', there you can find this 'caseDicts'. In this folder you have a lot of example from pre-processing to post-processing. No need to search inside tutorials. (This changeDictionaryDict is inside annotated folder).

Cheers!
Krao is offline   Reply With Quote

Old   October 30, 2019, 02:24
Default
  #14
Senior Member
 
chandra shekhar pant
Join Date: Oct 2010
Posts: 220
Rep Power: 17
chandra shekhar pant is on a distinguished road
Excellent, thanks a lot, now I could see the Dict also. Earlier I tried to search in the tutorial case for the desired Dict and it was really cumbersome. I think what you have suggested is more appropriate and straight forward, great!



Thanks again.
Krao likes this.
chandra shekhar pant 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
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
CFD analaysis of Pelton turbine amodpanthee CFX 31 April 19, 2018 19:02
Problem in setting Boundary Condition Madhatter92 CFX 12 January 12, 2016 05:39
vorticity boundary condition bearcharge Main CFD Forum 0 May 14, 2010 12:32
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05


All times are GMT -4. The time now is 11:46.