|
[Sponsors] |
June 1, 2021, 06:25 |
Saving Residuals
|
#1 |
New Member
Raoul
Join Date: Apr 2021
Posts: 16
Rep Power: 5 |
Hi everyone,
I am trying to save the residuals of the NS equations in a csv file to be able to easily post process those values. Right now I am evaluating the residuals by substituting explicitly all the terms and evaluating the value of the equation e.g. Code:
residual = fvc::ddt(U)+fvc::div(phi, U)- fvc::laplacian(nu, U)+fvc::grad(p) forAll(mesh.C(),I) { res = residual[I]*residual[I]; } finalres = max(res.internalField()).value(); Thank you in advance. |
|
June 1, 2021, 06:30 |
You can save residuals using controlDict
|
#2 |
Member
Jun
Join Date: Nov 2015
Posts: 57
Rep Power: 10 |
I thought controlDict can help you but it is not.
Sorry. Add line below before while (runTime.run()) in your main code. Code:
autoPtr<OFstream> residualPtr; Code:
// Create the residual file if not already created if (residualPtr.empty()) { // File update if (Pstream::master()) { fileName residual; word name_ = "residual"; // Open new file at start up residualPtr.reset(new OFstream("residual.dat")); } } if (Pstream::master()) { velFilePtr() << runTime.timeName() << tab << residual endl; } Best, Jun |
|
June 1, 2021, 07:05 |
|
#3 |
New Member
Raoul
Join Date: Apr 2021
Posts: 16
Rep Power: 5 |
Thank you very much for your answer, I will try to understand the code and test it.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Saving the residuals in a dat file from TUI | EmiS | FLUENT | 4 | December 18, 2022 02:07 |
Cannot find functionObject file residuals | vava10 | OpenFOAM Pre-Processing | 2 | November 14, 2020 12:21 |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 19:43 |
motorBike Residuals for SST k-omega... and mine | JR22 | OpenFOAM Running, Solving & CFD | 6 | August 1, 2013 09:08 |
judging convergence through residuals | MachZero | Main CFD Forum | 7 | December 25, 2012 12:18 |