CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   error when calculating values at boundary using refCast (http://www.cfd-online.com/Forums/openfoam/66807-error-when-calculating-values-boundary-using-refcast.html)

prabhu July 24, 2009 07:05

error when calculating values at boundary using refCast
 
I am currently facing problems when calculating heat transfer values at boundary which is used for flux boundary condition.

I am fixing the heat transfer co-efficient in cells based on the value of temperature. When doing this the values are fixed in the cells but the values at the boundary are zero.
I made some changes as

label patchI = mesh.boundaryMesh().findPatchID("leftmovingwall");
zeroGradientFvPatchScalarField& bufferh = refCast<zeroGradientFvPatchScalarField>(hT.boundar yField()[patchI]);
forAll (bufferh, faceI)
{
if (T.boundaryField()[patchI][faceI] < Tmin_hT.value())
{
bufferh[faceI] = hT_Tmin.value();
}
else if (T.boundaryField()[patchI][faceI] >= Tmin_hT.value())
{
bufferh[faceI] = hT_Tmax.value();
}
}

The compilation of code did not produce any error but when i start the simulation i get the following error :

Attempt to cast type calculated to type zeroGradient#0 Foam::error::printStack(Foam::Ostream&) in "/apps/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::error::abort() in "/apps/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 main in "/home/prabhu/OpenFOAM/prabhu-1.5/applications/bin/linux64GccDPOpt/lasersolid"
#3 __libc_start_main in "/lib64/libc.so.6"
#4 Foam::regIOobject::readIfModified() in "/home/prabhu/OpenFOAM/prabhu-1.5/applications/bin/linux64GccDPOpt/lasersolid"
From function refCast<To>(From&)
in file /apps/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/typeInfo.H at line 106.
FOAM aborting
Abort

Could any1 tell me how can this problem be solved?

gballo April 3, 2011 21:23

Hi, I'm having a similar problem with chtMultiRegionFoam, where I get the following error:


--> FOAM FATAL ERROR:
Attempt to cast type calculated to type compressible::turbulentTemperatureCoupledBaffle

From function refCast<To>(From&)
in file /home/gballoch/OpenFOAM/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/typeInfo.H at line 114.

FOAM aborting


I know you posted here a long time ago but I was wondering if you resolved what the problem was? I think it is probably an inconsistency in BC's, but I've double checked all of them and they appear to be fine!

tH3f0rC3 April 12, 2011 09:22

I do have the same problem.

But I still have solved one case with exactly the same settings with one exeption.
In the first case, which solved with the same settings, there was only one solid and one fluid.

Now the problem appears with two solids and one fluid.
As I said I have used exactly the same settings for the T files.

Does someone know how to solve this problem?

Best Regards,
tH3f0rC3

tH3f0rC3 April 14, 2011 02:32

Hi,

I know now that the simulation works with the following setting:

Galvano
{
type compressible::turbulentTemperatureCoupledBaffleMix ed;
value $internalField;
neighbourFieldName T;
K K;
}
Geo2
{
type fixed value;
value uniform 573;
}


But I want to do it like this:
Galvano
{
type compressible::turbulentTemperatureCoupledBaffleMix ed;
value $internalField;
neighbourFieldName T;
K K;
}
Geo2
{
type compressible::turbulentTemperatureCoupledBaffleMix ed;
value $internalField;
neighbourFieldName T;
K K;
}

But than I recieve the following error message:
--> FOAM FATAL ERROR:
Attempt to cast type zeroGradient to type compressible::turbulentTemperatureCoupledBaffleMix ed
From function refCast<To>(From&)
in file /local/OpenFOAM/src/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/typeInfo.H at line 114.
FOAM aborting

Does someone know where the mistake is?

Best Regards,
tH3f0rC3

tH3f0rC3 April 15, 2011 08:46

I still have tried to set up the neighbourFieldName T; to another variable, but the solver needs the T here.
It's also the same with K K;.

I still think that I have to use different entries here, but I'm not sure.

Best Ragards,
tH3f0rC3

tH3f0rC3 April 18, 2011 03:49

I have now solved the problem.

By using

value uniform 573.15;
//value $internalField;
in
*
{
type compressible::turbulentTemperatureCoupledBaffleMix ed;
value uniform 573.15;
//value $internalField;
neighbourFieldName T;
K K;
}

the solver is running.
It's very strange.

The solver runs good with only one solid and one fluid with the value $internalField.
But with two solids the solver only runs with value uniform 573,15.

Best Regards,
tH3f0rC3

yossi June 29, 2012 03:48

Attempt to cast type zeroGradient to type compressible::turbulentTemperatureCoupledBa
 
Quote:

Originally Posted by tH3f0rC3 (Post 303547)

But than I recieve the following error message:
--> FOAM FATAL ERROR:
Attempt to cast type zeroGradient to type compressible::turbulentTemperatureCoupledBaffleMix ed
From function refCast<To>(From&)
in file /local/OpenFOAM/src/OpenFOAM-1.7.1/src/OpenFOAM/lnInclude/typeInfo.H at line 114.
FOAM aborting

Does someone know where the mistake is?

Best Regards,
tH3f0rC3

Hi,

I've had the same problem.
It seemed that the b.c at the fluid was fine,
but the b.c. at the solid was "zeroGradient"


All times are GMT -4. The time now is 07:57.