mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
committed by
Andrew Heather
parent
9c5ce8e4f2
commit
f90c7b17fc
@ -223,26 +223,32 @@ void Foam::topODesignVariables::readField
|
|||||||
{
|
{
|
||||||
SubField<scalar>(*this, mesh_.nCells(), offset) =
|
SubField<scalar>(*this, mesh_.nCells(), offset) =
|
||||||
scalarField(name, *this, mesh_.nCells());
|
scalarField(name, *this, mesh_.nCells());
|
||||||
|
}
|
||||||
/*
|
else
|
||||||
// Set values next to IO boundaries if needed
|
{
|
||||||
if (setIOValues)
|
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];
|
scalarField::operator[](offset + cI) = field[cI];
|
||||||
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];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user