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

Interfoam temperatures cell neighbours

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools 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: 2
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, 20:10
Default
  #2
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 430
Rep Power: 16
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, 08:11
Default
  #3
New Member
 
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 2
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, 21:23
Default
  #4
Senior Member
 
santiagomarquezd's Avatar
 
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 430
Rep Power: 16
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 21:25. Reason: Spelling
santiagomarquezd is offline   Reply With Quote

Old   April 19, 2016, 03:45
Default
  #5
New Member
 
Robert R.
Join Date: Feb 2016
Location: Braunschweig, Germany
Posts: 7
Rep Power: 2
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, 4 views)
chefkoch89 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
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 14:38
Upwind scheme (in a cell with zero velocity) MollyTom Main CFD Forum 4 May 6, 2013 14:04
cell neighbours manuutin STAR-CD 1 August 17, 2010 20:29
Cells with t below lower limit Purushothama CD-adapco 2 May 31, 2010 21:58


All times are GMT -4. The time now is 23:32.