CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Updating a boundary condition from the solver (http://www.cfd-online.com/Forums/openfoam-solving/58314-updating-boundary-condition-solver.html)

juho May 30, 2008 03:56

I'd like to bother you all wit
 
I'd like to bother you all with a question again, sorry about it.

I've tried to update a boundary condition on each timestep based on values of the solution of the earlier steps.

The field I want to modify is a scalar and the boundary is defined as a uniform fixedValue.

I've tried to update it by including lines:

variable.boundaryField()[patchI] = newValue;
variable.correctBoundaryConditions();

in to the time loop. newValue is a scalar which is calculated on each timestep.

As many you must have noticed by now, it doesn't work. The values on the boundary patch don't change, even if the newValue changes.

What is the correct way to do this?

eugene June 3, 2008 05:28

Try variable.boundaryField(
 
Try

variable.boundaryField()[patchI] == newValue;

The important bit is the double "==".

juho June 3, 2008 06:00

Thank you!! Works perfectly!
 
Thank you!! Works perfectly!

I had given up on doing it in the solver was writing a boundary condition to do it.

eugene June 3, 2008 06:35

Well doing it as a boundary co
 
Well doing it as a boundary condition is probably the "best" way of going about things.

Performing the assignment in the solver is a lot quicker to code though!

tian September 19, 2008 03:19

Hi "I've tried to update it
 
Hi

"I've tried to update it by including lines:"

Can you give me an excample for the time loop? I also want to update the boundary condition for U after every iteration. I want use the bouyantSimpleFoam.

Thanks a lot

Bye
Thomas

nsghaisas November 19, 2008 08:29

Hi Juho and Eugene I want t
 
Hi Juho and Eugene

I want to implement a boundary condition that reads values from the previous time step and sets the gradient of another variable at the boundaries.

More specifically, I am trying to set the pressure gradient at the boundaries based on the temperature calculated in the previous time step.
dp/dz = g*beta*(T-Tref)

Could you giveme some pointers for doing that?

Thanks

Niranjan

nsghaisas November 20, 2008 06:05

Hi Adam Am I glad that you
 
Hi Adam

Am I glad that you jumped in!

Thanks for these detailed instructions. Will try them out.

Thanks a lot.

Niranjan

isabel March 18, 2011 10:42

Hello everybody,

I want to update a boundary condition called “ABAJO” on each timestep based on the values of the solution of the previous timestep. Particularty, I want to correct the variable T2=110*gamma.
I have written this code:

label inletPatchID = mesh.boundaryMesh().findPatchID("ABAJO");
fvPatchScalarField& condition = T2.boundaryField()[inletPatchID];
forAll(condition, patchI)
{
T2.boundaryField()[patchI] = 110*gamma.boundaryField()[patchI];
}
T2.correctBoundaryConditions();

The solver compiles Ok, but when I run the tutorial I have the following error:

#0 Foam::error:rintStack(Foam::Ostream&) in "/home/isabel/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/isabel/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted: [0xb7766400]
#3 main in "/home/isabel/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/17marzo5"
#4 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#5 _start at /build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:122
Segmentation error


All times are GMT -4. The time now is 19:31.