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
Development
openfoam
Commits
b4f78778
Commit
b4f78778
authored
Oct 13, 2015
by
mattijs
Browse files
ENH: fvMeshAdd: support dimensionedFields
parent
64d066a4
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/dynamicMesh/fvMeshAdder/fvMeshAdder.C
View file @
b4f78778
...
...
@@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
\\ / A nd | Copyright (C) 2011
-2014
OpenFOAM Foundation
\\/ M anipulation |
Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -28,6 +28,14 @@ License
#include "faceCoupleInfo.H"
#include "fvMesh.H"
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
namespace
Foam
{
defineTypeNameAndDebug
(
fvMeshAdder
,
0
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
//- Calculate map from new patch faces to old patch faces. -1 where
...
...
@@ -108,6 +116,12 @@ Foam::autoPtr<Foam::mapAddedPolyMesh> Foam::fvMeshAdder::add
fvMeshAdder
::
MapSurfaceFields
<
symmTensor
>
(
mapPtr
,
mesh0
,
mesh1
);
fvMeshAdder
::
MapSurfaceFields
<
tensor
>
(
mapPtr
,
mesh0
,
mesh1
);
fvMeshAdder
::
MapDimFields
<
scalar
>
(
mapPtr
,
mesh0
,
mesh1
);
fvMeshAdder
::
MapDimFields
<
vector
>
(
mapPtr
,
mesh0
,
mesh1
);
fvMeshAdder
::
MapDimFields
<
sphericalTensor
>
(
mapPtr
,
mesh0
,
mesh1
);
fvMeshAdder
::
MapDimFields
<
symmTensor
>
(
mapPtr
,
mesh0
,
mesh1
);
fvMeshAdder
::
MapDimFields
<
tensor
>
(
mapPtr
,
mesh0
,
mesh1
);
return
mapPtr
;
}
...
...
src/dynamicMesh/fvMeshAdder/fvMeshAdder.H
View file @
b4f78778
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation |
Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -26,7 +26,7 @@ Class
Description
Adds two fvMeshes without using any polyMesh morphing.
Uses
fv
MeshAdder.
Uses
poly
MeshAdder.
SourceFiles
fvMeshAdder.C
...
...
@@ -42,6 +42,7 @@ SourceFiles
#include "fvPatchFieldsFwd.H"
#include "fvsPatchFieldsFwd.H"
#include "fvPatchFieldMapper.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -101,8 +102,22 @@ private:
const
GeometricField
<
Type
,
fvsPatchField
,
surfaceMesh
>&
fldToAdd
);
//- Update single dimensionedField.
template
<
class
Type
>
static
void
MapDimField
(
const
mapAddedPolyMesh
&
meshMap
,
DimensionedField
<
Type
,
volMesh
>&
fld
,
const
DimensionedField
<
Type
,
volMesh
>&
fldToAdd
);
public:
// Declare name of the class and its debug switch
ClassName
(
"fvMeshAdder"
);
// Member Functions
//- Inplace add mesh to fvMesh. Maps all stored fields. Returns map.
...
...
@@ -131,6 +146,15 @@ public:
const
fvMesh
&
mesh
,
const
fvMesh
&
meshToAdd
);
//- Map all DimensionedFields of Type
template
<
class
Type
>
static
void
MapDimFields
(
const
mapAddedPolyMesh
&
,
const
fvMesh
&
mesh
,
const
fvMesh
&
meshToAdd
);
};
...
...
src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C
View file @
b4f78778
...
...
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation |
Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
...
...
@@ -280,6 +280,12 @@ void Foam::fvMeshAdder::MapVolFields
++
fieldIter
)
{
if
(
debug
)
{
Pout
<<
"MapVolFields : Storing old time for "
<<
fieldIter
()
->
name
()
<<
endl
;
}
const_cast
<
GeometricField
<
Type
,
fvPatchField
,
volMesh
>*>
(
fieldIter
())
->
storeOldTimes
();
}
...
...
@@ -304,6 +310,12 @@ void Foam::fvMeshAdder::MapVolFields
const
GeometricField
<
Type
,
fvPatchField
,
volMesh
>&
fldToAdd
=
*
fieldsToAdd
[
fld
.
name
()];
if
(
debug
)
{
Pout
<<
"MapVolFields : mapping "
<<
fld
.
name
()
<<
" and "
<<
fldToAdd
.
name
()
<<
endl
;
}
MapVolField
<
Type
>
(
meshMap
,
fld
,
fldToAdd
);
}
else
...
...
@@ -585,8 +597,13 @@ void Foam::fvMeshAdder::MapSurfaceFields
++
fieldIter
)
{
const_cast
<
fldType
*>
(
fieldIter
())
->
storeOldTimes
();
if
(
debug
)
{
Pout
<<
"MapSurfaceFields : Storing old time for "
<<
fieldIter
()
->
name
()
<<
endl
;
}
const_cast
<
fldType
*>
(
fieldIter
())
->
storeOldTimes
();
}
...
...
@@ -604,6 +621,12 @@ void Foam::fvMeshAdder::MapSurfaceFields
{
const
fldType
&
fldToAdd
=
*
fieldsToAdd
[
fld
.
name
()];
if
(
debug
)
{
Pout
<<
"MapSurfaceFields : mapping "
<<
fld
.
name
()
<<
" and "
<<
fldToAdd
.
name
()
<<
endl
;
}
MapSurfaceField
<
Type
>
(
meshMap
,
fld
,
fldToAdd
);
}
else
...
...
@@ -617,4 +640,80 @@ void Foam::fvMeshAdder::MapSurfaceFields
}
template
<
class
Type
>
void
Foam
::
fvMeshAdder
::
MapDimField
(
const
mapAddedPolyMesh
&
meshMap
,
DimensionedField
<
Type
,
volMesh
>&
fld
,
const
DimensionedField
<
Type
,
volMesh
>&
fldToAdd
)
{
const
fvMesh
&
mesh
=
fld
.
mesh
();
// Store old field
Field
<
Type
>
oldField
(
fld
);
fld
.
setSize
(
mesh
.
nCells
());
fld
.
rmap
(
oldField
,
meshMap
.
oldCellMap
());
fld
.
rmap
(
fldToAdd
,
meshMap
.
addedCellMap
());
}
template
<
class
Type
>
void
Foam
::
fvMeshAdder
::
MapDimFields
(
const
mapAddedPolyMesh
&
meshMap
,
const
fvMesh
&
mesh
,
const
fvMesh
&
meshToAdd
)
{
typedef
DimensionedField
<
Type
,
volMesh
>
fldType
;
// Note: use strict flag on lookupClass to avoid picking up
// volFields
HashTable
<
const
fldType
*>
fields
(
mesh
.
objectRegistry
::
lookupClass
<
fldType
>
(
true
)
);
HashTable
<
const
fldType
*>
fieldsToAdd
(
meshToAdd
.
objectRegistry
::
lookupClass
<
fldType
>
(
true
)
);
for
(
typename
HashTable
<
const
fldType
*>::
iterator
fieldIter
=
fields
.
begin
();
fieldIter
!=
fields
.
end
();
++
fieldIter
)
{
fldType
&
fld
=
const_cast
<
fldType
&>
(
*
fieldIter
());
if
(
fieldsToAdd
.
found
(
fld
.
name
()))
{
const
fldType
&
fldToAdd
=
*
fieldsToAdd
[
fld
.
name
()];
if
(
debug
)
{
Pout
<<
"MapDimFields : mapping "
<<
fld
.
name
()
<<
" and "
<<
fldToAdd
.
name
()
<<
endl
;
}
MapDimField
<
Type
>
(
meshMap
,
fld
,
fldToAdd
);
}
else
{
WarningIn
(
"fvMeshAdder::MapDimFields(..)"
)
<<
"Not mapping field "
<<
fld
.
name
()
<<
" since not present on mesh to add"
<<
endl
;
}
}
}
// ************************************************************************* //
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