ENH: Allow setting the initial values of the design variables

in topology optimisation, through a volScalarfield named alpha.
The order of precedence is (top to bottom):
- values read from time/uniform/topOVars (used also for continuation)
- values read from 0/alpha (can be easily set with topoSet + setFields)
- uniform zero
This commit is contained in:
Vaggelis Papoutsis 2024-11-22 16:56:43 +02:00 committed by Andrew Heather
parent 9c5ce8e4f2
commit f90c7b17fc

View File

@ -223,26 +223,32 @@ void Foam::topODesignVariables::readField
{
SubField<scalar>(*this, mesh_.nCells(), offset) =
scalarField(name, *this, mesh_.nCells());
/*
// Set values next to IO boundaries if needed
if (setIOValues)
}
else
{
IOobject header
(
name,
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
);
if (header.typeHeaderOk<volScalarField>())
{
forAll(mesh_.boundary(), patchI)
Info<< "Setting design variables based on the alpha field "
<< nl << endl;
volScalarField volField
(
header,
mesh_
);
const scalarField& field = volField.primitiveField();
forAll(field, cI)
{
const fvPatch& patch = mesh_.boundary()[patchI];
if (patch.type() == "patch")
{
const labelList& faceCells = patch.faceCells();
const scalarField& pf = volField.boundaryField()[patchI];
forAll(faceCells, fI)
{
scalarField::operator[](offset + faceCells[fI]) = pf[fI];
}
}
scalarField::operator[](offset + cI) = field[cI];
}
}
*/
}
}