mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: allow datToFoam writing points dict directly
- refactors the corresponding tutorial by removing redundant files and items:
compressible/rhoCentralFoam/biconic25-55Run35
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -87,23 +88,23 @@ int main(int argc, char *argv[])
|
||||
Istring >> block;
|
||||
Istring >> jPoints;
|
||||
|
||||
Info<< "Number of vertices in i direction = " << iPoints << endl
|
||||
Info<< "Number of vertices in i direction = " << iPoints << nl
|
||||
<< "Number of vertices in j direction = " << jPoints << endl;
|
||||
|
||||
// We ignore the first layer of points in i and j the biconic meshes
|
||||
label nPointsij = (iPoints - 1)*(jPoints - 1);
|
||||
const label nPointsij = (iPoints - 1)*(jPoints - 1);
|
||||
|
||||
pointField points(nPointsij, Zero);
|
||||
|
||||
for (direction comp = 0; comp < 2; comp++)
|
||||
for (direction comp = 0; comp < 2; ++comp)
|
||||
{
|
||||
label p(0);
|
||||
label p = 0;
|
||||
|
||||
for (label j = 0; j < jPoints; j++)
|
||||
for (label j = 0; j < jPoints; ++j)
|
||||
{
|
||||
for (label i = 0; i < iPoints; i++)
|
||||
for (label i = 0; i < iPoints; ++i)
|
||||
{
|
||||
double coord;
|
||||
scalar coord;
|
||||
plot3dFile >> coord;
|
||||
|
||||
// if statement ignores the first layer in i and j
|
||||
@ -126,12 +127,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
pointField pointsWedge(nPointsij*2, Zero);
|
||||
|
||||
fileName pointsFile(runTime.constantPath()/"points.tmp");
|
||||
OFstream pFile(pointsFile);
|
||||
|
||||
const scalar a = degToRad(0.1);
|
||||
tensor rotateZ =
|
||||
tensor
|
||||
const tensor rotateZ
|
||||
(
|
||||
1.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0,
|
||||
@ -141,16 +138,26 @@ int main(int argc, char *argv[])
|
||||
forAll(points, i)
|
||||
{
|
||||
pointsWedge[i] = (rotateZ & points[i]);
|
||||
pointsWedge[i+nPointsij] = cmptMultiply
|
||||
pointsWedge[i + nPointsij] =
|
||||
cmptMultiply
|
||||
(
|
||||
vector(1.0, 1.0, -1.0),
|
||||
pointsWedge[i]
|
||||
);
|
||||
}
|
||||
|
||||
const fileName polyMeshPath(runTime.constantPath()/"polyMesh");
|
||||
const fileName pointsFile(polyMeshPath/"points");
|
||||
OFstream pFile(pointsFile);
|
||||
if (!exists(polyMeshPath)) mkDir(polyMeshPath);
|
||||
|
||||
Info<< "Writing points to: " << nl
|
||||
<< " " << pointsFile << endl;
|
||||
|
||||
runTime.writeHeader(pFile, "vectorField");
|
||||
pFile << pointsWedge;
|
||||
runTime.writeEndDivider(pFile);
|
||||
|
||||
|
||||
Info<< "End" << endl;
|
||||
|
||||
|
||||
@ -5,5 +5,6 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
cleanCase
|
||||
cleanSamples
|
||||
rm -rf 0/pointPriority
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -4,17 +4,12 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication datToFoam grid256.dat
|
||||
|
||||
CONST="constant"
|
||||
cat $CONST/pointsHeader $CONST/points.tmp > $CONST/polyMesh/points
|
||||
runApplication collapseEdges -overwrite
|
||||
|
||||
echo "Changing patch type to wedge type in boundary file"
|
||||
mv $CONST/polyMesh/boundary $CONST/polyMesh/boundary.bak
|
||||
sed -f $CONST/wedgeScr $CONST/polyMesh/boundary.bak > $CONST/polyMesh/boundary
|
||||
rm $CONST/polyMesh/boundary.bak
|
||||
echo "Overwriting 'patch' type as 'wedge' type in 'boundary' dictionary"
|
||||
sed -if '/wedge1/,/nFaces/{s/patch/wedge/};/wedge2/,/nFaces/{s/patch/wedge/}'\
|
||||
constant/polyMesh/boundary
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v1912 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class vectorField;
|
||||
object points;
|
||||
}
|
||||
@ -37,8 +37,26 @@ mixture
|
||||
Tlow 100;
|
||||
Thigh 10000;
|
||||
Tcommon 1000;
|
||||
highCpCoeffs ( 2.9525407 0.0013968838 -4.9262577e-07 7.8600091e-11 -4.6074978e-15 -923.93753 5.8718221 );
|
||||
lowCpCoeffs ( 3.5309628 -0.0001236595 -5.0299339e-07 2.4352768e-09 -1.4087954e-12 -1046.9637 2.9674391 );
|
||||
highCpCoeffs
|
||||
(
|
||||
2.9525407
|
||||
0.0013968838
|
||||
-4.9262577e-07
|
||||
7.8600091e-11
|
||||
-4.6074978e-15
|
||||
-923.93753
|
||||
5.8718221
|
||||
);
|
||||
lowCpCoeffs
|
||||
(
|
||||
3.5309628
|
||||
-0.0001236595
|
||||
-5.0299339e-07
|
||||
2.4352768e-09
|
||||
-1.4087954e-12
|
||||
-1046.9637
|
||||
2.9674391
|
||||
);
|
||||
}
|
||||
transport
|
||||
{
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
/wedge1/,/nFaces/{
|
||||
s/patch/wedge/
|
||||
}
|
||||
/wedge2/,/nFaces/{
|
||||
s/patch/wedge/
|
||||
}
|
||||
@ -31,7 +31,7 @@ writeControl adjustable;
|
||||
|
||||
writeInterval 5e-5;
|
||||
|
||||
cycleWrite 0;
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat binary;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user