View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002238 | OpenFOAM | Patch | public | 2016-09-08 06:19 | 2017-01-05 16:06 |
Reporter | Assigned To | henry | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Platform | linux | OS | opensuse | OS Version | 11.4 |
Fixed in Version | dev | ||||
Summary | 0002238: STYLE: use of bounding box in fluentMeshToFoam is odd/misleading | ||||
Description | Uses bounding box with inverted min/max extents (confusing), but only to obtain the overall box size. Can just do directly. fluentMeshToFoam.L lines 970ff - boundBox box(max(points), min(points)); - const scalar zOffset = extrusionFactor*box.mag(); + const scalar overallSize = Foam::mag(max(points) - min(points)); + const scalar zOffset = extrusionFactor*overallSize; | ||||
Tags | No tags attached. | ||||
|
|
|
The attached package "patch_name_v1.tar.gz" provides updates for the following files: - applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L - Fix for the reported aesthetic coding issue. I didn't go with either solutions, but went instead with the middle term: simply use "boundBox box(points)", instead of going around with min/max operations which 'boundBox' already has an overload for, i.e.: boundBox box(points); const scalar zOffset = extrusionFactor*box.mag(); - Although the feature for automated scaling in the Z direction is nice, I don't like not having a manual override for it. Therefore, the provided change uses the same argument naming convention as 'plot3dToFoam', namely to provide the argument '-2D <thickness>' for manual override. - The message for this new argument is nearly identical to the original one on 'plot3dToFoam', but appended the indication '(applied before scale)'. - applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C - For consistency, added the same indication to the option '-2D' as mentioned in the last point above, namely '(applied before scale)'. |
|
(OK... forgot to rename the package name that I had on my snippet... anyway:) Attached is the file 'patch_name_v1.patch' for easier inspection. patch_name_v1.patch (3,252 bytes)
diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L index c7ed9ca..cf8c8cd 100644 --- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L +++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -871,6 +871,12 @@ int main(int argc, char *argv[]) "factor", "geometry scaling factor - default is 1" ); + argList::addOption + ( + "2D", + "thickness", + "use when converting a 2-D mesh (applied before scale)" + ); argList::addBoolOption ( "writeSets", @@ -957,22 +963,26 @@ int main(int argc, char *argv[]) // Construct shapes from face lists cellShapeList cellShapes(nCells); - // Extrude 2-D mesh into 3-D - Info<< "dimension of grid: " << dimensionOfGrid << endl; faceList frontAndBackFaces; if (dimensionOfGrid == 2) { - const scalar extrusionFactor = 0.01; + // Extrude 2-D mesh into 3-D, in z-direction - boundBox box(max(points), min(points)); + scalar twoDThickness = 1.0; - const scalar zOffset = extrusionFactor*box.mag(); + if (!args.optionReadIfPresent("2D", twoDThickness)) + { + const scalar extrusionFactor = 0.02; //0.01 in each direction + boundBox box(points); + twoDThickness = extrusionFactor*box.mag(); + } + + Info<< "Grid is 2-D. Extruding in z-direction by: " << twoDThickness + << endl; - // two-dimensional grid. Extrude in z-direction - Info<< "Grid is 2-D. Extruding in z-direction by: " - << 2*zOffset << endl; + const scalar zOffset = twoDThickness / 2; pointField oldPoints = points; diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C index e473bba..0b45118 100644 --- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C +++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) ( "2D", "thickness", - "use when converting a 2-D geometry" + "use when converting a 2-D mesh (applied before scale)" ); argList args(argc, argv); |
|
Thanks Bruno Resolved by commit db69053ef729cca390d431d777587ad5c596aaa5 |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-09-08 06:19 |
|
New Issue | |
2016-09-08 08:18 | henry | Category | Bug => Patch |
2016-09-09 11:39 | MattijsJ | File Added: fluentMeshToFoam.L | |
2017-01-01 21:06 | wyldckat | File Added: patch_name_v1.tar.gz | |
2017-01-01 21:06 | wyldckat | Note Added: 0007579 | |
2017-01-01 21:06 | wyldckat | Assigned To | => henry |
2017-01-01 21:06 | wyldckat | Status | new => assigned |
2017-01-01 21:08 | wyldckat | File Added: patch_name_v1.patch | |
2017-01-01 21:08 | wyldckat | Note Added: 0007580 | |
2017-01-05 16:06 | henry | Status | assigned => resolved |
2017-01-05 16:06 | henry | Resolution | open => fixed |
2017-01-05 16:06 | henry | Fixed in Version | => dev |
2017-01-05 16:06 | henry | Note Added: 0007597 |