|
[Sponsors] |
January 18, 2011, 17:19 |
implement heat flux
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
hey together,
i am using OF 1.7.x and working with OF for a half year now. Using the chtMultiRegionSimpleFoam to solve the heat transfer from fluid to solid and solid to solid. The solutions are very good and now i want to implement the heat flux in the cht..Foam so that i can visual it like U / rho / etc in paraview. First of all i want to implement the heat flux in my solid regions. Code:
Q = lambda / delta * A * dT = K * A * dT and q = Q/A q = K * dT (is this correct?) q = - K * grad(T) createSolidFields.H
setRegionSolidFields.H Code:
volScalarField& flux = fluxs[i]; solveSolid.H Code:
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix tEqn ( -fvm::laplacian(K, T) ); tEqn.relax(); eqnResidual = tEqn.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual); // solving heatflux fvScalarMatrix fluxEqn ( -K*fvc::grad(T) ); fluxEqn.relax(); eqnResidual = fluxEqn.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual); } Don 't know how to implement q = K * grad(T) and if this code is correct ... ??? tried some other codes but always got an error... Code:
fvScalarMatrix fluxEqn ( -K*fvc::grad(T) ); fluxEqn.relax(); eqnResidual = fluxEqn.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual); Its the first time i want to add a equation and i am not sure how i have to implement this? I think i got all wrong or? Can someone help me - thanks ? Tobi |
|
January 19, 2011, 07:19 |
use groovyBC for setting wall heat fluxes
|
#2 |
Senior Member
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 124
Rep Power: 19 |
Hi Tobi
I can not immediately see what goes wrong in your code, but I would use groovyBC for setting heat fluxes. No need to rewrite you code, and it is very flexible (parallel run no problem, non-uniform and time dependent heat fluxes possible, only editing in bounary conditions of variables required, etc.). Have a look at my post http://www.cfd-online.com/Forums/ope...r-restart.html Regards Eelco |
|
January 19, 2011, 07:31 |
|
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi Eelco,
thanks for you answer. I ll have a look at your post. But you said that this is a BC. ? ? I don 't want to start with a heatflux BC. Simple expamle. I have two walls parallel and know the temperature t_hot and t_cold. Further i know K and A and now i want to calculate the heat flux in both walls. Is this possible with groovyBC ? And i know that the compilations error occurs with the following line: -K*fvc::grad(T) Hmmm... But i will have a look at groovyBC. Thx. Tobi |
|
January 19, 2011, 07:46 |
|
#4 |
Member
Fábio César Canesin
Join Date: Mar 2010
Location: Florianópolis
Posts: 67
Rep Power: 16 |
You have to change the dictionary setting...
"MUST_READ" .. you SHOULDN'T read the that dict.. you need only to write in it. Them, in the equation what you really have is: -K*grad(T) = 0 ... what you want is: flux = -K*grat(T). That should do. |
|
January 19, 2011, 08:24 |
surfaceScalarField
|
#5 |
Senior Member
Eelco van Vliet
Join Date: Mar 2009
Location: The Netherlands
Posts: 124
Rep Power: 19 |
Hi Toby
Sorry, I assumed you want to impose a heat flux at a wall. No, I don't think you can use groovyBC for internal faces. Perhaps something is going wrong because you are mixing up a surfaceScalarField (i.e. scalar values defined at the cell faces) and volumeScalarField (i.e. scalar values defined at the cell centres). Have a look at the wallHeatFlux utility for instance. Here you can see the difference between the both. More details can be found in the programmers Guide. Good luck! Regards, Eelco |
|
January 19, 2011, 08:54 |
|
#6 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
@eelcovv don 't matter but i 'll have a look at your advice. @Canesin: thats true - i just have to write in it so i changed the syntax to: NO_READ I suppose that the flux - file is added automatically. Further i changed the solveSolid.H: Code:
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix tEqn ( -fvm::laplacian(K, T) ); tEqn.relax(); eqnResidual = tEqn.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual); fvScalarMatrix fluxEqn ( flux = -K*fvc::grad(T) ); fluxEqn.relax(); eqnResidual = fluxEqn.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual); } Code:
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { fvScalarMatrix tEqn ( -fvm::laplacian(K, T) ); tEqn.relax(); eqnResidual = tEqn.solve().initialResidual(); maxResidual = max(eqnResidual, maxResidual); } flux = -K*fvc::grad(T) Code:
tobi@shorty:~/OpenFOAM/OpenFOAM-1.7.x/applications/solvers/heatTransfer/chtMultiRegionSimpleFoam$ wmake Making dependency list for source file chtMultiRegionSimpleFoam.C SOURCE=chtMultiRegionSimpleFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -Ifluid -Isolid -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/thermophysicalModels/basic/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/turbulenceModels -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/turbulenceModels/compressible/RAS/lnInclude -IlnInclude -I. -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/chtMultiRegionSimpleFoam.o In file included from chtMultiRegionSimpleFoam.C:79: solid/solveSolid.H: In function ‘int main(int, char**)’: solid/solveSolid.H:15: error: no match for ‘operator=’ in ‘fluxEqn = Foam::operator*(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> >*)(& Foam::fvc::grad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]()))))’ /home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude/fvMatrix.C:867: note: candidates are: void Foam::fvMatrix<Type>::operator=(const Foam::fvMatrix<Type>&) [with Type = double] /home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude/fvMatrix.C:902: note: void Foam::fvMatrix<Type>::operator=(const Foam::tmp<Foam::fvMatrix<Type> >&) [with Type = double] solid/setRegionSolidFields.H:1: warning: unused variable ‘mesh’ solid/setRegionSolidFields.H:3: warning: unused variable ‘flux’ solid/setRegionSolidFields.H:4: warning: unused variable ‘rho’ solid/setRegionSolidFields.H:5: warning: unused variable ‘cp’ make: *** [Make/linux64GccDPOpt/chtMultiRegionSimpleFoam.o] Fehler 1 Code:
aking dependency list for source file chtMultiRegionSimpleFoam.C SOURCE=chtMultiRegionSimpleFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -Ifluid -Isolid -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/finiteVolume/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/meshTools/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/thermophysicalModels/basic/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/turbulenceModels -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/turbulenceModels/compressible/turbulenceModel/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/turbulenceModels/compressible/RAS/lnInclude -IlnInclude -I. -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude -I/home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/chtMultiRegionSimpleFoam.o In file included from chtMultiRegionSimpleFoam.C:79: solid/solveSolid.H: In function ‘int main(int, char**)’: solid/solveSolid.H:14: error: no match for ‘operator=’ in ‘flux = Foam::operator*(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh> >*)(& Foam::fvc::grad(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = double]()))))’ /home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricField.C:1086: note: candidates are: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricField.C:1111: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/tobi/OpenFOAM/OpenFOAM-1.7.x/src/OpenFOAM/lnInclude/GeometricField.C:1147: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::dimensioned<Type>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] solid/setRegionSolidFields.H:1: warning: unused variable ‘mesh’ solid/setRegionSolidFields.H:4: warning: unused variable ‘rho’ solid/setRegionSolidFields.H:5: warning: unused variable ‘cp’ make: *** [Make/linux64GccDPOpt/chtMultiRegionSimpleFoam.o] Fehler 1 Something i did wrong. Can not interpret that error message completly Tobi |
|
January 19, 2011, 09:55 |
|
#7 |
Senior Member
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20 |
it´s just
flux=fvc:-K*grad(T); flux.write; no solve, no residual. did you forgot about some ";"? Is it possible to make flux a volScalarField and then do smth. ON a patch; sounds mored like surfaceScalarField??!! |
|
January 19, 2011, 10:54 |
|
#8 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
okay first of all i could compile my code but why can i compile that one: Code:
-K*fvc::snGrad(T) = flux; Code:
flux = -K*fvc::snGrad(T); But i can 't use my solver anymore if i compile it with the code first... sorry but i am not an expert of OpenFoam |
|
January 21, 2011, 20:11 |
|
#9 |
Senior Member
|
snGrad(T) is the grad(T) projected into surface normal
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sign of Heat Flux at wall | Kyung | FLUENT | 2 | February 26, 2016 16:25 |
Variable name for heat flux | peterle | CFX | 4 | February 13, 2014 02:21 |
Heat Flux Wall Boundary Confusion. | Joee | FLUENT | 1 | August 21, 2010 12:20 |
Heat flux in ansys cfx | juliom | OpenFOAM Running, Solving & CFD | 2 | April 14, 2009 14:30 |
Heat Transfer Coeff. at Heat Flux Boundary | Rushyen | CFX | 6 | January 18, 2001 05:09 |