Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
HPCAPPs
OpenFOAM-GPU-v2.0
Commits
55e5a777
Commit
55e5a777
authored
Oct 17, 2024
by
shunbo
Browse files
initial commit
parents
Changes
677
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1493 additions
and
0 deletions
+1493
-0
OpenFOAM-v2112/applications/test/fft/Test-fft.C
OpenFOAM-v2112/applications/test/fft/Test-fft.C
+75
-0
OpenFOAM-v2112/applications/test/field1/Make/files
OpenFOAM-v2112/applications/test/field1/Make/files
+3
-0
OpenFOAM-v2112/applications/test/field1/Make/options
OpenFOAM-v2112/applications/test/field1/Make/options
+2
-0
OpenFOAM-v2112/applications/test/field1/Test-field1.C
OpenFOAM-v2112/applications/test/field1/Test-field1.C
+248
-0
OpenFOAM-v2112/applications/test/fieldDependency/Make/files
OpenFOAM-v2112/applications/test/fieldDependency/Make/files
+3
-0
OpenFOAM-v2112/applications/test/fieldDependency/Make/options
...FOAM-v2112/applications/test/fieldDependency/Make/options
+6
-0
OpenFOAM-v2112/applications/test/fieldDependency/Test-fieldDependency.C
.../applications/test/fieldDependency/Test-fieldDependency.C
+104
-0
OpenFOAM-v2112/applications/test/fieldMapping/Make/files
OpenFOAM-v2112/applications/test/fieldMapping/Make/files
+7
-0
OpenFOAM-v2112/applications/test/fieldMapping/Make/options
OpenFOAM-v2112/applications/test/fieldMapping/Make/options
+9
-0
OpenFOAM-v2112/applications/test/fieldMapping/README.txt
OpenFOAM-v2112/applications/test/fieldMapping/README.txt
+8
-0
OpenFOAM-v2112/applications/test/fieldMapping/Test-fieldMapping.C
...-v2112/applications/test/fieldMapping/Test-fieldMapping.C
+337
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/Allrun
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/Allrun
+21
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/constant/manualDecomposition
...ons/test/fieldMapping/pipe1D/constant/manualDecomposition
+424
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/constant/transportProperties
...ons/test/fieldMapping/pipe1D/constant/transportProperties
+21
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/blockMeshDict
...pplications/test/fieldMapping/pipe1D/system/blockMeshDict
+61
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/controlDict
.../applications/test/fieldMapping/pipe1D/system/controlDict
+56
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/fvSchemes
...12/applications/test/fieldMapping/pipe1D/system/fvSchemes
+50
-0
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/fvSolution
...2/applications/test/fieldMapping/pipe1D/system/fvSolution
+46
-0
OpenFOAM-v2112/applications/test/fieldTypes/Make/files
OpenFOAM-v2112/applications/test/fieldTypes/Make/files
+3
-0
OpenFOAM-v2112/applications/test/fieldTypes/Make/options
OpenFOAM-v2112/applications/test/fieldTypes/Make/options
+9
-0
No files found.
Too many changes to show.
To preserve performance only
677 of 677+
files are displayed.
Plain diff
Email patch
OpenFOAM-v2112/applications/test/fft/Test-fft.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Application
Test-fft
Description
Very simple fft tests
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "fft.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using
namespace
Foam
;
// Simple forward transform
tmp
<
complexField
>
forward1D
(
const
tmp
<
complexField
>&
input
)
{
const
label
len
=
input
().
size
();
return
fft
::
forwardTransform
(
input
,
List
<
int
>
({
len
}))
/
len
;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
argList
::
noParallel
();
#include "setRootCase.H"
// Simple ones - http://www.sccon.ca/sccon/fft/fft3.htm
{
complexField
input
(
8
,
Zero
);
input
[
0
]
=
1
;
tmp
<
complexField
>
toutput
=
forward1D
(
input
);
Info
<<
nl
<<
"input = "
<<
input
<<
nl
<<
"output = "
<<
toutput
<<
nl
;
}
{
complexField
input
(
8
,
Zero
);
input
[
1
]
=
1
;
tmp
<
complexField
>
toutput
=
forward1D
(
input
);
Info
<<
nl
<<
"input = "
<<
input
<<
nl
<<
"output = "
<<
toutput
<<
nl
;
}
Info
<<
nl
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/field1/Make/files
0 → 100644
View file @
55e5a777
Test-field1.C
EXE = $(FOAM_USER_APPBIN)/Test-field1
OpenFOAM-v2112/applications/test/field1/Make/options
0 → 100644
View file @
55e5a777
/* EXE_INC = */
/* EXE_LIBS = */
OpenFOAM-v2112/applications/test/field1/Test-field1.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Simple field tests
Test use of Kahan/Neumaier to extend precision for when running SPDP
mode. Conclusion is that it is easier/quicker to run these summation
loops as double precision (i.e. solveScalar).
\*---------------------------------------------------------------------------*/
#include "primitiveFields.H"
#include "IOstreams.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
<
class
Type
,
class
CombineOp
,
class
ResultType
>
void
sumNeumaier
(
const
UList
<
Type
>&
vals
,
const
CombineOp
&
cop
,
ResultType
&
result
)
{
// Neumaier version of Kahan
ResultType
sum
=
Zero
;
ResultType
c
=
Zero
;
for
(
const
Type
&
vali
:
vals
)
{
ResultType
val
;
cop
(
val
,
vali
);
const
ResultType
t
=
sum
+
val
;
for
(
direction
cmpt
=
0
;
cmpt
<
pTraits
<
ResultType
>::
nComponents
;
cmpt
++
)
{
if
(
mag
(
sum
[
cmpt
])
>=
mag
(
val
[
cmpt
]))
{
// If sum is bigger, low-order digits of input[i] are lost.
c
[
cmpt
]
+=
(
sum
[
cmpt
]
-
t
[
cmpt
])
+
val
[
cmpt
];
}
else
{
// Else low-order digits of sum are lost.
c
[
cmpt
]
+=
(
val
[
cmpt
]
-
t
[
cmpt
])
+
sum
[
cmpt
];
}
}
sum
=
t
;
}
result
=
sum
+
c
;
}
template
<
class
CombineOp
,
class
ResultType
>
void
sumNeumaier
(
const
UList
<
scalar
>&
vals
,
const
CombineOp
&
cop
,
ResultType
&
result
)
{
// Neumaier version of Kahan
ResultType
sum
=
Zero
;
ResultType
c
=
Zero
;
for
(
const
scalar
vali
:
vals
)
{
ResultType
val
;
cop
(
val
,
vali
);
const
ResultType
t
=
sum
+
val
;
if
(
mag
(
sum
)
>=
mag
(
val
))
{
// If sum is bigger, low-order digits of input[i] are lost.
c
+=
(
sum
-
t
)
+
val
;
}
else
{
// Else low-order digits of sum are lost.
c
+=
(
val
-
t
)
+
sum
;
}
sum
=
t
;
}
result
=
sum
+
c
;
}
template
<
class
Type
>
Type
mySum
(
const
UList
<
Type
>&
f
)
{
typedef
typename
Foam
::
typeOfSolve
<
Type
>::
type
solveType
;
solveType
Sum
=
Zero
;
if
(
f
.
size
())
{
sumNeumaier
(
f
,
eqOp
<
solveType
>
(),
Sum
);
}
return
Type
(
Sum
);
}
//- The sumSqr always adds only positive numbers. Here there can never be any
// cancellation of truncation errors.
template
<
class
Type
>
typename
outerProduct1
<
Type
>::
type
mySumSqr
(
const
UList
<
Type
>&
f
)
{
typedef
typename
outerProduct1
<
solveScalar
>::
type
prodType
;
prodType
result
=
Zero
;
if
(
f
.
size
())
{
sumNeumaier
(
f
,
eqSqrOp
<
prodType
>
(),
result
);
}
return
result
;
}
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
scalarField
sfield
(
10
,
one
{});
forAll
(
sfield
,
i
)
{
sfield
[
i
]
=
(
i
%
4
)
?
i
:
0
;
}
Info
<<
"scalarField: "
<<
sfield
<<
nl
;
sfield
.
negate
();
Info
<<
"negated: "
<<
sfield
<<
nl
;
// Does not compile (ambiguous)
// boolField lfield(10, one{});
boolField
lfield
(
10
,
true
);
forAll
(
lfield
,
i
)
{
lfield
[
i
]
=
(
i
%
4
)
?
i
:
0
;
}
Info
<<
"boolField: "
<<
lfield
<<
nl
;
lfield
.
negate
();
Info
<<
"negated: "
<<
lfield
<<
nl
;
// Summation (compile in SPDP)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pout
.
precision
(
16
);
Sout
.
precision
(
16
);
const
scalar
SMALLS
(
1e-6
);
const
scalar
GREATS
(
1e6
);
// scalarField summation
{
scalarField
sfield
(
10
,
SMALLS
);
sfield
[
8
]
=
GREATS
;
sfield
[
9
]
=
-
sfield
[
8
];
Info
<<
"scalarField:"
<<
sfield
.
size
()
<<
nl
<<
" sum :"
<<
sum
(
sfield
)
<<
nl
<<
" corrected:"
<<
mySum
(
sfield
)
<<
endl
;
}
// vectorField summation
{
vectorField
vfield
(
10
,
vector
::
uniform
(
SMALLS
));
vfield
[
8
]
=
vector
::
uniform
(
GREATS
);
vfield
[
9
]
=
-
vfield
[
8
];
Info
<<
"vectorField:"
<<
vfield
.
size
()
<<
nl
<<
" sum :"
<<
sum
(
vfield
)
<<
nl
<<
" corrected:"
<<
mySum
(
vfield
)
<<
endl
;
}
// sphericalTensorField summation
{
sphericalTensorField
tfield
(
10
,
sphericalTensor
(
SMALLS
));
tfield
[
8
]
=
sphericalTensor
(
GREATS
);
tfield
[
9
]
=
-
tfield
[
8
];
Info
<<
"sphericalTensorField:"
<<
tfield
.
size
()
<<
nl
<<
" sum :"
<<
sum
(
tfield
)
<<
nl
<<
" corrected:"
<<
mySum
(
tfield
)
<<
endl
;
}
// symmTensorField summation
{
symmTensorField
tfield
(
10
,
SMALLS
*
symmTensor
::
I
);
tfield
[
8
]
=
GREATS
*
symmTensor
::
I
;
tfield
[
9
]
=
-
tfield
[
8
];
Info
<<
"symmTensorField:"
<<
tfield
.
size
()
<<
nl
<<
" sum :"
<<
sum
(
tfield
)
<<
nl
<<
" corrected:"
<<
mySum
(
tfield
)
<<
endl
;
}
// tensorField summation
{
tensorField
tfield
(
10
,
SMALLS
*
tensor
::
I
);
tfield
[
8
]
=
GREATS
*
tensor
::
I
;
tfield
[
9
]
=
-
tfield
[
8
];
Info
<<
"tensorField:"
<<
tfield
.
size
()
<<
nl
<<
" sum :"
<<
sum
(
tfield
)
<<
nl
<<
" corrected:"
<<
mySum
(
tfield
)
<<
endl
;
}
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldDependency/Make/files
0 → 100644
View file @
55e5a777
Test-fieldDependency.C
EXE = $(FOAM_USER_APPBIN)/Test-fieldDependency
OpenFOAM-v2112/applications/test/fieldDependency/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume
OpenFOAM-v2112/applications/test/fieldDependency/Test-fieldDependency.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Test field dependencies.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "volFields.H"
#include "fvCFD.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
Info
<<
"Creating field T
\n
"
<<
endl
;
volScalarField
T
(
IOobject
(
"T"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
)
);
Info
<<
"Creating field p
\n
"
<<
endl
;
volScalarField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
dimless
,
Zero
)
);
Info
<<
"p.eventNo:"
<<
p
.
eventNo
()
<<
endl
;
Info
<<
"p.uptodate:"
<<
p
.
upToDate
(
T
)
<<
endl
;
// Change T and mark as uptodate.
Info
<<
"Changing T"
<<
endl
;
T
=
0
.
0
;
T
.
setUpToDate
();
Info
<<
"T.eventNo:"
<<
T
.
eventNo
()
<<
endl
;
// Check p dependency:
Info
<<
"p.uptodate:"
<<
p
.
upToDate
(
T
)
<<
endl
;
// Change p and mark as uptodate.
Info
<<
"Changing p."
<<
endl
;
p
.
setUpToDate
();
Info
<<
"p.uptodate:"
<<
p
.
upToDate
(
T
)
<<
endl
;
Info
<<
"p.eventNo:"
<<
p
.
eventNo
()
<<
endl
;
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/Make/files
0 → 100644
View file @
55e5a777
/*
fvMeshGeometry.C
fvMesh.C
*/
Test-fieldMapping.C
EXE = $(FOAM_USER_APPBIN)/Test-fieldMapping
OpenFOAM-v2112/applications/test/fieldMapping/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-DFULLDEBUG -g -O0 \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh
OpenFOAM-v2112/applications/test/fieldMapping/README.txt
0 → 100644
View file @
55e5a777
Test application for volField and surfaceField mapping with topology
changes.
Run
pipe1D/Allrun
to compile and map a few fields
OpenFOAM-v2112/applications/test/fieldMapping/Test-fieldMapping.C
0 → 100644
View file @
55e5a777
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-fieldMapping
Description
Test app for mapping of fields.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "fvMesh.H"
#include "volFields.H"
#include "Time.H"
#include "OFstream.H"
#include "meshTools.H"
#include "removeFaces.H"
#include "mapPolyMesh.H"
#include "polyTopoChange.H"
#include "fvCFD.H"
#include "zeroGradientFvPatchFields.H"
#include "Random.H"
using
namespace
Foam
;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool
notEqual
(
const
scalar
s1
,
const
scalar
s2
,
const
scalar
tol
)
{
return
mag
(
s1
-
s2
)
>
tol
;
}
// Main program:
int
main
(
int
argc
,
char
*
argv
[])
{
#include "addTimeOptions.H"
argList
::
addArgument
(
"inflate (true|false)"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
const
Switch
inflate
(
args
[
1
]);
if
(
inflate
)
{
Info
<<
"Deleting cells using inflation/deflation"
<<
nl
<<
endl
;
}
else
{
Info
<<
"Deleting cells, introducing points at new position"
<<
nl
<<
endl
;
}
Random
rndGen
(
0
);
// Test mapping
// ------------
// Mapping is volume averaged
// 1. uniform field stays uniform
volScalarField
one
(
IOobject
(
"one"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
"one"
,
dimless
,
1
.
0
),
zeroGradientFvPatchScalarField
::
typeName
);
Info
<<
"Writing one field "
<<
one
.
name
()
<<
" in "
<<
runTime
.
timeName
()
<<
endl
;
one
.
write
();
// 2. linear profile gets preserved
volScalarField
ccX
(
IOobject
(
"ccX"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
.
C
().
component
(
0
)
);
Info
<<
"Writing x component of cell centres to "
<<
ccX
.
name
()
<<
" in "
<<
runTime
.
timeName
()
<<
endl
;
ccX
.
write
();
// Uniform surface field
surfaceScalarField
surfaceOne
(
IOobject
(
"surfaceOne"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
mesh
,
dimensionedScalar
(
"one"
,
dimless
,
1
.
0
),
calculatedFvsPatchScalarField
::
typeName
);
Info
<<
"Writing surface one field "
<<
surfaceOne
.
name
()
<<
" in "
<<
runTime
.
timeName
()
<<
endl
;
surfaceOne
.
write
();
// Force allocation of V. Important for any mesh changes since otherwise
// old time volumes are not stored
const
scalar
totalVol
=
gSum
(
mesh
.
V
());
// Face removal engine. No checking for not merging boundary faces.
removeFaces
faceRemover
(
mesh
,
GREAT
);
while
(
runTime
.
loop
())
{
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
if
(
!
mesh
.
nInternalFaces
())
{
break
;
}
// Remove face
label
candidateFacei
=
rndGen
.
position
<
label
>
(
0
,
mesh
.
nInternalFaces
()
-
1
);
Info
<<
"Wanting to delete face "
<<
mesh
.
faceCentres
()[
candidateFacei
]
<<
nl
<<
endl
;
labelList
candidates
(
1
,
candidateFacei
);
// Get compatible set of faces and connected sets of cells.
labelList
cellRegion
;
labelList
cellRegionMaster
;
labelList
facesToRemove
;
faceRemover
.
compatibleRemoves
(
candidates
,
cellRegion
,
cellRegionMaster
,
facesToRemove
);
// Topo changes container
polyTopoChange
meshMod
(
mesh
);
// Insert mesh refinement into polyTopoChange.
faceRemover
.
setRefinement
(
facesToRemove
,
cellRegion
,
cellRegionMaster
,
meshMod
);
// Change mesh and inflate
Info
<<
"Actually changing mesh"
<<
nl
<<
endl
;
autoPtr
<
mapPolyMesh
>
morphMap
=
meshMod
.
changeMesh
(
mesh
,
inflate
);
Info
<<
"Mapping fields"
<<
nl
<<
endl
;
mesh
.
updateMesh
(
morphMap
());
// Move mesh (since morphing does not do this)
if
(
morphMap
().
hasMotionPoints
())
{
Info
<<
"Moving mesh"
<<
nl
<<
endl
;
mesh
.
movePoints
(
morphMap
().
preMotionPoints
());
}
// Update numbering of cells/vertices.
faceRemover
.
updateMesh
(
morphMap
());
Info
<<
"Writing fields"
<<
nl
<<
endl
;
runTime
.
write
();
// Check mesh volume conservation
if
(
mesh
.
moving
())
{
#include "volContinuity.H"
}
else
{
if
(
mesh
.
V
().
size
()
!=
mesh
.
nCells
())
{
FatalErrorInFunction
<<
"Volume not mapped. V:"
<<
mesh
.
V
().
size
()
<<
" nCells:"
<<
mesh
.
nCells
()
<<
exit
(
FatalError
);
}
const
scalar
newVol
=
gSum
(
mesh
.
V
());
Info
<<
"Initial volume = "
<<
totalVol
<<
" New volume = "
<<
newVol
<<
endl
;
if
(
mag
(
newVol
-
totalVol
)
/
totalVol
>
1e-10
)
{
FatalErrorInFunction
<<
"Volume loss: old volume:"
<<
totalVol
<<
" new volume:"
<<
newVol
<<
exit
(
FatalError
);
}
else
{
Info
<<
"Volume check OK"
<<
nl
<<
endl
;
}
}
// Check constant profile
{
const
scalar
max
=
gMax
(
one
);
const
scalar
min
=
gMin
(
one
);
Info
<<
"Uniform one field min = "
<<
min
<<
" max = "
<<
max
<<
endl
;
if
(
notEqual
(
max
,
1
.
0
,
1e-10
)
||
notEqual
(
min
,
1
.
0
,
1e-10
))
{
FatalErrorInFunction
<<
"Uniform volVectorField not preserved."
<<
" Min and max should both be 1.0. min:"
<<
min
<<
" max:"
<<
max
<<
exit
(
FatalError
);
}
else
{
Info
<<
"Uniform field mapping check OK"
<<
nl
<<
endl
;
}
}
// Check linear profile
{
const
scalarField
diff
=
ccX
-
mesh
.
C
().
component
(
0
);
const
scalar
max
=
gMax
(
diff
);
const
scalar
min
=
gMin
(
diff
);
Info
<<
"Linear profile field min = "
<<
min
<<
" max = "
<<
max
<<
endl
;
if
(
notEqual
(
max
,
0
.
0
,
1e-10
)
||
notEqual
(
min
,
0
.
0
,
1e-10
))
{
FatalErrorInFunction
<<
"Linear profile not preserved."
<<
" Min and max should both be 0.0. min:"
<<
min
<<
" max:"
<<
max
<<
exit
(
FatalError
);
}
else
{
Info
<<
"Linear profile mapping check OK"
<<
nl
<<
endl
;
}
}
// Check face field mapping
if
(
surfaceOne
.
size
())
{
const
scalar
max
=
gMax
(
surfaceOne
.
primitiveField
());
const
scalar
min
=
gMin
(
surfaceOne
.
primitiveField
());
Info
<<
"Uniform surface field min = "
<<
min
<<
" max = "
<<
max
<<
endl
;
if
(
notEqual
(
max
,
1
.
0
,
1e-10
)
||
notEqual
(
min
,
1
.
0
,
1e-10
))
{
FatalErrorInFunction
<<
"Uniform surfaceScalarField not preserved."
<<
" Min and max should both be 1.0. min:"
<<
min
<<
" max:"
<<
max
<<
exit
(
FatalError
);
}
else
{
Info
<<
"Uniform surfaceScalarField mapping check OK"
<<
nl
<<
endl
;
}
}
runTime
.
printExecutionTime
(
Info
);
}
Info
<<
"End
\n
"
<<
endl
;
return
0
;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/Allrun
0 → 100644
View file @
55e5a777
#!/bin/sh
cd
"
${
0
%/*
}
"
||
exit
# Run from this directory
.
${
WM_PROJECT_DIR
:?
}
/bin/tools/RunFunctions
# Tutorial run functions
#------------------------------------------------------------------------------
application
=
Test-fieldMapping
# Compile
wmake ..
runApplication blockMesh
# Run with inflation
runApplication
$application
true
mv
"log.
$application
"
"log.
$application
-inflate"
# Run without inflation
runApplication
$application
false
#------------------------------------------------------------------------------
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/constant/manualDecomposition
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class labelList;
location "constant";
object cellDecomposition;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
400
(
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
)
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/constant/transportProperties
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
nu nu [ 0 2 -1 0 0 0 0 ] 0.01;
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/blockMeshDict
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(0 0 0)
(1 0 0)
(1 0.1 0)
(0 0.1 0)
(0 0 0.1)
(1 0 0.1)
(1 0.1 0.1)
(0 0.1 0.1)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 1 1) simpleGrading (10 1 1)
);
edges
(
);
boundary
(
inlet
{
type patch;
faces
(
(0 4 7 3)
);
}
outlet
{
type patch;
faces
(
(2 6 5 1)
);
}
);
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/controlDict
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DebugSwitches
{
// primitiveMesh 1;
// polyMesh 1;
// fvMesh 1;
}
application Test-fieldMapping;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 100;
deltaT 1;
writeControl timeStep;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 10;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/fvSchemes
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
grad(p) Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss linear;
}
laplacianSchemes
{
default Gauss linear orthogonal;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default orthogonal;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldMapping/pipe1D/system/fvSolution
0 → 100644
View file @
55e5a777
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
}
U
{
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
// ************************************************************************* //
OpenFOAM-v2112/applications/test/fieldTypes/Make/files
0 → 100644
View file @
55e5a777
Test-fieldTypes.C
EXE = $(FOAM_USER_APPBIN)/Test-fieldTypes
OpenFOAM-v2112/applications/test/fieldTypes/Make/options
0 → 100644
View file @
55e5a777
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I${LIB_SRC}/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
EXE_LIBS = \
-lfiniteArea \
-lfiniteVolume \
-lmeshTools
Prev
1
…
24
25
26
27
28
29
30
31
32
…
34
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment