CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Runtime changing of bondary conditions (https://www.cfd-online.com/Forums/openfoam-solving/65120-runtime-changing-bondary-conditions.html)

evrikon June 4, 2009 06:33

Runtime changing of bondary conditions
 
Hello together,

Sometimes I would like to change the boundary condition on-the-fly during the iterations. There is a situation for example where I've recognised to make a small mistake in b.c., however the flow field is nearly correct and good converged.
The option "runtimeModificable" in system dictionary belongs only to numerical settings, like solvers, schemes etc. Any changing of files in "0" directory does not affect the current calculation.

The only option what I see is the solution mapping. Is there any other option (may be simpler) what I don't see now?

leonardo.morita June 4, 2009 07:02

Hello,

A simple way to do that is just to stop your simulation, imposing at the controlDict 'stopAt writeNow', and then you can change the BC in the last time folder created. To restart your simulation, you chose 'startFrom latestTime'.
Note that BC are not read from these files during the calculations, but only at the beginning, so changing them on the fly will have no effect (somebody correct me if I'm wrong).

Regards,

Leonardo

rassilon November 24, 2009 19:53

Quote:

Originally Posted by leonardo.morita (Post 218245)
Hello,

A simple way to do that is just to stop your simulation, imposing at the controlDict 'stopAt writeNow', and then you can change the BC in the last time folder created. To restart your simulation, you chose 'startFrom latestTime'.
Note that BC are not read from these files during the calculations, but only at the beginning, so changing them on the fly will have no effect (somebody correct me if I'm wrong).

Regards,

Leonardo


Hi Guys,

How did you get on with the runtime changing of boundary conditions?

I am running a model that I need to switch the boundary condition from an inletOutlet to a Wall after 1.5 seconds, and then continue to convergence as a wall.

I have tried using the mapFields technique, but it doesn't seem to work - the finished model just displays garbage in Paraview when I run it.

Is there any way of altering the boundary conditions in the middle of the run, or alternatively stopping the run, changing the conditions by hand and then re-starting it?

I think I will be really stuck if I can't get this to work...


R

Chris123 December 8, 2017 03:41

Quote:

Originally Posted by leonardo.morita (Post 218245)
Hello,

A simple way to do that is just to stop your simulation, imposing at the controlDict 'stopAt writeNow', and then you can change the BC in the last time folder created. To restart your simulation, you chose 'startFrom latestTime'.
Note that BC are not read from these files during the calculations, but only at the beginning, so changing them on the fly will have no effect (somebody correct me if I'm wrong).

Regards,

Leonardo

Sorry for revitalize this thread again, but I'am also tackle this problem to change the BC on the fly. If I do it as Leonardo said, I got the error message of inconsistent patch and patchfield types between sthe old and the new BC entries in my U file. Any further ideas?
Best regards,
Chris

mskarysz December 12, 2017 11:41

The answer is here:
https://www.cfd-online.com/Forums/op...ume-field.html

You can do it by 'set' function:
Code:


a.boundaryField().set(patchi, fvPatchField<scalar>::New(name, mesh.boundary()[patchi], a));

where, 'a' is your scalar field, 'patchi' is label of your patch, and name is your new boudary type name, e.g. "zeroGradient". In OF5 you should use:
Code:


boundaryFieldRef()

Here is an example:
Code:

U.boundaryFieldRef().set(0,fvPatchField<vector>::New("zeroGradient", mesh.boundary()[0], U));
Regards


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