|
[Sponsors] |
June 9, 2005, 14:06 |
That's because you're in the c
|
#1 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
That's because you're in the code you are setting the patch value of the fixedGradientFvPatchScalar field:
fixedGradientFvPatchScalarField& buffer= refCast<fixedgradientfvpatchscalarfield>(T.boundar yField()[patchI]); forAll (buffer, faceI) { buffer[faceI] = 0.1*(293.-T.boundaryField()[patchI][faceI]); } and you should be setting the gradient() instead. Have a look at fixedGradientFvPatchField.H. So: fixedGradientFvPatchScalarField& buffer= refCast<fixedgradientfvpatchscalarfield>(T.boundar yField()[patchI]); scalarField& grad = buffer.gradient(); forAll (grad, faceI) { grad[faceI] = 0.1*(293.-T.boundaryField()[patchI][faceI]); } (if that is what you want). Enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
August 2, 2005, 06:00 |
with the above, I get a compi
|
#2 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 |
with the above, I get a compilation error: "missing template arguments before '&' token".
I realize its a template, but what type should I pass ? Thanks for any hint, I am new to this ... Thomas |
|
August 2, 2005, 06:18 |
refCast
|
#3 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
refCast<fixedgradientfvpatchscalarfield>
is the stuff in angle brackets really all lowercase (wrong) or is the user group software playing tricks with me? Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
August 2, 2005, 08:29 |
fixedGradientFvPatchScalarFiel
|
#4 |
Senior Member
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17 |
fixedGradientFvPatchScalarField<scalar>& buffer=
refCast<fixedgradientfvpatchscalarfield<scalar> >(T.boundaryField()[patchI]); scalarField& grad = buffer.gradient(); the stuff is not lowercase, but somehow converted to lowercase on posting, I just realized. |
|
August 2, 2005, 15:21 |
Get rid of the
|
#5 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
Get rid of the <scalar> bit - fixedGradientFvPatchScalarField is already typedef'd to be of scalar (as the name says). Also, compare:
Yours: fixedGradientFvPatchScalarField<scalar>& buffer= Mine: fixedGradientFvPatchScalarField& buffer= which rather gives it away. It's a bit hard like this - in the future, can we have the piece of code and the actual error message, with the line number etc. Enjoy, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
May 18, 2009, 10:59 |
|
#6 |
New Member
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 17 |
Hi all
I am trying to cast Code:
fvPatchScalarField& pp = p.boundaryField()[patchi]; fixedGradientFvPatchScalarField& ppatch = refCast<fixedGradientFvPatchScalarField>(pp); Code:
ppatch.gradient()[i] = ... Code:
‘fixedGradientFvPatchScalarField’ was not declared in this scope |
|
July 27, 2009, 04:32 |
|
#7 |
New Member
Praveen
Join Date: Mar 2009
Location: Goteborg, Sweden
Posts: 8
Rep Power: 17 |
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:rintStack(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? |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
what specified flux mean in boundary condition? | lucy | FLUENT | 0 | January 5, 2009 05:13 |
ask a question about Fixed Flux Boundary Condition | mahe | Phoenics | 1 | July 15, 2008 05:21 |
Boundary condition for species flux | Leverkin | FLUENT | 0 | June 9, 2008 03:19 |
constant heat flux boundary condition | Andrew Hayes | Main CFD Forum | 4 | February 19, 2006 14:54 |
scalar flux boundary condition | Murali | Siemens | 4 | May 23, 2003 12:50 |