|
[Sponsors] |
How force fixed value of variable in one cell |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 9, 2007, 21:11 |
Dear Hvorje!
It seems for m
|
#21 |
New Member
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17 |
Dear Hvorje!
It seems for me that your "soft-touch" value setting algorithm has problems with finite, non-zero gradients on boundaries. At least i got a problem with PISO pressure correction algorithm applied to incompressible NS equation (the same as icoFoam) but with volumetric forces. I started with an incompressible buoyancy force, so my "corrected" boundary condition for pressure is snGrad(p)=nf*(0,0,-alpha*g*(T-T0)) on the whole border of domain. Things went well until walls was heated in way which introduces non-zero pressure normal gradient on boundary. Perhaps, I can fix single point (p) value in a "hard" way, however than I can expect (as I got from your post above) the problem with pEqn.flux() algorithm. From the other hand the construction phi-=fvc::interpolate(rUA*fvc::grad(p))&Mesh.Sf() instead of phi-=pEqn.flux() at the end of PISO loop seems to do some work on well-posed structured mesh (results looks fine for "cubical" domain), however I am afraid this may be not so good on arbitrary unstructured grid. I don't know, it's just my guess about la Place operator which has different numeric discretization as interpolate(grad()), so that both constructions may not be the same. My questions are 1. Do really setReference() function fails in the cases with non-zero gradients (but still only gradients) on boundary? 2. If yes, how difficult is to correct mass flux (what I mean is to restore/repair a matrix after solve(), so that .flux() method work again) in a single cell where field value is set in a "hard" way? May you (or someone else) can post (or point to location) where I can get information about how exactly flux method works, so I can fix this myself? thanks a lot for any help! regards, /Normunds |
|
June 10, 2007, 05:46 |
Dear Hrvoje and all!
I am r
|
#22 |
New Member
Normunds Jekabsons
Join Date: Mar 2009
Location: Riga, Latvia
Posts: 10
Rep Power: 17 |
Dear Hrvoje and all!
I am really sorry about wrong spelling of your name as well about the content of my previous message - it seems I was wrong, the function setReference() do it's job well, it was not a cause of my problem. I just recognized (to be more precise it's still my guess) that by adding volume force to momentum conservation equation (as it is suggested somewhere on this board) fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) == volForce ); solve(UEqn == - fvc::grad(p)) one may end up with mathematically ill defined problem for p due to differences in numeric implementation of operators. In other words integral of normal p derivative (p flux) over all boundary surfaces of solution domain must be exactly consumed by the volumetric source term in the pressure equation or pressure field equation has no solution. The latest seems to be a case when volForce is added to momentum equation in way shown above. It looks like I have to do fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U) ); solve(UEqn == - fvc::grad(p)+volForce) and below in PISO loop U = rUA*UEqn.H(); phi = (fvc::interpolate(U) & mesh.Sf()) + (fvc::ddtPhiCorr(rUA, U, phi)); adjustPhi(phi, U, p); // I am not sure about this !!!! U += rUA*volForce; phi += (fvc::interpolate(rUA*volForce) & mesh.Sf()); or something like that so that non-zero p integral flux from boundary is exactly compensated by volForce yielded terms in div(phi). However, this is not anymore related to topic of this thread, my apologies to Ola. Once again my apologies to all! /Normunds |
|
July 16, 2007, 13:07 |
would you please post the file
|
#23 |
Senior Member
Maka Mohu
Join Date: Mar 2009
Posts: 305
Rep Power: 18 |
would you please post the file that should be modified (copied from the above URL) for the above bug to fixed. I use OF V1.3. Thanks.
Best regards, Maka. |
|
November 7, 2007, 13:51 |
Hi!
im new in OpenFoam and tr
|
#24 |
Guest
Posts: n/a
|
Hi!
im new in OpenFoam and trying to create a solver for a simple problem like: "div(-k grad (p)=f" with k=id (k might be heterogeneous later). First, how to discretize the source term f when its constant(f=1)? Second, I dont know how to simply impose Neumann boundary conditions. Can somebody help me please!!! Thx! stephane. |
|
December 25, 2007, 02:51 |
Hi all.
I want to fix the val
|
#25 |
New Member
Naoki Onishi
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 4
Rep Power: 17 |
Hi all.
I want to fix the value of several cells using setValues while equation being solved. So I think that I have to select cells with cellSet, and then use setValues with the equation matrix in solver. I read sets in solver file after cellSet as follows and it seems working fine. const cellSet selectedCells ( IOobject ( "selectedCells", "constant/polyMesh/sets", mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); But, setValues function requires not cellSet but labelList.... Thus, my quastions are 1. How can I make labelList from cellSet? (I think both are similar very much. Am I wrong?) 2. Does anybody think of better way? or Did anybody do the same thing? regards, Naoki |
|
December 25, 2007, 03:09 |
Hi all
I want to fix the valu
|
#26 |
New Member
Naoki Onishi
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 4
Rep Power: 17 |
Hi all
I want to fix the value of several cells using setValues while equation being solved. So I think that I have to select cells with cellSet, and then use setValues with the equation matrix in solver. I read sets in solver file after cellSet as follows and it seems working fine. const cellSet selectedCells ( IOobject ( "selectedCells", "constant/polyMesh/sets", mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ); But, setValues function requires not cellSet but labelList.... Thus, my quastions are 1. How can I make labelList from cellSet? (I think both are similar very much. Am I wrong?) 2. Does anybody think of better way? or Did anybody do the same thing? regards, Naoki |
|
December 27, 2007, 23:54 |
I 've solved the problem.
I'm
|
#27 |
New Member
Naoki Onishi
Join Date: Mar 2009
Location: Tokyo, Japan
Posts: 4
Rep Power: 17 |
I 've solved the problem.
I'm sorry for the silly question. Here is a part of the code to change cellSet to labelList and do setValue with labelList. --- cellSet newSet(mesh, setName); labelList refCells; refCells = newSet.toc(); scalarField refField(refCells.size()); ... ... someEqn().setValue(refCells,refField); --- Actually setValue function helps me greatly. regards, Naoki |
|
February 24, 2012, 07:12 |
|
#28 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear friends,
I am facing the problem you solved in this thread. I ask you a question: maybe you can help. I want to impose a fixed value of a temperature in a certain volume of my domain. How can I do this? Should I use the fvMatrix::setValues() method? Could you briefly explain and what I should practically do? Thanks a lot, Samuele |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How force solver to update variable with nearly diagonal matrix | olwi | OpenFOAM Running, Solving & CFD | 0 | February 29, 2008 04:52 |
NS with variable body force-Momentum conserved? | CFDtoy | Main CFD Forum | 0 | January 25, 2008 00:47 |
*VARIABLE CELL SIZE IN LES | p.cooper | Main CFD Forum | 1 | July 28, 2002 03:27 |
How to add a fixed force on momentum equation | sun | Phoenics | 3 | January 19, 2002 07:31 |
Defining a new cell variable | Ulrich | FLUENT | 1 | May 25, 2000 17:04 |