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

Updating a boundary condition from the solver

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 30, 2008, 03:56
Default I'd like to bother you all wit
  #1
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 80
Rep Power: 8
juho is on a distinguished road
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?
juho is offline   Reply With Quote

Old   June 3, 2008, 05:28
Default Try variable.boundaryField(
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
Try

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

The important bit is the double "==".
eugene is offline   Reply With Quote

Old   June 3, 2008, 06:00
Default Thank you!! Works perfectly!
  #3
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 80
Rep Power: 8
juho is on a distinguished road
Thank you!! Works perfectly!

I had given up on doing it in the solver was writing a boundary condition to do it.
juho is offline   Reply With Quote

Old   June 3, 2008, 06:35
Default Well doing it as a boundary co
  #4
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
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!
eugene is offline   Reply With Quote

Old   September 19, 2008, 03:19
Default Hi "I've tried to update it
  #5
Senior Member
 
Tian
Join Date: Mar 2009
Posts: 101
Rep Power: 8
tian is on a distinguished road
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
__________________
BIM HVACTool
tian is offline   Reply With Quote

Old   November 19, 2008, 08:29
Default Hi Juho and Eugene I want t
  #6
New Member
 
Niranjan Ghaisas
Join Date: Mar 2009
Location: Pune, Maharashtra, India
Posts: 10
Rep Power: 8
nsghaisas is on a distinguished road
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 is offline   Reply With Quote

Old   November 20, 2008, 06:05
Default Hi Adam Am I glad that you
  #7
New Member
 
Niranjan Ghaisas
Join Date: Mar 2009
Location: Pune, Maharashtra, India
Posts: 10
Rep Power: 8
nsghaisas is on a distinguished road
Hi Adam

Am I glad that you jumped in!

Thanks for these detailed instructions. Will try them out.

Thanks a lot.

Niranjan
nsghaisas is offline   Reply With Quote

Old   March 18, 2011, 10:42
Default
  #8
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 8
isabel is on a distinguished road
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
isabel is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boundary condition error depending on location of solver execution kjmaki OpenFOAM Running, Solving & CFD 0 June 18, 2008 15:04
Boundary condition of the third kind or Danckwertz boundary condition plage OpenFOAM Running, Solving & CFD 4 October 3, 2006 12:21
How to setup boundary condition with couple solver JINHUI FLUENT 0 September 8, 2006 17:07
boundary condition for high order Possion solver jen Main CFD Forum 0 November 16, 2005 20:04
boundary condition for high order possion solver *NM* jen Main CFD Forum 0 November 16, 2005 20:02


All times are GMT -4. The time now is 22:25.