# Interfoam temperatures cell neighbours

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 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: 3 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; } } } } }``` My first problem is to check the temperatures of the neighbours of cell i and that the operand types are different. When compiling, I always get the error: Code: `error: no match for ‘operator[]’ (operand types are ‘Foam::volScalarField {aka Foam::GeometricField}’ and ‘Foam::vector {aka Foam::Vector}’)` The second difficulty is close to the boundary condition. I tried to solve this via the line Code: `if(fluidNames[nachbar] == "fluid")` Do you got any proposals to solve these problems? Thank you very much!! Best regards Last edited by chefkoch89; March 17, 2016 at 08:32.

 April 16, 2016, 20:10 #2 Senior Member     Santiago Marquez Damian Join Date: Aug 2009 Location: Santa Fe, Santa Fe, Argentina Posts: 430 Rep Power: 16 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, 08:11 #3 New Member   Robert R. Join Date: Feb 2016 Location: Braunschweig, Germany Posts: 7 Rep Power: 3 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, 21:23 #4 Senior Member     Santiago Marquez Damian Join Date: Aug 2009 Location: Santa Fe, Santa Fe, Argentina Posts: 430 Rep Power: 16 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 21:25. Reason: Spelling

April 19, 2016, 03:45
#5
New Member

Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 3
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!
Attached Images
 velocityComponents.png (74.1 KB, 5 views)

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post JFM OpenFOAM Running, Solving & CFD 3 December 1, 2015 06:58 shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 14:38 MollyTom Main CFD Forum 4 May 6, 2013 14:04 manuutin STAR-CD 1 August 17, 2010 20:29 Purushothama CD-adapco 2 May 31, 2010 21:58

All times are GMT -4. The time now is 12:09.

 Contact Us - CFD Online - Top