|
[Sponsors] |
October 4, 2011, 08:05 |
Problem saving value on boundary face
|
#1 |
New Member
Robert Maier
Join Date: Apr 2011
Posts: 9
Rep Power: 15 |
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; } } } } 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 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; Code:
Info << f1.boundaryField()[patchID][facei] << endl; Code:
Info << f1 << endl; I can comment out saving the boundary value of f1 (f1.boundaryField()[patchID][facei]), and everything works fine. |
|
October 4, 2011, 08:58 |
Problem Solved
|
#2 |
New Member
Robert Maier
Join Date: Apr 2011
Posts: 9
Rep Power: 15 |
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) { |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem about periodic boundary condition in Fluent | winnawinna | FLUENT | 0 | December 28, 2010 23:32 |
gmsh2ToFoam | sarajags_89 | OpenFOAM | 0 | November 24, 2009 22:50 |
[blockMesh] Axisymmetrical mesh | Rasmus Gjesing (Gjesing) | OpenFOAM Meshing & Mesh Conversion | 10 | April 2, 2007 14:00 |
How to get specie mass fraction at a boundary face | shuqin | FLUENT | 0 | February 24, 2006 01:52 |
New topic on same subject - Flow around race car | Tudor Miron | CFX | 15 | April 2, 2004 06:18 |