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

change BC during a run but the BC isn't implemented

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By clapointe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2020, 19:10
Default change a BC during a run
  #1
Senior Member
 
Josh McCraney
Join Date: Jun 2018
Posts: 220
Rep Power: 9
joshmccraney is on a distinguished road
Hi FOAMers!

A tank partially filled with liquid is being drained in interFoam. After 10 seconds, I would like the drain rate to change. To do this, I run the simulation for 10 seconds, then edit the 0/U BC file, and execute " mpirun -np 16 interFoam -parallel "

The issue is the initial boundary condition I specified at the beginning of the run is still being used, as if OpenFOAM does not realize I edited the U file. What command do I need to add? At the beginning of the simulation I run the following

Code:
rm -r postProcessing
rm -r processor*
rm 0/alpha.water
rm constant/dynamicMeshDict
cp -r ../mesh/constant/polyMesh constant
cp dynamicMeshDict_refine constant/dynamicMeshDict
setFields
decomposePar
mpirun -np 16 interFoam -parallel
Thanks so much for your time!

Last edited by joshmccraney; April 30, 2020 at 21:18.
joshmccraney is offline   Reply With Quote

Old   April 30, 2020, 22:09
Default
  #2
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 14
clapointe is on a distinguished road
Assuming that you are starting from that 10s mark (with startFrom latestTime), you will need to edit the bc in the 10/U file -- the 0/U file will not be read, as you've found out. This could be a bit tricky since you're running in parallel. I'm not sure of the best way to go about this -- and someone should jump in if they do -- but off the top of my head you'll either need to edit the decomposed processor*/U file(s) or perhaps you could reconstruct, edit 10/U, and then decompose again.

Caelan
joshmccraney likes this.
clapointe is offline   Reply With Quote

Old   May 1, 2020, 02:22
Default
  #3
Senior Member
 
Josh McCraney
Join Date: Jun 2018
Posts: 220
Rep Power: 9
joshmccraney is on a distinguished road
Quote:
Originally Posted by clapointe View Post
Assuming that you are starting from that 10s mark (with startFrom latestTime), you will need to edit the bc in the 10/U file -- the 0/U file will not be read, as you've found out. This could be a bit tricky since you're running in parallel. I'm not sure of the best way to go about this -- and someone should jump in if they do -- but off the top of my head you'll either need to edit the decomposed processor*/U file(s) or perhaps you could reconstruct, edit 10/U, and then decompose again.

Caelan
I think I'll have to reconstructPar, sadly. The 10/U file looks nothing like the 0/U (a lot of vectors, and the format looks very strange). Thanks for the reply Caelan!

If anyone else has suggestions I'm all ears.
joshmccraney is offline   Reply With Quote

Old   May 1, 2020, 04:47
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,148
Rep Power: 27
Yann will become famous soon enough
Hello,

You can manually edit the processorN/10/U files with a for loop to udpate your boundary condition in every processor directories. BUT, you should check first what writeFormat you are using in your controlDict. It should be set to ascii, since obviously you won't be able to manually modify binary files.

Another way around is to use the changeDictionary utility. I never used it for this specific case but it should do the job, using the option -latestTime in order to update the files in the last time steep.

Cheers,
Yann
Yann 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
[Transient rotating domain initialization from steady state run asanchez84 CFX 0 June 13, 2019 17:28
[ICEM] How to change blocking around the mesh with change in design parameters? jainanup27 ANSYS Meshing & Geometry 0 June 11, 2019 16:39
problem during mpi in server: expected Scalar, found on line 0 the word 'nan' muth OpenFOAM Running, Solving & CFD 3 August 27, 2018 04:18
Stage Frame Change + Porous Domain CFX_Beginner CFX 10 August 10, 2015 04:28
crash:parallel run and writetime? calim_cfd OpenFOAM Bugs 2 March 5, 2012 19:13


All times are GMT -4. The time now is 21:12.