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
|
else
|
||||||
{
|
{
|
||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Creating " << fieldName
|
||||||
<< "selectable wall functions" << endl;
|
<< " to employ run-time selectable wall functions" << endl;
|
||||||
|
|
||||||
const fvBoundaryMesh& bm = mesh.boundary();
|
const fvBoundaryMesh& bm = mesh.boundary();
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ tmp<volScalarField> autoCreateAlphat
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Writing updated " << fieldName << endl;
|
Info<< " Writing new " << fieldName << endl;
|
||||||
alphat().write();
|
alphat().write();
|
||||||
|
|
||||||
return alphat;
|
return alphat;
|
||||||
@ -134,8 +134,8 @@ tmp<volScalarField> autoCreateMut
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Creating " << fieldName
|
||||||
<< "selectable wall functions" << endl;
|
<< " to employ run-time selectable wall functions" << endl;
|
||||||
|
|
||||||
const fvBoundaryMesh& bm = mesh.boundary();
|
const fvBoundaryMesh& bm = mesh.boundary();
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ tmp<volScalarField> autoCreateMut
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Writing updated " << fieldName << endl;
|
Info<< " Writing new " << fieldName << endl;
|
||||||
mut().write();
|
mut().write();
|
||||||
|
|
||||||
return mut;
|
return mut;
|
||||||
|
@ -26,6 +26,7 @@ License
|
|||||||
|
|
||||||
#include "backwardsCompatibilityWallFunctions.H"
|
#include "backwardsCompatibilityWallFunctions.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
|
|
||||||
@ -77,27 +78,35 @@ autoCreateWallFunctionField
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Upgrading " << fieldName
|
||||||
<< "selectable wall functions" << endl;
|
<< " 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
|
tmp<fieldType> fieldOrig
|
||||||
(
|
(
|
||||||
new fieldType
|
new fieldType
|
||||||
(
|
(
|
||||||
IOobject
|
ioObj,
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh
|
mesh
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// rename file
|
||||||
|
Info<< " Backup original " << fieldName << " to "
|
||||||
|
<< fieldName << ".old" << endl;
|
||||||
|
mv(ioObj.objectPath(), ioObj.objectPath() + ".old");
|
||||||
|
|
||||||
|
|
||||||
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
||||||
|
|
||||||
forAll(newPatchFields, patchI)
|
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;
|
Info<< " Writing updated " << fieldName << endl;
|
||||||
fieldNew().write();
|
fieldNew().write();
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ tmp<volScalarField> autoCreateNut
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Creating " << fieldName
|
||||||
<< "selectable wall functions" << endl;
|
<< " to employ run-time selectable wall functions" << endl;
|
||||||
|
|
||||||
const fvBoundaryMesh& bm = mesh.boundary();
|
const fvBoundaryMesh& bm = mesh.boundary();
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ tmp<volScalarField> autoCreateNut
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Writing updated " << fieldName << endl;
|
Info<< " Writing new " << fieldName << endl;
|
||||||
nut().write();
|
nut().write();
|
||||||
|
|
||||||
return nut;
|
return nut;
|
||||||
|
@ -26,6 +26,7 @@ License
|
|||||||
|
|
||||||
#include "backwardsCompatibilityWallFunctions.H"
|
#include "backwardsCompatibilityWallFunctions.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
#include "OSspecific.H"
|
||||||
|
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
|
|
||||||
@ -77,27 +78,35 @@ autoCreateWallFunctionField
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "--> Upgrading " << fieldName << " to employ run-time "
|
Info<< "--> Upgrading " << fieldName
|
||||||
<< "selectable wall functions" << endl;
|
<< " 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
|
tmp<fieldType> fieldOrig
|
||||||
(
|
(
|
||||||
new fieldType
|
new fieldType
|
||||||
(
|
(
|
||||||
IOobject
|
ioObj,
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
mesh
|
mesh
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// rename file
|
||||||
|
Info<< " Backup original " << fieldName << " to "
|
||||||
|
<< fieldName << ".old" << endl;
|
||||||
|
mv(ioObj.objectPath(), ioObj.objectPath() + ".old");
|
||||||
|
|
||||||
|
|
||||||
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
PtrList<fvPatchField<Type> > newPatchFields(mesh.boundary().size());
|
||||||
|
|
||||||
forAll(newPatchFields, patchI)
|
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;
|
Info<< " Writing updated " << fieldName << endl;
|
||||||
fieldNew().write();
|
fieldNew().write();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user