bos #26523 EDF 24234 - Viscous Layer

fix wrong treatment of a shrunk FACE with two adjacent FACEs with layers
This commit is contained in:
eap 2021-11-27 14:06:46 +03:00
parent f994811cbe
commit 2238faf39e

View File

@ -1303,11 +1303,11 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom,
if ( id ) solidSMDSIDs[ bool( solidSMDSIDs[0] )] = meshDS->ShapeToIndex( *solid ); if ( id ) solidSMDSIDs[ bool( solidSMDSIDs[0] )] = meshDS->ShapeToIndex( *solid );
} }
} }
bool isShrunk = true;
if ( proxyMesh && proxyMesh->GetProxySubMesh( geomFace )) if ( proxyMesh && proxyMesh->GetProxySubMesh( geomFace ))
{ {
// if a proxy sub-mesh contains temporary faces, then these faces // if a proxy sub-mesh contains temporary faces, then these faces
// should be used to mesh only one SOLID // should be used to mesh only one SOLID
bool hasTmp = false;
smDS = proxyMesh->GetSubMesh( geomFace ); smDS = proxyMesh->GetSubMesh( geomFace );
SMDS_ElemIteratorPtr faces = smDS->GetElements(); SMDS_ElemIteratorPtr faces = smDS->GetElements();
while ( faces->more() ) while ( faces->more() )
@ -1315,7 +1315,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom,
const SMDS_MeshElement* f = faces->next(); const SMDS_MeshElement* f = faces->next();
if ( proxyMesh->IsTemporary( f )) if ( proxyMesh->IsTemporary( f ))
{ {
hasTmp = true; isShrunk = false;
if ( solidSMDSIDs[1] && proxyMesh->HasPrismsOnTwoSides( meshDS->MeshElements( geomFace ))) if ( solidSMDSIDs[1] && proxyMesh->HasPrismsOnTwoSides( meshDS->MeshElements( geomFace )))
break; break;
else else
@ -1334,7 +1334,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom,
} }
} }
const int fID = occgeom.fmap.FindIndex( geomFace ); const int fID = occgeom.fmap.FindIndex( geomFace );
if ( !hasTmp ) // shrunk mesh if ( isShrunk ) // shrunk mesh
{ {
// move netgen points according to moved nodes // move netgen points according to moved nodes
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true); SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true);
@ -1386,7 +1386,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom,
{ {
solidSMDSIDs[1] = 0; solidSMDSIDs[1] = 0;
} }
const bool hasVLOn2Sides = ( solidSMDSIDs[1] > 0 ); const bool hasVLOn2Sides = ( solidSMDSIDs[1] > 0 && !isShrunk );
// Add ng face descriptors of meshed faces // Add ng face descriptors of meshed faces
faceNgID++; faceNgID++;
@ -3234,7 +3234,7 @@ bool NETGENPlugin_Mesher::Compute()
// fill _ngMesh with faces of sub-meshes // fill _ngMesh with faces of sub-meshes
err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_2D ], &quadHelper)); err = ! ( FillNgMesh(occgeo, *_ngMesh, nodeVec, meshedSM[ MeshDim_2D ], &quadHelper));
initState = NETGENPlugin_ngMeshInfo(_ngMesh, /*checkRemovedElems=*/true); initState = NETGENPlugin_ngMeshInfo(_ngMesh, /*checkRemovedElems=*/true);
// toPython( _ngMesh ); // toPython( _ngMesh )
} }
if (!err && _isVolume) if (!err && _isVolume)
{ {
@ -3887,6 +3887,7 @@ void NETGENPlugin_Mesher::toPython( const netgen::Mesh* ngMesh )
for ( int i = 0; i < nbDom; ++i ) for ( int i = 0; i < nbDom; ++i )
outfile<< "grp" << i+1 << " = mesh.CreateEmptyGroup( SMESH.FACE, 'domain"<< i+1 << "')"<< std::endl; outfile<< "grp" << i+1 << " = mesh.CreateEmptyGroup( SMESH.FACE, 'domain"<< i+1 << "')"<< std::endl;
int nbDel = 0;
for (int i = 1; i <= ngMesh->GetNSE(); i++) for (int i = 1; i <= ngMesh->GetNSE(); i++)
{ {
outfile << "mesh.AddFace([ "; outfile << "mesh.AddFace([ ";
@ -3895,13 +3896,14 @@ void NETGENPlugin_Mesher::toPython( const netgen::Mesh* ngMesh )
outfile << sel.PNum(j) << ( j < sel.GetNP() ? ", " : " ])"); outfile << sel.PNum(j) << ( j < sel.GetNP() ? ", " : " ])");
if ( sel.IsDeleted() ) outfile << " ## IsDeleted "; if ( sel.IsDeleted() ) outfile << " ## IsDeleted ";
outfile << std::endl; outfile << std::endl;
nbDel += sel.IsDeleted();
if (sel.GetIndex()) if (sel.GetIndex())
{ {
if ( int dom1 = ngMesh->GetFaceDescriptor(sel.GetIndex ()).DomainIn()) if ( int dom1 = ngMesh->GetFaceDescriptor(sel.GetIndex ()).DomainIn())
outfile << "grp"<< dom1 <<".Add([ " << i << " ])" << std::endl; outfile << "grp"<< dom1 <<".Add([ " << i - nbDel << << " ])" << std::endl;
if ( int dom2 = ngMesh->GetFaceDescriptor(sel.GetIndex ()).DomainOut()) if ( int dom2 = ngMesh->GetFaceDescriptor(sel.GetIndex ()).DomainOut())
outfile << "grp"<< dom2 <<".Add([ " << i << " ])" << std::endl; outfile << "grp"<< dom2 <<".Add([ " << i - nbDel << " ])" << std::endl;
} }
} }
@ -3938,6 +3940,7 @@ void NETGENPlugin_Mesher::toPython( const netgen::Mesh* ngMesh )
for ( int i = 0; i < nbDom; ++i ) for ( int i = 0; i < nbDom; ++i )
outfile<< "grp" << i+1 << " = mesh.CreateEmptyGroup( SMESH.FACE, 'domain"<< i+1 << "')"<< std::endl; outfile<< "grp" << i+1 << " = mesh.CreateEmptyGroup( SMESH.FACE, 'domain"<< i+1 << "')"<< std::endl;
int nbDel = 0;
SurfaceElementIndex sei; SurfaceElementIndex sei;
for (sei = 0; sei < ngMesh->GetNSE(); sei++) for (sei = 0; sei < ngMesh->GetNSE(); sei++)
{ {
@ -3947,13 +3950,14 @@ void NETGENPlugin_Mesher::toPython( const netgen::Mesh* ngMesh )
outfile << sel[j] << ( j+1 < sel.GetNP() ? ", " : " ])"); outfile << sel[j] << ( j+1 < sel.GetNP() ? ", " : " ])");
if ( sel.IsDeleted() ) outfile << " ## IsDeleted "; if ( sel.IsDeleted() ) outfile << " ## IsDeleted ";
outfile << std::endl; outfile << std::endl;
nbDel += sel.IsDeleted();
if ((*ngMesh)[sei].GetIndex()) if ((*ngMesh)[sei].GetIndex())
{ {
if ( int dom1 = ngMesh->GetFaceDescriptor((*ngMesh)[sei].GetIndex ()).DomainIn()) if ( int dom1 = ngMesh->GetFaceDescriptor((*ngMesh)[sei].GetIndex ()).DomainIn())
outfile << "grp"<< dom1 <<".Add([ " << (int)sei+1 << " ])" << std::endl; outfile << "grp"<< dom1 <<".Add([ " << (int)sei+1 - nbDel << " ])" << std::endl;
if ( int dom2 = ngMesh->GetFaceDescriptor((*ngMesh)[sei].GetIndex ()).DomainOut()) if ( int dom2 = ngMesh->GetFaceDescriptor((*ngMesh)[sei].GetIndex ()).DomainOut())
outfile << "grp"<< dom2 <<".Add([ " << (int)sei+1 << " ])" << std::endl; outfile << "grp"<< dom2 <<".Add([ " << (int)sei+1 - nbDel << " ])" << std::endl;
} }
} }