CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Temperaturedependent flux boundary condition

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 9, 2005, 14:06
Default 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
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   August 2, 2005, 06:00
Default with the above, I get a compi
  #2
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17
tehache is on a distinguished road
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
tehache is offline   Reply With Quote

Old   August 2, 2005, 06:18
Default refCast
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   August 2, 2005, 08:29
Default fixedGradientFvPatchScalarFiel
  #4
Senior Member
 
Thomas Jung
Join Date: Mar 2009
Posts: 102
Rep Power: 17
tehache is on a distinguished road
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.
tehache is offline   Reply With Quote

Old   August 2, 2005, 15:21
Default Get rid of the bit -
  #5
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   May 18, 2009, 10:59
Default
  #6
New Member
 
Dragan Vidovic
Join Date: Mar 2009
Posts: 17
Rep Power: 17
vitke is on a distinguished road
Hi all

I am trying to cast
Code:
fvPatchScalarField& pp = p.boundaryField()[patchi];
fixedGradientFvPatchScalarField& ppatch = refCast<fixedGradientFvPatchScalarField>(pp);
because I want to set
Code:
ppatch.gradient()[i] = ...
but I'm getting this error:
Code:
‘fixedGradientFvPatchScalarField’ was not declared in this scope
Is this solution outdated?
vitke is offline   Reply With Quote

Old   July 27, 2009, 04:32
Default
  #7
New Member
 
Praveen
Join Date: Mar 2009
Location: Goteborg, Sweden
Posts: 8
Rep Power: 17
prabhu is on a distinguished road
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?
prabhu is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 03:53.