backwardsCompatibilityWallFunctions: move files instead of writing fields
- this helps avoid trashing carefully crafted input dictionaries
This commit is contained in:
parent
9f83184c29
commit
1807f2d20b
@ -64,8 +64,8 @@ tmp<volScalarField> autoCreateAlphat
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||
<< "selectable wall functions" << endl;
|
||||
Info<< "--> Creating " << fieldName
|
||||
<< " to employ run-time selectable wall functions" << endl;
|
||||
|
||||
const fvBoundaryMesh& bm = mesh.boundary();
|
||||
|
||||
@ -104,7 +104,7 @@ tmp<volScalarField> autoCreateAlphat
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing updated " << fieldName << endl;
|
||||
Info<< " Writing new " << fieldName << endl;
|
||||
alphat().write();
|
||||
|
||||
return alphat;
|
||||
@ -134,8 +134,8 @@ tmp<volScalarField> autoCreateMut
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||
<< "selectable wall functions" << endl;
|
||||
Info<< "--> Creating " << fieldName
|
||||
<< " to employ run-time selectable wall functions" << endl;
|
||||
|
||||
const fvBoundaryMesh& bm = mesh.boundary();
|
||||
|
||||
@ -174,7 +174,7 @@ tmp<volScalarField> autoCreateMut
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing updated " << fieldName << endl;
|
||||
Info<< " Writing new " << fieldName << endl;
|
||||
mut().write();
|
||||
|
||||
return mut;
|
||||
|
@ -26,6 +26,7 @@ License
|
||||
|
||||
#include "backwardsCompatibilityWallFunctions.H"
|
||||
#include "Time.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
#include "wallPolyPatch.H"
|
||||
|
||||
@ -77,27 +78,35 @@ autoCreateWallFunctionField
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||
<< "selectable wall functions" << endl;
|
||||
Info<< "--> Upgrading " << fieldName
|
||||
<< " to employ run-time selectable wall functions" << endl;
|
||||
|
||||
// Read existing field
|
||||
IOobject ioObj
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
// Read existing epsilon field
|
||||
tmp<fieldType> fieldOrig
|
||||
(
|
||||
new fieldType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
ioObj,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
|
||||
// rename file
|
||||
Info<< " Backup original " << fieldName << " to "
|
||||
<< fieldName << ".old" << endl;
|
||||
mv(ioObj.objectPath(), ioObj.objectPath() + ".old");
|
||||
|
||||
|
||||
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
||||
|
||||
forAll(newPatchFields, patchI)
|
||||
@ -145,11 +154,6 @@ autoCreateWallFunctionField
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing backup of original " << fieldName << " to "
|
||||
<< fieldName << ".old" << endl;
|
||||
fieldOrig().rename(fieldName + ".old");
|
||||
fieldOrig().write();
|
||||
|
||||
Info<< " Writing updated " << fieldName << endl;
|
||||
fieldNew().write();
|
||||
|
||||
|
@ -63,8 +63,8 @@ tmp<volScalarField> autoCreateNut
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||
<< "selectable wall functions" << endl;
|
||||
Info<< "--> Creating " << fieldName
|
||||
<< " to employ run-time selectable wall functions" << endl;
|
||||
|
||||
const fvBoundaryMesh& bm = mesh.boundary();
|
||||
|
||||
@ -103,7 +103,7 @@ tmp<volScalarField> autoCreateNut
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing updated " << fieldName << endl;
|
||||
Info<< " Writing new " << fieldName << endl;
|
||||
nut().write();
|
||||
|
||||
return nut;
|
||||
|
@ -26,6 +26,7 @@ License
|
||||
|
||||
#include "backwardsCompatibilityWallFunctions.H"
|
||||
#include "Time.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
#include "wallPolyPatch.H"
|
||||
|
||||
@ -77,27 +78,35 @@ autoCreateWallFunctionField
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
||||
<< "selectable wall functions" << endl;
|
||||
Info<< "--> Upgrading " << fieldName
|
||||
<< " to employ run-time selectable wall functions" << endl;
|
||||
|
||||
// Read existing field
|
||||
IOobject ioObj
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
// Read existing epsilon field
|
||||
tmp<fieldType> fieldOrig
|
||||
(
|
||||
new fieldType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
ioObj,
|
||||
mesh
|
||||
)
|
||||
);
|
||||
|
||||
// rename file
|
||||
Info<< " Backup original " << fieldName << " to "
|
||||
<< fieldName << ".old" << endl;
|
||||
mv(ioObj.objectPath(), ioObj.objectPath() + ".old");
|
||||
|
||||
|
||||
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
||||
|
||||
forAll(newPatchFields, patchI)
|
||||
@ -145,11 +154,6 @@ autoCreateWallFunctionField
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " Writing backup of original " << fieldName << " to "
|
||||
<< fieldName << ".old" << endl;
|
||||
fieldOrig().rename(fieldName + ".old");
|
||||
fieldOrig().write();
|
||||
|
||||
Info<< " Writing updated " << fieldName << endl;
|
||||
fieldNew().write();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user