|
[Sponsors] |
January 30, 2015, 06:36 |
modyfing BC externalWallHeatFluxTemperature
|
#1 |
Member
Roman
Join Date: Sep 2013
Posts: 81
Rep Power: 12 |
Hello! I am trying to change the boundary condition "externalWallHeatFluxTemperature" in order to make the heat transfer coefficient dependent on U and rho (for the solver fireFoam).
The expression where the heat transfer coefficient h_ is used is hp = 1.0/(1.0/h_ + totalSolidRes); The type of the other operands is scalar. At the new BC the heat transfer coefficient h_ must be a function of the U and rho (and other values if needed). To write this function U must be scalar too. One can get U by the next: const volVectorField& U = db().lookupObject<volVectorField>("U"); scalarField z = mag(U); But I can not convert the type scalarField to the type scalar. Please help to solve this problem or show other ways of making the heat transfer coefficient dependent on U and rho. There is the BC "convectiveHeatTransfer" but it is only for RAS and I can not find its place in the solver fireFoam. Thanks |
|
January 31, 2015, 11:40 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
A scalar field stores values for each cell. I do not really understand what you want to do, but you probably have to calculate your heat transfer coefficient also for each cell (or probably each wall face).
Have a look e.g. at https://github.com/OpenFOAM/OpenFOAM...arField.C#L155 how a boundary condition can be calculated based on other fields. |
|
February 2, 2015, 05:25 |
|
#3 |
Member
Roman
Join Date: Sep 2013
Posts: 81
Rep Power: 12 |
Hello jherb. Thanks for your answer. As far as I understood
the selected expression serves to derive a new boundary condition. I tried to write an analog for my case with U: const volVectorField& U = db().lookupObject<volVectorField>("U"); But the method value() is absent there. I tried max(mag(U)).value(). The type of this expression can be used to derive a new boundary condition for my case (it seemes to me). The corrected module is compiled, built and run OK. But I am not sure about the value of the expression max(mag(U)).value(). Is it calculated for the each cell or for the maximum value of the mag(U) at the whole domain? Thanks. |
|
February 2, 2015, 17:18 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21 |
I found this definition of max:
https://github.com/OpenFOAM/OpenFOAM...nctions.C#L505 It looks like this is calculating the max value for the whole field (actually automatically reducing the values of all cells on all processors). But what are you trying anyway? |
|
February 3, 2015, 15:40 |
|
#5 |
Member
Roman
Join Date: Sep 2013
Posts: 81
Rep Power: 12 |
Hello. The code that finally gave the desired result is
const volVectorField& U = db().lookupObject<volVectorField>("U"); volScalarField& magU(mag(U)); scalar z = 0; forAll(magU, faceI) 129 { 130 label faceCellI = patch().faceCells()[faceI]; 131 132 z = magU[faceI]*.....{code}; 133 //I think magU[faceI] is for the particular cell, not for the whole field 142 } Further are operations with scalar z. It is derived from the code at the file convectiveHeatTransferFvPatchScalarField.C (str.113-142) but without turbulence. Now I am testing new BC. Thanks. |
|
|
|