Open zongy17 opened 3 years ago
Putting a gradient update at the beginning of the coefficient loop is sufficient for laminar flows. We need to update the gradient of the field at the beginning only. Adding a gradient update at the end will change nothing to the result, because you are in fact updating the gradient at the end, and also again at the beginning of the next loop
Thank you for the reply! I tried making cfdRunFalseTransientCase.m like this:
% Pre-updates (necessary on startup)
cfdUpdateFieldsForAllBoundaryPatches;
% cfdUpdateGradients;
cfdUpdateScales;
% Start steady false transience loop
totalNumberOfIterations = 0;
while (cfdDoFalseTransientLoop)
% Update number of iters
totalNumberOfIterations = totalNumberOfIterations + 1;
% Time settings
cfdUpdateRunTime;
% Print
cfdPrintIteration(totalNumberOfIterations);
cfdPrintResidualsHeader;
% Updates
cfdUpdatePrevIter;
cfdUpdateProperties;
cfdUpdateGradients; % I add the update here
% Navier-Stokes and pressure correction
cfdAssembleAndCorrectNSSystem
% Energy
cfdAssembleAndCorrectEnergyEquation;
% Post actions
cfdPlotRes;
cfdPostResults(totalNumberOfIterations);
cfdWriteResults(totalNumberOfIterations);
end
But it does seem that results do not change much. I do not understand why omitting those updates inside the loop could work, since the non-orthogonal terms need gradients of the new fields. It looks incredible. Could you explain the mysterious reason?
In function cfdRunFalseTransientCase, why cfdUpdateGradients is called only for one-time outside the main loop?
This problem results in that the gradient used throughout the whole computation process is the same! (Notice that in _cfdAssembleAndCorrect_xxxEquation functions, gradient is used to calculate non-orthogonal correction terms.) Thus, I think an additional call to cfdUpdateGradients should be placed at the end of the main loop body.