|
[Sponsors] |
February 27, 2023, 08:19 |
Average of specified volume
|
#1 |
New Member
george
Join Date: Feb 2021
Posts: 16
Rep Power: 5 |
Hi,
I need to calculate average velocity components and temperature of a specified volume in a container at every time-step. It is the same thing that averaging specific volume fraction inside a pipe. I couldn't find which utilites I should use.
scfd. |
|
February 27, 2023, 08:48 |
|
#2 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,208
Rep Power: 28 |
Hello scfd,
You seem to already have the answers to your questions! You can indeed use volFieldValue to compute average values in a volume. Your volume can be a cellZone, and you can create this cellZone right from snappyHexMesh when meshing (assuming you are meshing with snappy) or on an existing mesh using topoSet. In topoSet you can use a source such as boxToCell or cylinderToCell to select the cells inside the volume you want to average. This will create a cellSet, then you can use setToCellZone to convert your cellSet into a cellZone. Regards, Yann |
|
February 27, 2023, 12:27 |
|
#3 | |
New Member
george
Join Date: Feb 2021
Posts: 16
Rep Power: 5 |
Quote:
Thanks for your quick reply. I followed your suggestion and nearly reach what I want. Here is the topoSet file and fucntion: Code:
actions ( { name packVolume; type cellSet; action new; source cylinderToCell; point1 (0 0 30); point2 (0 0 70); radius 30; } { name volpack; type cellZoneSet; action new; source setToCellZone; set packVolume; } ); Code:
functions { vfv1 { type volFieldValue; libs (fieldFunctionObjects); fields (T U); operation average; regionType cellZone; name volpack; writeFields true; writeToFile true; writeControl writeTime; } } Code:
--> FOAM Warning : cellZone(volpack): Region has no cells From void Foam::functionObjects::volRegion::calculateCache() in file functionObjects/volRegion/volRegion.C at line 122. --> loading function object 'vfv1' regards, scfd. |
||
February 27, 2023, 13:07 |
|
#4 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,208
Rep Power: 28 |
Looks like volPak is empty, what is the output when executing topoSet?
Regards, Yann |
|
February 27, 2023, 13:24 |
|
#5 | |
New Member
george
Join Date: Feb 2021
Posts: 16
Rep Power: 5 |
Quote:
Code:
Reading topoSetDict Time = 0 mesh not changed. Created cellSet packVolume Applying source cylinderToCell Adding cells with centres within cylinder, with point1 = (0 0 30), point2 = (0 0 70), radius = 30 cellSet packVolume now size 22935 Created cellZoneSet volpack Applying source setToCellZone Adding all cells from cellSet packVolume ... cellZoneSet volpack now size 22935 End scfd |
||
February 28, 2023, 04:12 |
|
#6 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,208
Rep Power: 28 |
This is uncanny, since your cellZone seems to be properly created during topoSet.
Just a question: do you run your case in parallel? If you do, have you run topoSet in parallel too? Regards, Yann |
|
February 28, 2023, 08:54 |
|
#7 | |
New Member
george
Join Date: Feb 2021
Posts: 16
Rep Power: 5 |
Quote:
This is the workflow: Code:
runApplication blockMesh runApplication snappyHexMesh -overwrite runApplication topoSet runApplication checkMesh transformPoints -scale "(0.001)" runApplication createPatch -overwrite runApplication renumberMesh -overwrite restore0Dir runApplication changeDictionary runApplication decomposePar #runParallel $(getApplication) #runApplication reconstructPar Code:
Checking basic cellZone addressing... CellZone Cells Points VolumeBoundingBox square 21285 28654 92044.29 (-16.240871 -16.24087 0) (16.24087 16.240869 100) innerCircle 21000 24480 195490.6 (-30.458205 -30.458205 0) (30.458204 30.458205 100) volpack 22935 29794 112415.39 (-30.458205 -30.458205 30.005496) (30.458204 30.458205 69.994475) Code:
--> FOAM Warning : From void Foam::polyTopoChange::addMesh(const Foam::polyMesh&, const labelUList&, const labelUList&, const labelUList&, const labelUList&) in file polyTopoChange/polyTopoChange.C at line 2346 Cell:42283 centre:(-0.0055351021 0.0060833295 0.056633843) is in two zones:square and volpack This is not supported. Continuing with first zone only. --> FOAM Warning : From void Foam::polyTopoChange::addMesh(const Foam::polyMesh&, const labelUList&, const labelUList&, const labelUList&, const labelUList&) in file polyTopoChange/polyTopoChange.C at line 2346 Cell:42284 centre:(-0.0060848722 0.0060845366 0.056656412) is in two zones:square and volpack This is not supported. Continuing with first zone only. Moving faces from patch z_min_0 to patch 4 Moving faces from patch z_max_0 to patch 5 Moving faces from patch wall_0 to patch 6 Moving faces from patch STL_spheres_0 to patch 7 Doing topology modification to order faces. Not synchronising points. Removing patches with no faces in them. Removed zero-sized patch wall_0 type wall at position 0 Removed zero-sized patch z_min_0 type wall at position 1 Removed zero-sized patch z_max_0 type wall at position 2 Removed zero-sized patch STL_spheres_0 type wall at position 3 Writing repatched mesh region0 to 0 End regards, scfd |
||
February 28, 2023, 09:37 |
|
#8 |
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 1,208
Rep Power: 28 |
I'm not sure why createPatch would mess with the cellZone, but you can try to run topoSet after createPatch or even right before running decomposePar, just to be sure there is nothing else messing with the cellZone definition.
(And if it still doesn't solve the issue, you can ultimately run it after decomposing the case with runParallel topoSet) Yann |
|
February 28, 2023, 09:54 |
|
#9 | |
New Member
george
Join Date: Feb 2021
Posts: 16
Rep Power: 5 |
Quote:
...right before running decomposeParThat solved the problem. Many thanks Yann. Code:
runApplication blockMesh runApplication snappyHexMesh -overwrite runApplication checkMesh runApplication transformPoints -scale "(0.001)" runApplication createPatch -overwrite runApplication renumberMesh -overwrite restore0Dir runApplication changeDictionary runApplication topoSet runApplication decomposePar runParallel $(getApplication) runApplication reconstructPar scfd |
||
Tags |
average cell, post procesing, searchablecylinder, volume |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calculating source term total cell-zone volume parallel computation | RobV | Fluent UDF and Scheme Programming | 2 | May 30, 2022 04:46 |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
Problem of simulating of small droplet with radius of 2mm | liguifan | OpenFOAM Running, Solving & CFD | 5 | June 3, 2014 03:53 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
channelFoam for a 3D pipe | AlmostSurelyRob | OpenFOAM | 3 | June 24, 2011 14:06 |