|
[Sponsors] |
March 15, 2016, 09:27 |
Interfoam temperatures cell neighbours
|
#1 |
New Member
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 10 |
Dear community,
I'm working on the multiphase solver interFoam. I need to check, if the temperatures in the cells within a radius of 5 times the cell radius are in a special value range. After that I want to add their volumes either to the volScalarField named Vcons or to Vfeed. Finally I need to calculate the ratio of these values. Right now my code is: Code:
forAll(mesh.cells(), i){ float abstand; vector cellCenter = mesh.C()[i]; labelList neighbours = mesh.cellCells()[i]; forAll(neighbours, k){ vector direction = mesh.C()[neighbours[k]] - cellCenter; abstand = mag(direction); } for(int x=0; x < 5; x++){ for(int y=0; y < 5; y++){ for(int z=0; z < 5; z++){ vector nachbar; nachbar[0] = cellCenter[0] + abstand*x; nachbar[1] = cellCenter[1] + abstand*y; nachbar[2] = cellCenter[2] + abstand*z; if(fluidNames[nachbar] == "fluid"){ if( (Tcrit.value() <= T[nachbar]) && (T[nachbar] <= Trange.value()) ){ Vcons += mesh.V().field()[nachbar]); } else if( T[nachbar] > Trange.value() ){ Vfeed += mesh.V().field()[nachbar]; } if(Vfeed[nachbar] > 0) fgeo = Vcons / Vfeed; } } } } } Code:
error: no match for ‘operator[]’ (operand types are ‘Foam::volScalarField {aka Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ and ‘Foam::vector {aka Foam::Vector<double>}’) Code:
if(fluidNames[nachbar] == "fluid") Thank you very much!! Best regards Last edited by chefkoch89; March 17, 2016 at 08:32. |
|
April 16, 2016, 21:10 |
|
#2 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Hi, cellCells() will give you only the first level neighbors of your cell so are probably not checking all the cells in the sphere you want. Please add in what lines are you having errors.
Regards!
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
April 18, 2016, 09:11 |
|
#3 |
New Member
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 10 |
Ok, thank you for your response. I am now facing another problem with the neighbors of one cell: I need to get the velocities of the neighbors in each direction and store them in different new values.
Do you got an idea how to do that? Thank you and best regards! |
|
April 18, 2016, 22:23 |
|
#4 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Hi, if you have the neighbor cell numbers, you can do:
U.component(vector::X)[i] Regards
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar Last edited by santiagomarquezd; April 18, 2016 at 22:25. Reason: Spelling |
|
April 19, 2016, 04:45 |
|
#5 |
New Member
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 10 |
Hi, that is a good hint. Thank you!
Right now, I am struggling with the right definition of the values. The picture is explaining what I want to do. Maybe you can help me out. Thanks a lot! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
k-e & GAMG interFoam Schemitisation Stability Issue | JFM | OpenFOAM Running, Solving & CFD | 3 | December 1, 2015 06:58 |
FvMatrix coefficients | shrina | OpenFOAM Running, Solving & CFD | 10 | October 3, 2013 15:38 |
Upwind scheme (in a cell with zero velocity) | MollyTom | Main CFD Forum | 4 | May 6, 2013 15:04 |
cell neighbours | manuutin | STAR-CD | 1 | August 17, 2010 21:29 |
Cells with t below lower limit | Purushothama | Siemens | 2 | May 31, 2010 22:58 |