|
[Sponsors] |
How to write output only for cellset and not entire domain! |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 26, 2020, 11:03 |
How to write output only for cellset and not entire domain!
|
#1 |
Member
Tom Waits
Join Date: Aug 2018
Posts: 42
Rep Power: 8 |
I have the following code in my fvOptions to write "USource" to a file. This works, however it writes "USource" for every cell in my domain, which is very slow. I am only interested in writing "USource" for the CellSet I define in topoSetDict. Could someone please help with a way to do this?
Code:
if (mesh_.time().outputTime()) { volVectorField momentumSourceField ( IOobject ( "momentumSourceField", mesh_.time().timeName(), mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh_, vector::zero ); forAll(cells, i) { momentumSourceField[cells[i]] = Usource[cells[i]]; momentumSourceField.write(); } Tom Waits |
|
August 26, 2020, 11:10 |
|
#2 |
Senior Member
Yan Zhang
Join Date: May 2014
Posts: 120
Rep Power: 12 |
Are you looking for this?
https://github.com/StachuraMichal/Op...sampleCellZone
__________________
https://openfoam.top |
|
August 26, 2020, 11:28 |
|
#3 | |
Member
Tom Waits
Join Date: Aug 2018
Posts: 42
Rep Power: 8 |
Quote:
I was hoping for a minor modification to the code I posted to loop over the cells defined in toposet as opposed to the entire grid. As an aside, when I try to compile the code you sent, I get the following error: Code:
cellZoneSet/cellZoneSet.C:139:20: error: ‘const class Foam::dictionary’ has no member named ‘get’; did you mean ‘set’? zoneName_(dict.get<word>("cellZone")) ^~~ set cellZoneSet/cellZoneSet.C:139:28: error: expected primary-expression before ‘>’ token zoneName_(dict.get<word>("cellZone")) Regards, Tom Waits |
||
|
|