mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Insert background cell size mesh using the cell size functions
This commit is contained in:
@ -156,6 +156,8 @@ public:
|
|||||||
|
|
||||||
// Query
|
// Query
|
||||||
|
|
||||||
|
virtual label maxPriority() const = 0;
|
||||||
|
|
||||||
virtual void cellSizeFunctionVertices
|
virtual void cellSizeFunctionVertices
|
||||||
(
|
(
|
||||||
DynamicList<Foam::point>& pts,
|
DynamicList<Foam::point>& pts,
|
||||||
|
|||||||
@ -72,9 +72,11 @@ Foam::fileControl::fileControl
|
|||||||
),
|
),
|
||||||
pointsFile_(controlFunctionDict.lookup("pointsFile")),
|
pointsFile_(controlFunctionDict.lookup("pointsFile")),
|
||||||
sizesFile_(controlFunctionDict.lookup("sizesFile")),
|
sizesFile_(controlFunctionDict.lookup("sizesFile")),
|
||||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile"))
|
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile")),
|
||||||
|
maxPriority_(readLabel(controlFunctionDict.lookup("priority")))
|
||||||
{
|
{
|
||||||
Info<< indent << "Loading " << name << " from file:" << nl
|
Info<< indent << "Loading " << name << " from file:" << nl
|
||||||
|
<< indent << " priority : " << maxPriority_ << nl
|
||||||
<< indent << " points : " << pointsFile_ << nl
|
<< indent << " points : " << pointsFile_ << nl
|
||||||
<< indent << " sizes : " << sizesFile_ << nl
|
<< indent << " sizes : " << sizesFile_ << nl
|
||||||
<< indent << " alignments : " << alignmentsFile_
|
<< indent << " alignments : " << alignmentsFile_
|
||||||
|
|||||||
@ -58,6 +58,8 @@ class fileControl
|
|||||||
|
|
||||||
const fileName alignmentsFile_;
|
const fileName alignmentsFile_;
|
||||||
|
|
||||||
|
label maxPriority_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -112,20 +114,25 @@ public:
|
|||||||
// ) const;
|
// ) const;
|
||||||
|
|
||||||
|
|
||||||
|
virtual label maxPriority() const
|
||||||
|
{
|
||||||
|
return maxPriority_;
|
||||||
|
}
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
virtual void cellSizeFunctionVertices
|
virtual void cellSizeFunctionVertices
|
||||||
(
|
(
|
||||||
DynamicList<Foam::point>& pts,
|
DynamicList<Foam::point>& pts,
|
||||||
DynamicList<scalar>& sizes
|
DynamicList<scalar>& sizes
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
virtual void initialVertices
|
virtual void initialVertices
|
||||||
(
|
(
|
||||||
pointField& pts,
|
pointField& pts,
|
||||||
scalarField& sizes,
|
scalarField& sizes,
|
||||||
triadField& alignments
|
triadField& alignments
|
||||||
) const;
|
) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -245,6 +245,8 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
|||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<label> priorityMap;
|
||||||
|
|
||||||
const PtrList<cellSizeAndAlignmentControl>& controlFunctions =
|
const PtrList<cellSizeAndAlignmentControl>& controlFunctions =
|
||||||
sizeControls_.controlFunctions();
|
sizeControls_.controlFunctions();
|
||||||
|
|
||||||
@ -377,13 +379,24 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
|||||||
|
|
||||||
if (forceInsertion || insertPoint)
|
if (forceInsertion || insertPoint)
|
||||||
{
|
{
|
||||||
mesh_.insert
|
const label oldSize = mesh_.vertexCount();
|
||||||
|
|
||||||
|
cellShapeControlMesh::Vertex_handle insertedVert = mesh_.insert
|
||||||
(
|
(
|
||||||
pt,
|
pt,
|
||||||
calculatedCellSize,
|
calculatedCellSize,
|
||||||
vertices[vI].alignment(),
|
vertices[vI].alignment(),
|
||||||
Vb::vtInternalNearBoundary
|
Vb::vtInternalNearBoundary
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (oldSize == mesh_.vertexCount() - 1)
|
||||||
|
{
|
||||||
|
priorityMap.insert
|
||||||
|
(
|
||||||
|
insertedVert->index(),
|
||||||
|
controlFunction.maxPriority()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,19 +519,53 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
|||||||
|
|
||||||
if (forceInsertion || insertPoint)
|
if (forceInsertion || insertPoint)
|
||||||
{
|
{
|
||||||
mesh_.insert
|
// Check the priority
|
||||||
(
|
|
||||||
pt,
|
cellShapeControlMesh::Cell_handle ch =
|
||||||
calculatedCellSize,
|
mesh_.locate(toPoint<cellShapeControlMesh::Point>(pt));
|
||||||
vertices[vI].alignment(),
|
|
||||||
Vb::vtInternal
|
const label newPtPriority = controlFunction.maxPriority();
|
||||||
);
|
|
||||||
|
label highestPriority = -1;
|
||||||
|
for (label cI = 0; cI < 4; ++cI)
|
||||||
|
{
|
||||||
|
const label vertPriority =
|
||||||
|
priorityMap[ch->vertex(cI)->index()];
|
||||||
|
|
||||||
|
if (vertPriority > highestPriority)
|
||||||
|
{
|
||||||
|
highestPriority = vertPriority;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newPtPriority >= highestPriority)
|
||||||
|
{
|
||||||
|
const label oldSize = mesh_.vertexCount();
|
||||||
|
|
||||||
|
cellShapeControlMesh::Vertex_handle insertedVert =
|
||||||
|
mesh_.insert
|
||||||
|
(
|
||||||
|
pt,
|
||||||
|
calculatedCellSize,
|
||||||
|
vertices[vI].alignment(),
|
||||||
|
Vb::vtInternal
|
||||||
|
);
|
||||||
|
|
||||||
|
if (oldSize == mesh_.vertexCount() - 1)
|
||||||
|
{
|
||||||
|
priorityMap.insert
|
||||||
|
(
|
||||||
|
insertedVert->index(),
|
||||||
|
newPtPriority
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//mesh_.rangeInsertWithInfo(vertices.begin(), vertices.end());
|
//mesh_.rangeInsertWithInfo(vertices.begin(), vertices.end());
|
||||||
|
|
||||||
Info<< " Inserted "
|
Info<< " Inserted extra points "
|
||||||
<< returnReduce
|
<< returnReduce
|
||||||
(
|
(
|
||||||
label(mesh_.number_of_vertices()) - preInsertedSize,
|
label(mesh_.number_of_vertices()) - preInsertedSize,
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
Reference in New Issue
Block a user