|
[Sponsors] |
dimensionedScalar not updating, stuck on initial values |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 5, 2018, 21:50 |
dimensionedScalar not updating, stuck on initial values
|
#1 |
Member
Anonymous
Join Date: Aug 2016
Posts: 75
Rep Power: 10 |
Modifying pimpleFoam, I've created a dimensionedScalar which which computes the area weighted average over the boundary patches 'INLET' and 'OUTLET'. In createFields.H, I add the following entries to create the dimensionedScalar 'meanTOut' and 'meanTIn' (which are avg. temperatures on outlet and inlet patch respectively):
Code:
dimensionedScalar meanTOut // used in TEqn.H ( "meanTOut", dimensionSet(0, 0, 0, 1, 0, 0 ,0), 1 // initilization ); dimensionedScalar meanTIn // used in TEqn.H ( "meanTIn", dimensionSet(0, 0, 0, 1, 0, 0 ,0), 0 // initilization ); Code:
// Area-weighted Temperature on OUTLET patch if (areaOut > 0) { dimensionedScalar meanTOut = gSum ( mesh.magSf().boundaryField()[OUTLET] * T.boundaryField()[OUTLET] )/ areaOut; } // Area-weighted Temperature on INLET patch if (areaIn > 0) { dimensionedScalar meanTIn = gSum ( mesh.magSf().boundaryField()[INLET] * T.boundaryField()[INLET] )/ areaIn; } Info<< "Area weighted OUTLET patch temperature = " << meanTOut << nl << endl; Info<< "Area weighted INLET patch temperature = = " << meanTIn << nl << endl; Am I missing anything basic here? Anyhelp is appreciated. PS: The other variables like areaIn, areaOut & patch labels like INLET and OUTLET etc. have been calculated elsewhere not shown in the code above. |
|
August 7, 2018, 09:18 |
|
#2 |
Senior Member
|
Hi,
You may need to modify the code for some reason, but if you need to find the average of a field on a patch, there is already a functionObject: surfaceFieldValue. Depending on the version you use it may be called differently. Regards, Tom |
|
August 7, 2018, 21:30 |
|
#3 |
Senior Member
|
Hi,halo
Why do you define the "meanTout" twice? If you define meanTout as dimensionedScalar in createFields.H, there will be no need for defining it again in if{}. Probably you are creating two different "meanTout" instances with a same name in the different scopes. The values of meanTout inside if{} will be calculated. But, what you write out is not that one. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Segmentation fault when using reactingFOAM for Fluids | Tommy Floessner | OpenFOAM Running, Solving & CFD | 4 | April 22, 2018 13:30 |
HeatSource BC to the whole region in chtMultiRegionHeater | xsa | OpenFOAM Running, Solving & CFD | 3 | November 7, 2016 06:07 |
simpleFoam error - "Floating point exception" | mbcx4jc2 | OpenFOAM Running, Solving & CFD | 12 | August 4, 2015 03:20 |
Wrong fluctuation of pressure in transient simulation | caitao | OpenFOAM Running, Solving & CFD | 2 | March 5, 2015 22:33 |
Compressor Simulation using rhoPimpleDyMFoam | Jetfire | OpenFOAM Running, Solving & CFD | 107 | December 9, 2014 14:38 |