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

Interfoam temperatures cell neighbours

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 15, 2016, 09:27
Default Interfoam temperatures cell neighbours
  #1
New Member
 
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 10
chefkoch89 is on a distinguished road
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<double, Foam::fvPatchField, Foam::volMesh>}’ and ‘Foam::vector {aka Foam::Vector<double>}’)
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.
chefkoch89 is offline   Reply With Quote

Old   April 16, 2016, 21:10
Default
  #2
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24
santiagomarquezd will become famous soon enough
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
santiagomarquezd is offline   Reply With Quote

Old   April 18, 2016, 09:11
Default
  #3
New Member
 
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 10
chefkoch89 is on a distinguished road
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!
chefkoch89 is offline   Reply With Quote

Old   April 18, 2016, 22:23
Default
  #4
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24
santiagomarquezd will become famous soon enough
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
santiagomarquezd is offline   Reply With Quote

Old   April 19, 2016, 04:45
Default
  #5
New Member
 
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 10
chefkoch89 is on a distinguished road
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
File Type: png velocityComponents.png (74.1 KB, 6 views)
chefkoch89 is offline   Reply With Quote

Reply


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


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


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