CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   given field does not correspond to patch !! (http://www.cfd-online.com/Forums/openfoam-programming-development/117882-given-field-does-not-correspond-patch.html)

SamerAli May 16, 2013 14:55

given field does not correspond to patch !!
 
Dear All

I am trying to set heat flux at the interface of each coupled fluid-solid region:

{
Info << "Setting Heat Flux on solid patch" << endl;



forAll (fluidpatchesNames,s)
{
word fluidPatchName=fluidpatchesNames[s];
word solidPatchName=solidpatchesNames[s];
word fluidZoneName=fluidzonesNames[s];
word solidZoneName=solidzonesNames[s];
Info<<"fluidZoneName "<<fluidZoneName<<endl;
Info<<"solidZoneName "<<solidZoneName<<endl;


label solidPatchID
(
stressMesh.boundaryMesh().findPatchID(solidPatchNa me)
);

Info<<solidPatchID<<endl;

HeatFluxFvPatchScalarField& Heat=
refCast<HeatFluxFvPatchScalarField>
(
Ts.boundaryField()[solidPatchID]
);

if (solidPatchID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding solid patch"
<< abort(FatalError);
}

label solidZoneID =
stressMesh.faceZones().findZoneID(solidZoneName);

Info<<solidZoneID<<endl;

if (solidZoneID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding solid zone"
<< abort(FatalError);
}

label fluidPatchID =
mesh.boundaryMesh().findPatchID(fluidPatchName);

Info<<fluidPatchID<<endl;

if (fluidPatchID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding fluid patch"
<< abort(FatalError);
}

label fluidZoneID =
mesh.faceZones().findZoneID(fluidZoneName);

Info<<fluidZoneID<<endl;

if (fluidZoneID < 0)
{
FatalErrorIn(args.executable())
<< "Problem with finding fluid zone"
<< abort(FatalError);
}


scalarField fluidPatchHeatFlux=
kF.value()*Tf.boundaryField()[fluidPatchID].snGrad();


scalarField fluidZoneHeatFlux
(
mesh.faceZones()[fluidZoneID].size(),
0.0
);

label fluidPatchStart =
mesh.boundaryMesh()[fluidPatchID].start();

Info<<fluidPatchStart<<endl;

forAll(fluidPatchHeatFlux, i)
{
fluidZoneHeatFlux
[
mesh.faceZones()[fluidZoneID].whichFace(fluidPatchStart + i)
] =
fluidPatchHeatFlux[i];
}

Info<<"TEST"<<endl;

// Parallel data exchange: collect heat flux field on all processors
reduce(fluidZoneHeatFlux, sumOp<scalarField>());

Info<<"TEST2"<<endl;
scalarField solidZoneHeatFlux =
interpolatorFluidSolid.faceInterpolate
(
fluidZoneHeatFlux
);

Info<<"Flag"<<endl;

label solidPatchStart =
stressMesh.boundaryMesh()[solidPatchID].start();

Info<<solidPatchStart<<endl;

forAll(solidPatchHeatFlux, i)
{
solidPatchHeatFlux[i] =
solidZoneHeatFlux
[
stressMesh.faceZones()[solidZoneID]
.whichFace(solidPatchStart + i)
];
}


Heat.HeatFlux()=solidPatchHeatFlux;

scalar totalHeatFlux =
gSum
(
solidPatchHeatFlux
*stressMesh.magSf().boundaryField()[solidPatchID]
);

Info << "Total HeatFlux on "<<solidPatchName<<" "
<< totalHeatFlux << endl;


}

}

but when i run my simulation all i get is the following error:
--> FOAM FATAL ERROR:
given field does not correspond to patch. Patch size: 225 field size: 150

From function PatchToPatchInterpolation::faceInterpolate(const Field<Type> ff)

can anyone help?

Thank you in advance

styleworker November 27, 2013 10:01

Have you solved the problem?


All times are GMT -4. The time now is 17:44.