|
[Sponsors] |
Updating a boundary condition from the solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 30, 2008, 04:56 |
I'd like to bother you all wit
|
#1 |
Member
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17 |
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? |
|
June 3, 2008, 06:28 |
Try
variable.boundaryField(
|
#2 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
Try
variable.boundaryField()[patchI] == newValue; The important bit is the double "==". |
|
June 3, 2008, 07:00 |
Thank you!! Works perfectly!
|
#3 |
Member
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17 |
Thank you!! Works perfectly!
I had given up on doing it in the solver was writing a boundary condition to do it. |
|
June 3, 2008, 07:35 |
Well doing it as a boundary co
|
#4 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
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! |
|
September 19, 2008, 04:19 |
Hi
"I've tried to update it
|
#5 |
Senior Member
Tian
Join Date: Mar 2009
Location: Berlin, germany
Posts: 122
Rep Power: 17 |
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, The Green Building Simulation Tool for OpenFOAM, Energy Plus and Radiance. |
|
November 19, 2008, 08:29 |
Hi Juho and Eugene
I want t
|
#6 |
New Member
Niranjan Ghaisas
Join Date: Mar 2009
Location: Pune, Maharashtra, India
Posts: 10
Rep Power: 17 |
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 |
|
November 20, 2008, 06:05 |
Hi Adam
Am I glad that you
|
#7 |
New Member
Niranjan Ghaisas
Join Date: Mar 2009
Location: Pune, Maharashtra, India
Posts: 10
Rep Power: 17 |
Hi Adam
Am I glad that you jumped in! Thanks for these detailed instructions. Will try them out. Thanks a lot. Niranjan |
|
March 18, 2011, 10:42 |
|
#8 |
Senior Member
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17 |
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 |
|
June 14, 2021, 13:55 |
|
#9 |
New Member
pardoa
Join Date: May 2018
Posts: 29
Rep Power: 8 |
Hello everyone,
This is an old post but maybe any of you can help me to solve the issue that I am currently facing. I wish to turn into zero the values calculated by interFoam at the boundaries if alpha1 (water fraction) is lower than 0.1. I have managed to achieve this at the cells, but somehow I cannot make it at the boundaries. Since OpenFOAM treats the internalFields and boundaryFields separately, I need also to convert the values of the cells and boundary faces whose alpha1 value is smaller than 0.1 into 0. Everything works for the internalFields: Code:
forAll(alpha1,i) { if (alpha1[i] < 0.1) { dSur[i] = 0.0; piezoSur[i] = 0.0; hSur[i] = 0.0; } else { dSur[i] = p[i]/(rho[i]*mag(gSur[i])); piezoSur[i] = dSur[i] + (meshSurface.C()[i].component(vector::Z)+zRef[i]); hSur[i] = ((0.5*magSqr(U[i]))/mag(gSur[i])) + dSur[i] + (meshSurface.C()[i].component(vector::Z)+zRef[i]); } } Code:
forAll (meshSurface.boundaryMesh(),patchID) { forAll (meshSurface.boundaryMesh()[patchID],i) { dSur.boundaryField()[patchID][i] = p.boundaryField()[patchID][i]/(rho.boundaryField()[patchID][i]*mag(gSur[patchID][i])); } } PHP Code:
Any help will be greatly welcomed! Thanks! |
|
|
|
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 16:04 |
Boundary condition of the third kind or Danckwertz boundary condition | plage | OpenFOAM Running, Solving & CFD | 4 | October 3, 2006 13:21 |
How to setup boundary condition with couple solver | JINHUI | FLUENT | 0 | September 8, 2006 18: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 |