OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

getPatchFieldScalar.H

Go to the documentation of this file.
00001 label patchi = which_part - 2;
00002 
00003 if (nVar >= Num_variables - nSprayVariables)
00004 {
00005     return Z_UNDEF;
00006 }
00007 
00008 IOobject fieldObjectPtr
00009 (
00010     fieldNames[var2field[nVar]],
00011     runTime.timeName(),
00012     mesh,
00013     IOobject::NO_READ
00014 );
00015 
00016 if (!fieldObjectPtr.headerOk())
00017 {
00018     return Z_UNDEF;
00019 }
00020 
00021 IOobject fieldObject
00022 (
00023     fieldNames[var2field[nVar]],
00024     runTime.timeName(),
00025     mesh,
00026     IOobject::MUST_READ,
00027     IOobject::NO_WRITE
00028 );
00029 
00030 volScalarField sf
00031 (
00032     fieldObject,
00033     mesh
00034 );
00035 
00036 const scalarField& sfb = sf.boundaryField()[patchi];
00037 const polyBoundaryMesh& bMesh = meshPtr->boundaryMesh();
00038 
00039 if (which_type == Z_TRI03)
00040 {
00041     label counter = 1;
00042     for (label facei=0; facei<sfb.size(); facei++)
00043     {
00044         label nPoints = bMesh[patchi][facei].size();
00045         if (nPoints == 3)
00046         {
00047             var_array[counter++] = sfb[facei];
00048         }
00049     }
00050 }
00051 
00052 if (which_type == Z_QUA04)
00053 {
00054     label counter = 1;
00055     for (label facei=0; facei<sfb.size(); facei++)
00056     {
00057         label nPoints = bMesh[patchi][facei].size();
00058         if (nPoints == 4)
00059         {
00060             var_array[counter++] = sfb[facei];
00061         }
00062     }
00063 }
00064 
00065 if (which_type == Z_NSIDED)
00066 {
00067     label counter = 1;
00068     for (label facei=0; facei<sfb.size(); facei++)
00069     {
00070         label nPoints = bMesh[patchi][facei].size();
00071         if ((nPoints != 3) && (nPoints != 4))
00072         {
00073             var_array[counter++] = sfb[facei];
00074         }
00075     }
00076 }
Copyright © 2000-2009 OpenCFD Ltd