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

Problem saving value on boundary face

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 4, 2011, 09:05
Default Problem saving value on boundary face
  #1
New Member
 
Robert Maier
Join Date: Apr 2011
Posts: 9
Rep Power: 14
robertmaier9 is on a distinguished road
Hello,

I am having a problem saving a calculated value on to the boundary faces of a variable I call "f1". The variable f1 is a surfaceScalarField. I have no problems saving to the internal faces, it is only the boundary faces that are giving me trouble. I have a test case that has one cell, with 6 faces which have 5 boundary patches as 2 faces are defined together (for 2D case). Below is a little excert from the code. Further explaination comes below.

Code:
forAll(mesh.faces(), facei)
{
     xFaceNormal= mesh.Sf()[facei].component(0);
    label patchID = mesh.boundaryMesh().whichPatch(facei);
    Info << "f1 boundary is " << f1.boundaryField().size() << "spaces long" << endl;
    if(patchID > -1)
    {
        Info << "patchID = " << patchID << endl;
        Info << "facei = " << facei << endl;
        Info << "mesh.Sf()[facei] = " << mesh.Sf()[facei] << endl;

        double gAlphaX = gradAlphaX[facei];
        double gAlphaY = gradAlphaY[facei];
        betaCellDegNormal = Foam::atan(gAlphaX/(gAlphaY+0.000001))*2/3.14159;

        if((mesh.Sf()[facei].component(2) == 0))
        {
              if( xFaceNormal == 0 )
              {
                    alphacalc = alphaF.boundaryField()[patchID][facei];
                    alpha1percent = alphaF.boundaryField()[patchID][facei]*100;
                    #include "f1Eqn.H"
                    f1.boundaryField()[patchID][facei] = f1temp;
                    Info << "f1 = " << f1temp << endl;
                      Info << "It's a Y cell" << endl;
                }
            }
        }
    }
When running the code on the 1 cell test case, I get the following error:
Code:
#0  Foam::error::printStack(Foam::Ostream&) in "/usr/local/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#1  Foam::sigSegv::sigSegvHandler(int) in "/usr/local/OpenFOAM/OpenFOAM-1.6.x/lib/linux64GccDPOpt/libOpenFOAM.so"
#2  ?? in "/lib64/libc.so.6"
#3  main in "/home/rm/OpenFOAM/rm-1.6.x/applications/bin/linux64GccDPOpt/interFoamHeatTransferBlending"
#4  __libc_start_main in "/lib64/libc.so.6"
#5  __gxx_personality_v0 in "/home/rm/OpenFOAM/rm-1.6.x/applications/bin/linux64GccDPOpt/interFoamHeatTransferBlending"
Speicherzugriffsfehler
It seems like the calculated value for f1 is being stored outside of the defined array, and some evidence supports this.

When I save the value of "f1temp" to the face of concern for f1, it is done with the following syntax:
Code:
f1.boundaryField()[patchID][facei] = f1temp;
If I call the value by the following code it gives me the correct value:
Code:
Info << f1.boundaryField()[patchID][facei] << endl;
If I call up all values of f1 like:
Code:
Info << f1 << endl;
the value is not saved where I would have expected it, and the values for f1, are still as defined in the initial condition, so no change to f1! Might any one have any ideas as to what I am doing wrong?

I can comment out saving the boundary value of f1 (f1.boundaryField()[patchID][facei]), and everything works fine.
robertmaier9 is offline   Reply With Quote

Old   October 4, 2011, 09:58
Default Problem Solved
  #2
New Member
 
Robert Maier
Join Date: Apr 2011
Posts: 9
Rep Power: 14
robertmaier9 is on a distinguished road
I found someone at the institute to help me out here. The code that works I have paraphrased below for the purpose of documentation.

I looped first through patches, and then the faces of the given patch. Somehow this works rather than looping through the faces, and calling up patchID. Might anyone have a reason for why this works?

Code:
forAll(mesh.boundaryMesh(), patchi)
{
    forAll(mesh.boundaryMesh()[patchi], facei)
    {
Thanks.
robertmaier9 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem about periodic boundary condition in Fluent winnawinna FLUENT 0 December 29, 2010 00:32
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 23:50
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00
How to get specie mass fraction at a boundary face shuqin FLUENT 0 February 24, 2006 02:52
New topic on same subject - Flow around race car Tudor Miron CFX 15 April 2, 2004 07:18


All times are GMT -4. The time now is 02:30.