|
[Sponsors] |
July 15, 2024, 12:42 |
Defining a heat flux profile to wall
|
#1 |
Member
cal
Join Date: Feb 2020
Location: nowhere
Posts: 65
Rep Power: 6 |
Hi,
I am trying to define a heat flux polynomial equation as a function of height on the wall. So far, I haven't been successful with the attempts I've made. First, I used the codedMixed boundary condition, and my 0/T file is as follows: Code:
heatFluxWall { type codedMixed; value uniform 865; // Initial value refValue uniform 0; // Reference value (not used in this case) refGradient uniform 0; // Reference gradient valueFraction uniform 0; // Fraction of the value that is fixed name sscHeatFlux; code #{ const fvPatch& boundaryPatch = patch(); const fvBoundaryMesh& boundaryMesh = boundaryPatch.boundaryMesh(); const fvMesh& mesh = boundaryMesh.mesh(); const vectorField& Cf = boundaryPatch.Cf(); scalarField& field = *this; const vectorField& faceAreas = mesh.Sf(); const scalarField faceMagnitudes = mag(faceAreas); this->valueFraction() = 0.0; this->refValue() = 0.0; scalarField& refGradField = this->refGrad(); // Access refGrad as a scalarField // Coefficients for thermal conductivity kappa(T) scalar kappaCoeffsArray[] = {myKappa(T)polynomial}; const scalarField kappaCoeffs(8, kappaCoeffsArray); auto evaluateKappa = [&](scalar T) { scalar kappa = 0.0; scalar T_power = 1.0; for (int j = 0; j < kappaCoeffs.size(); ++j) { kappa += kappaCoeffs[j] * T_power; T_power *= T; } return kappa; }; forAll(field, i) { scalar yValue1 = Cf[i].y(); scalar T = field[i]; // Assuming field[i] gives the temperature at the face scalar kappa = evaluateKappa(T); scalar heatFlux = myEquation; refGradField[i] = heatFlux / kappa; // Divide by thermal conductivity kappa } #}; } Code:
heatFluxWallgroovy { type groovyBC; valueExpression "T"; // Initial value variables " kappa=myKappa(T)polynomial; //I guess this is wrong. I should access to k on ith face and then use that value? yVal=pos().y; heatFlux=myEquation(yVal)"; gradientExpression "heatFlux / kappa"; valueFraction uniform 0; } I thought I could define the dT/dx gradient using the Fourier law q = -k dT/dx. dT/dx = -q/kIf there is a more accurate method or if you identify the error, I would appreciate it if you could share it. Kind regards, said |
|
August 16, 2024, 17:26 |
|
#2 |
Member
cal
Join Date: Feb 2020
Location: nowhere
Posts: 65
Rep Power: 6 |
Hi,
When I compared the heat flux values obtained on the wall using the boundary condition I defined with groovyBC, leveraging Fourier's Law with a constant k, to my existing data, I encountered significantly overestimated values. Therefore, I used the externalWallHeatFluxTemperature boundary condition as shown below instead of groovyBC and achieved accurate results. I'm sharing this as a snippet for anyone who encounters a similar issue. Code:
HFregion { type externalWallHeatFluxTemperature; mode flux; q { type coded; code #{ auto sscQ = tmp<scalarField>::New(patch_.size(), 10000.0); auto& qq = sscQ.ref(); const vectorField& sscCF = patch_.faceCentres(); forAll(qq, i) { scalar yy = sscCF[i].y(); qq[i] = myPolynomial_Equation; } return sscQ; #}; } kappaMethod solidThermo; value $internalField; } said Last edited by saidc.; August 16, 2024 at 17:27. Reason: grammer |
|
Tags |
codedmixed, groovybc, heat flux |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[snappyHexMesh] How to draw a 3D-Drawing for Meshing | Kahnbein.Kai | OpenFOAM Meshing & Mesh Conversion | 4 | June 15, 2021 13:16 |
Heat loss through wall to surroundings, wall Heat flux | Vishnu_bharathi | CFX | 4 | December 20, 2017 19:36 |
Question about adaptive timestepping | Guille1811 | CFX | 25 | November 12, 2017 18:38 |
Basic Nozzle-Expander Design | karmavatar | CFX | 20 | March 20, 2016 09:44 |
wall heat flux in openfoam | hz283 | OpenFOAM | 1 | January 4, 2014 08:51 |