BUG: probes not written to probes/0 output (fixes #2452)

- as part of #2358 the writing was changed to be lazy.
  Which means that files are only created before they are actually
  written, which helps avoid flooding the filesystem if sample-only
  is required and also handles case such as "rho.*" where the sampled
  fields are not known from the objectRegistry at startup.

- now create any new files using the startTime value, which means they
  are easier to find but still retains the lazy construct.

  Don't expect any file collisions with this, but there could be some
  corner cases where the user has edited to remove fields (during
  runtime) and then re-edits to add them back in. In this case the
  file pointers would be closed but reopened later and overwriting
  the old probed values. This could be considered a feature or a bug.

BUG: bad indexing for streamlines (fixes #2454)

- a cut-and-paste error
This commit is contained in:
Mark Olesen 2022-05-10 14:10:00 +02:00
parent 762c095f4e
commit de59875147
3 changed files with 7 additions and 5 deletions

View File

@ -735,7 +735,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
forAll(allScalars_, scalari)
{
DynamicList<scalarList>& allTrackVals = allScalars_[scalari];
auto& allTrackVals = allScalars_[scalari];
scalarValues[scalari].resize(nTracks);
forAll(allTrackVals, tracki)
@ -768,7 +768,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
forAll(allVectors_, vectori)
{
DynamicList<vectorList>& allTrackVals = allVectors_[vectori];
auto& allTrackVals = allVectors_[vectori];
vectorValues[vectori].setSize(nTracks);
forAll(allTrackVals, tracki)
@ -789,7 +789,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
outputFileNames.insert
(
scalarNames_[i],
vectorNames_[i],
time_.relativePath(outFile, true)
);
}

View File

@ -87,7 +87,8 @@ void Foam::probes::createProbeFiles(const wordList& fieldNames)
mesh_.time().globalPath()
/ functionObject::outputPrefix
/ probeSubDir
/ mesh_.time().timeName()
// Use startTime as the instance for output files
/ mesh_.time().timeName(mesh_.time().startTime().value())
);
probeDir.clean(); // Remove unneeded ".."

View File

@ -99,7 +99,8 @@ Foam::OFstream* Foam::sampledSets::createProbeFile(const word& fieldName)
mesh_.time().globalPath()
/ functionObject::outputPrefix
/ probeSubDir
/ mesh_.time().timeName()
// Use startTime as the instance for output files
/ mesh_.time().timeName(mesh_.time().startTime().value())
);
probeDir.clean(); // Remove unneeded ".."