Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
c42f04e8
Commit
c42f04e8
authored
Apr 16, 2009
by
mattijs
Browse files
multi-region directMapped
parent
485ea4c8
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
applications/solvers/heatTransfer/chtMultiRegionFoam/derivedFvPatchFields/solidWallMixedTemperatureCoupled/solidWallMixedTemperatureCoupledFvPatchScalarField.H
View file @
c42f04e8
...
...
@@ -103,8 +103,8 @@ public:
const
dictionary
&
);
//- Construct by mapping given
solidWallMixedTemperatureCoupledFvPatchScalarField
// onto a new patch
//- Construct by mapping given
//
solidWallMixedTemperatureCoupledFvPatchScalarField
onto a new patch
solidWallMixedTemperatureCoupledFvPatchScalarField
(
const
solidWallMixedTemperatureCoupledFvPatchScalarField
&
,
...
...
etc/controlDict
View file @
c42f04e8
...
...
@@ -360,7 +360,7 @@ DebugSwitches
diagonal 0;
dictionary 0;
dimensionSet 1;
directMapped
0;
directMapped
Base
0;
directMappedPatch 0;
directMappedVelocityFlux 0;
directionMixed 0;
...
...
src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H
View file @
c42f04e8
...
...
@@ -131,18 +131,36 @@ public:
return
constructSize_
;
}
//- Constructed data size
label
&
constructSize
()
{
return
constructSize_
;
}
//- From subsetted data back to original data
const
labelListList
&
subMap
()
const
{
return
subMap_
;
}
//- From subsetted data back to original data
labelListList
&
subMap
()
{
return
subMap_
;
}
//- From subsetted data to new reconstructed data
const
labelListList
&
constructMap
()
const
{
return
constructMap_
;
}
//- From subsetted data to new reconstructed data
labelListList
&
constructMap
()
{
return
constructMap_
;
}
//- Calculate a schedule. See above.
static
List
<
labelPair
>
schedule
(
...
...
src/finiteVolume/Make/files
View file @
c42f04e8
...
...
@@ -24,6 +24,7 @@ $(constraintFvPatches)/processor/processorFvPatch.C
derivedFvPatches = $(fvPatches)/derived
$(derivedFvPatches)/wall/wallFvPatch.C
$(derivedFvPatches)/directMapped/directMappedFvPatch.C
$(derivedFvPatches)/directMapped/directMappedWallFvPatch.C
wallDist = fvMesh/wallDist
$(wallDist)/wallPointYPlus/wallPointYPlus.C
...
...
src/finiteVolume/fields/fvPatchFields/derived/directMappedFixedValue/directMappedFixedValueFvPatchField.C
View file @
c42f04e8
...
...
@@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include
"directMappedFixedValueFvPatchField.H"
#include
"directMapped
Fv
Patch.H"
#include
"directMappedPatch
Base
.H"
#include
"volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
@@ -61,7 +61,7 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
setAverage_
(
ptf
.
setAverage_
),
average_
(
ptf
.
average_
)
{
if
(
!
is
Type
<
directMapped
Fv
Patch
>
(
this
->
patch
()))
if
(
!
is
A
<
directMappedPatch
Base
>
(
this
->
patch
()
.
patch
()
))
{
FatalErrorIn
(
...
...
@@ -74,7 +74,7 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
" const fvPatchFieldMapper&
\n
"
")
\n
"
)
<<
"
\n
patch type '"
<<
p
.
type
()
<<
"' not type '"
<<
typeName
<<
"'"
<<
"' not type '"
<<
directMappedPatchBase
::
typeName
<<
"'"
<<
"
\n
for patch "
<<
p
.
name
()
<<
" of field "
<<
this
->
dimensionedInternalField
().
name
()
<<
" in file "
<<
this
->
dimensionedInternalField
().
objectPath
()
...
...
@@ -95,7 +95,7 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
setAverage_
(
readBool
(
dict
.
lookup
(
"setAverage"
))),
average_
(
pTraits
<
Type
>
(
dict
.
lookup
(
"average"
)))
{
if
(
!
is
Type
<
directMapped
Fv
Patch
>
(
this
->
patch
()))
if
(
!
is
A
<
directMappedPatch
Base
>
(
this
->
patch
()
.
patch
()
))
{
FatalErrorIn
(
...
...
@@ -107,12 +107,19 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
" const dictionary& dict
\n
"
")
\n
"
)
<<
"
\n
patch type '"
<<
p
.
type
()
<<
"' not type '"
<<
typeName
<<
"'"
<<
"' not type '"
<<
directMappedPatchBase
::
typeName
<<
"'"
<<
"
\n
for patch "
<<
p
.
name
()
<<
" of field "
<<
this
->
dimensionedInternalField
().
name
()
<<
" in file "
<<
this
->
dimensionedInternalField
().
objectPath
()
<<
exit
(
FatalError
);
}
// Force calculation of schedule (uses parallel comms)
const
directMappedPatchBase
&
mpp
=
refCast
<
const
directMappedPatchBase
>
(
this
->
patch
().
patch
()
);
(
void
)
mpp
.
map
().
schedule
();
}
...
...
@@ -143,70 +150,6 @@ directMappedFixedValueFvPatchField<Type>::directMappedFixedValueFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
<
class
Type
>
void
directMappedFixedValueFvPatchField
<
Type
>::
getNewValues
(
const
directMappedPolyPatch
&
mpp
,
const
Field
<
Type
>&
sendValues
,
Field
<
Type
>&
newValues
)
const
{
// Get the scheduling information
const
List
<
labelPair
>&
schedule
=
mpp
.
schedule
();
const
labelListList
&
sendLabels
=
mpp
.
sendLabels
();
const
labelListList
&
receiveFaceLabels
=
mpp
.
receiveFaceLabels
();
forAll
(
schedule
,
i
)
{
const
labelPair
&
twoProcs
=
schedule
[
i
];
label
sendProc
=
twoProcs
[
0
];
label
recvProc
=
twoProcs
[
1
];
if
(
Pstream
::
myProcNo
()
==
sendProc
)
{
OPstream
toProc
(
Pstream
::
scheduled
,
recvProc
);
toProc
<<
UIndirectList
<
Type
>
(
sendValues
,
sendLabels
[
recvProc
])();
}
else
{
// I am receiver. Receive from sendProc.
IPstream
fromProc
(
Pstream
::
scheduled
,
sendProc
);
Field
<
Type
>
fromFld
(
fromProc
);
// Destination faces
const
labelList
&
faceLabels
=
receiveFaceLabels
[
sendProc
];
forAll
(
fromFld
,
i
)
{
label
patchFaceI
=
faceLabels
[
i
];
newValues
[
patchFaceI
]
=
fromFld
[
i
];
}
}
}
// Do data from myself
{
UIndirectList
<
Type
>
fromFld
(
sendValues
,
sendLabels
[
Pstream
::
myProcNo
()]
);
// Destination faces
const
labelList
&
faceLabels
=
receiveFaceLabels
[
Pstream
::
myProcNo
()];
forAll
(
fromFld
,
i
)
{
label
patchFaceI
=
faceLabels
[
i
];
newValues
[
patchFaceI
]
=
fromFld
[
i
];
}
}
}
template
<
class
Type
>
void
directMappedFixedValueFvPatchField
<
Type
>::
updateCoeffs
()
{
...
...
@@ -215,65 +158,94 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
return
;
}
// Get the directMappedPolyPatch
const
directMappedPolyPatch
&
mpp
=
refCast
<
const
directMappedPolyPatch
>
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
fieldType
;
// Get the scheduling information from the directMappedPatchBase
const
directMappedPatchBase
&
mpp
=
refCast
<
const
directMappedPatchBase
>
(
directMappedFixedValueFvPatchField
<
Type
>::
patch
().
patch
()
);
const
mapDistribute
&
distMap
=
mpp
.
map
();
const
fvMesh
&
nbrMesh
=
refCast
<
const
fvMesh
>
(
mpp
.
sampleMesh
());
const
word
&
fldName
=
this
->
dimensionedInternalField
().
name
();
Field
<
Type
>
newValues
(
this
->
size
());
// Result of obtaining remote values
Field
<
Type
>
newValues
;
switch
(
mpp
.
mode
())
{
case
directMappedP
olyP
atch
:
:
NEARESTCELL
:
case
directMappedPatch
Base
:
:
NEARESTCELL
:
{
getNewValues
(
mpp
,
this
->
internalField
(),
newValues
);
if
(
mpp
.
sameRegion
())
{
newValues
=
this
->
internalField
();
}
else
{
newValues
=
nbrMesh
.
lookupObject
<
fieldType
>
(
fldName
).
internalField
();
}
mapDistribute
::
distribute
(
Pstream
::
defaultCommsType
,
distMap
.
schedule
(),
distMap
.
constructSize
(),
distMap
.
subMap
(),
distMap
.
constructMap
(),
newValues
);
break
;
}
case
directMappedP
olyP
atch
:
:
NEARESTPATCHFACE
:
case
directMappedPatch
Base
:
:
NEARESTPATCHFACE
:
{
const
label
patchID
=
this
->
patch
().
patch
().
boundaryMesh
().
findPatchID
(
mpp
.
samplePatch
()
);
if
(
patchID
<
0
)
const
label
nbrPatchID
=
nbrMesh
.
boundaryMesh
().
findPatchID
(
mpp
.
samplePatch
()
);
if
(
nbrPatchID
<
0
)
{
FatalErrorIn
(
"void directMappedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
)
<<
"Unable to find sample patch "
<<
mpp
.
samplePatch
()
<<
" in region "
<<
mpp
.
sampleRegion
()
<<
" for patch "
<<
this
->
patch
().
name
()
<<
nl
<<
abort
(
FatalError
);
}
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
fieldType
;
const
word
&
fieldName
=
this
->
dimensionedInternalField
().
name
();
const
fieldType
&
sendField
=
this
->
db
().
objectRegistry
::
lookupObject
<
fieldType
>
(
fieldName
);
getNewValues
(
mpp
,
sendField
.
boundaryField
()[
patchID
],
newValues
);
const
fieldType
&
nbrField
=
nbrMesh
.
lookupObject
<
fieldType
>
(
fldName
);
newValues
=
nbrField
.
boundaryField
()[
nbrPatchID
];
mapDistribute
::
distribute
(
Pstream
::
defaultCommsType
,
distMap
.
schedule
(),
distMap
.
constructSize
(),
distMap
.
subMap
(),
distMap
.
constructMap
(),
newValues
);
break
;
}
case
directMappedP
olyP
atch
:
:
NEARESTFACE
:
case
directMappedPatch
Base
:
:
NEARESTFACE
:
{
typedef
GeometricField
<
Type
,
fvPatchField
,
volMesh
>
fieldType
;
const
word
&
fieldName
=
this
->
dimensionedInternalField
().
name
();
const
fieldType
&
sendField
=
this
->
db
().
objectRegistry
::
lookupObject
<
fieldType
>
(
fieldName
);
Field
<
Type
>
allValues
(
nbrMesh
.
nFaces
(),
pTraits
<
Type
>::
zero
);
F
ield
<
Type
>
allValues
const
f
ieldType
&
nbrField
=
nbrMesh
.
lookupObject
<
fieldType
>
(
this
->
patch
().
patch
().
boundaryMesh
().
mesh
().
nFaces
(),
pTraits
<
Type
>::
zero
fldName
);
forAll
(
sendField
.
boundaryField
(),
patchI
)
forAll
(
nbrField
.
boundaryField
(),
patchI
)
{
const
fvPatchField
<
Type
>&
pf
=
send
Field
.
boundaryField
()[
patchI
];
nbr
Field
.
boundaryField
()[
patchI
];
label
faceStart
=
pf
.
patch
().
patch
().
start
();
forAll
(
pf
,
faceI
)
...
...
@@ -282,9 +254,17 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
}
}
getNewValues
(
mpp
,
allValues
,
newValues
);
mapDistribute
::
distribute
(
Pstream
::
defaultCommsType
,
distMap
.
schedule
(),
distMap
.
constructSize
(),
distMap
.
subMap
(),
distMap
.
constructMap
(),
allValues
);
newValues
=
this
->
patch
().
patchSlice
(
new
Values
);
newValues
=
this
->
patch
().
patchSlice
(
all
Values
);
break
;
}
...
...
src/finiteVolume/fields/fvPatchFields/derived/directMappedFixedValue/directMappedFixedValueFvPatchField.H
View file @
c42f04e8
...
...
@@ -62,18 +62,6 @@ class directMappedFixedValueFvPatchField
// setAverage_ is set true
Type
average_
;
// Private member functions
// Helper function to return the new field values
void
getNewValues
(
const
directMappedPolyPatch
&
mpp
,
const
Field
<
Type
>&
sendValues
,
Field
<
Type
>&
newValues
)
const
;
public:
//- Runtime type information
...
...
src/finiteVolume/fields/fvPatchFields/derived/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
View file @
c42f04e8
...
...
@@ -26,7 +26,7 @@ License
#include
"directMappedVelocityFluxFixedValueFvPatchField.H"
#include
"fvPatchFieldMapper.H"
#include
"directMapped
Fv
Patch.H"
#include
"directMappedPatch
Base
.H"
#include
"volFields.H"
#include
"surfaceFields.H"
#include
"addToRunTimeSelectionTable.H"
...
...
@@ -62,12 +62,12 @@ directMappedVelocityFluxFixedValueFvPatchField
fixedValueFvPatchVectorField
(
ptf
,
p
,
iF
,
mapper
),
phiName_
(
ptf
.
phiName_
)
{
if
(
!
isType
<
directMapped
Fv
Patch
>
(
patch
()))
if
(
!
isType
<
directMappedPatch
Base
>
(
this
->
patch
().
patch
()))
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedFixedValueFvPatchField
\n
"
"directMapped
VelocityFlux
FixedValueFvPatchField
\n
"
"(
\n
"
" const directMappedVelocityFluxFixedValueFvPatchField&,
\n
"
" const fvPatch&,
\n
"
...
...
@@ -75,7 +75,7 @@ directMappedVelocityFluxFixedValueFvPatchField
" const fvPatchFieldMapper&
\n
"
")
\n
"
)
<<
"
\n
patch type '"
<<
p
.
type
()
<<
"' not type '"
<<
typeName
<<
"'"
<<
"' not type '"
<<
directMappedPatchBase
::
typeName
<<
"'"
<<
"
\n
for patch "
<<
p
.
name
()
<<
" of field "
<<
dimensionedInternalField
().
name
()
<<
" in file "
<<
dimensionedInternalField
().
objectPath
()
...
...
@@ -95,24 +95,31 @@ directMappedVelocityFluxFixedValueFvPatchField
fixedValueFvPatchVectorField
(
p
,
iF
,
dict
),
phiName_
(
dict
.
lookup
(
"phi"
))
{
if
(
!
isType
<
directMapped
Fv
Patch
>
(
patch
()))
if
(
!
isType
<
directMappedPatch
Base
>
(
this
->
patch
().
patch
()))
{
FatalErrorIn
(
"directMappedVelocityFluxFixedValueFvPatchField::"
"directMappedFixedValueFvPatchField
\n
"
"directMapped
VelocityFlux
FixedValueFvPatchField
\n
"
"(
\n
"
" const fvPatch& p,
\n
"
" const DimensionedField<vector, volMesh>& iF,
\n
"
" const dictionary& dict
\n
"
")
\n
"
)
<<
"
\n
patch type '"
<<
p
.
type
()
<<
"' not type '"
<<
typeName
<<
"'"
<<
"' not type '"
<<
directMappedPatchBase
::
typeName
<<
"'"
<<
"
\n
for patch "
<<
p
.
name
()
<<
" of field "
<<
dimensionedInternalField
().
name
()
<<
" in file "
<<
dimensionedInternalField
().
objectPath
()
<<
exit
(
FatalError
);
}
// Force calculation of schedule (uses parallel comms)
const
directMappedPolyPatch
&
mpp
=
refCast
<
const
directMappedPolyPatch
>
(
patch
().
patch
()
);
(
void
)
mpp
.
map
().
schedule
();
}
...
...
@@ -139,85 +146,6 @@ directMappedVelocityFluxFixedValueFvPatchField
{}
void
directMappedVelocityFluxFixedValueFvPatchField
::
getNewValues
(
const
directMappedPolyPatch
&
mpp
,
const
vectorField
&
sendUValues
,
const
scalarField
&
sendPhiValues
,
vectorField
&
newUValues
,
scalarField
&
newPhiValues
)
const
{
// Get the scheduling information
const
List
<
labelPair
>&
schedule
=
mpp
.
schedule
();
const
labelListList
&
sendLabels
=
mpp
.
sendLabels
();
const
labelListList
&
receiveFaceLabels
=
mpp
.
receiveFaceLabels
();
forAll
(
schedule
,
i
)
{
const
labelPair
&
twoProcs
=
schedule
[
i
];
label
sendProc
=
twoProcs
[
0
];
label
recvProc
=
twoProcs
[
1
];
if
(
Pstream
::
myProcNo
()
==
sendProc
)
{
OPstream
toProc
(
Pstream
::
scheduled
,
recvProc
);
toProc
<<
UIndirectList
<
vector
>
(
sendUValues
,
sendLabels
[
recvProc
])();
toProc
<<
UIndirectList
<
scalar
>
(
sendPhiValues
,
sendLabels
[
recvProc
]
)();
}
else
{
// I am receiver. Receive from sendProc.
IPstream
fromProc
(
Pstream
::
scheduled
,
sendProc
);
vectorField
fromUFld
(
fromProc
);
scalarField
fromPhiFld
(
fromProc
);
// Destination faces
const
labelList
&
faceLabels
=
receiveFaceLabels
[
sendProc
];
forAll
(
fromUFld
,
i
)
{
label
patchFaceI
=
faceLabels
[
i
];
newUValues
[
patchFaceI
]
=
fromUFld
[
i
];
newPhiValues
[
patchFaceI
]
=
fromPhiFld
[
i
];
}
}
}
// Do data from myself
{
UIndirectList
<
vector
>
fromUFld
(
sendUValues
,
sendLabels
[
Pstream
::
myProcNo
()]
);
UIndirectList
<
scalar
>
fromPhiFld
(
sendPhiValues
,
sendLabels
[
Pstream
::
myProcNo
()]
);
// Destination faces
const
labelList
&
faceLabels
=
receiveFaceLabels
[
Pstream
::
myProcNo
()];
forAll
(
fromUFld
,
i
)
{
label
patchFaceI
=
faceLabels
[
i
];
newUValues
[
patchFaceI
]
=
fromUFld
[
i
];
newPhiValues
[
patchFaceI
]
=
fromPhiFld
[
i
];
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void
directMappedVelocityFluxFixedValueFvPatchField
::
updateCoeffs
()
...
...
@@ -227,37 +155,33 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
return
;
}
// Get the directMappedP
olyP
atch
const
directMappedP
olyP
atch
&
mpp
=
refCast
<
const
directMappedP
olyP
atch
>
// Get the directMappedPatch
Base
const
directMappedPatch
Base
&
mpp
=
refCast
<
const
directMappedPatch
Base
>
(
directMappedVelocityFluxFixedValueFvPatchField
::
patch
().
patch
()
);
vectorField
newUValues
(
size
());
scalarField
newPhiValues
(
size
());
const
mapDistribute
&
distMap
=
mpp
.
map
();
const
fvMesh
&
nbrMesh
=
refCast
<
const
fvMesh
>
(
mpp
.
sampleMesh
());
const
word
&
fieldName
=
dimensionedInternalField
().
name
();
const
volVectorField
&
UField
=
db
().
lookupObject
<
volVectorField
>
(
fieldName
);
const
volVectorField
&
UField
=
nbrMesh
.
lookupObject
<
volVectorField
>
(
fieldName
);
surfaceScalarField
&
phiField
=
const_cast
<
surfaceScalarField
&>
(
db
()
.
lookupObject
<
surfaceScalarField
>
(
phiName_
)
nbrMesh
.
lookupObject
<
surfaceScalarField
>
(
phiName_
)
);
vectorField
newUValues
;
scalarField
newPhiValues
;
switch
(
mpp
.
mode
())
{
case
directMappedPolyPatch
:
:
NEARESTFACE
:
{
vectorField
allUValues
(
patch
().
patch
().
boundaryMesh
().
mesh
().
nFaces
(),
vector
::
zero
);
scalarField
allPhiValues
(
patch
().
patch
().
boundaryMesh
().
mesh
().
nFaces
(),
0
.
0
);
vectorField
allUValues
(
nbrMesh
.
nFaces
(),
vector
::
zero
);
scalarField
allPhiValues
(
nbrMesh
.
nFaces
(),
0
.
0
);
forAll
(
UField
.
boundaryField
(),
patchI
)
{
...
...
@@ -273,34 +197,58 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()