ENH. Adding more IOFieldFields, using them in decomposePar and

reconstructPar to decompose and reconstruct lagrangian FieldField
data.
This commit is contained in:
graham
2010-05-27 19:10:55 +01:00
parent 81a0568a3f
commit 0f7a124152
25 changed files with 982 additions and 4 deletions

View File

@ -64,8 +64,11 @@ Usage
#include "IOobjectList.H"
#include "domainDecomposition.H"
#include "labelIOField.H"
#include "labelFieldIOField.H"
#include "scalarIOField.H"
#include "scalarFieldIOField.H"
#include "vectorIOField.H"
#include "vectorFieldIOField.H"
#include "sphericalTensorIOField.H"
#include "symmTensorIOField.H"
#include "tensorIOField.H"
@ -374,8 +377,20 @@ int main(int argc, char *argv[])
PtrList< List<SLList<indexedParticle*>*> > cellParticles(cloudDirs.size());
PtrList<PtrList<labelIOField> > lagrangianLabelFields(cloudDirs.size());
PtrList<PtrList<labelIOFieldField> > lagrangianLabelFieldFields
(
cloudDirs.size()
);
PtrList<PtrList<scalarIOField> > lagrangianScalarFields(cloudDirs.size());
PtrList<PtrList<scalarIOFieldField> > lagrangianScalarFieldFields
(
cloudDirs.size()
);
PtrList<PtrList<vectorIOField> > lagrangianVectorFields(cloudDirs.size());
PtrList<PtrList<vectorIOFieldField> > lagrangianVectorFieldFields
(
cloudDirs.size()
);
PtrList<PtrList<sphericalTensorIOField> > lagrangianSphericalTensorFields
(
cloudDirs.size()
@ -487,6 +502,13 @@ int main(int argc, char *argv[])
lagrangianLabelFields
);
lagrangianFieldDecomposer::readFieldFields
(
cloudI,
lagrangianObjects,
lagrangianLabelFieldFields
);
lagrangianFieldDecomposer::readFields
(
cloudI,
@ -494,6 +516,14 @@ int main(int argc, char *argv[])
lagrangianScalarFields
);
lagrangianFieldDecomposer::readFieldFields
(
cloudI,
lagrangianObjects,
lagrangianScalarFieldFields
);
lagrangianFieldDecomposer::readFields
(
cloudI,
@ -501,6 +531,13 @@ int main(int argc, char *argv[])
lagrangianVectorFields
);
lagrangianFieldDecomposer::readFieldFields
(
cloudI,
lagrangianObjects,
lagrangianVectorFieldFields
);
lagrangianFieldDecomposer::readFields
(
cloudI,
@ -529,8 +566,11 @@ int main(int argc, char *argv[])
lagrangianPositions.setSize(cloudI);
cellParticles.setSize(cloudI);
lagrangianLabelFields.setSize(cloudI);
lagrangianLabelFieldFields.setSize(cloudI);
lagrangianScalarFields.setSize(cloudI);
lagrangianScalarFieldFields.setSize(cloudI);
lagrangianVectorFields.setSize(cloudI);
lagrangianVectorFieldFields.setSize(cloudI);
lagrangianSphericalTensorFields.setSize(cloudI);
lagrangianSymmTensorFields.setSize(cloudI);
lagrangianTensorFields.setSize(cloudI);
@ -725,8 +765,11 @@ int main(int argc, char *argv[])
if
(
lagrangianLabelFields[cloudI].size()
|| lagrangianLabelFieldFields[cloudI].size()
|| lagrangianScalarFields[cloudI].size()
|| lagrangianScalarFieldFields[cloudI].size()
|| lagrangianVectorFields[cloudI].size()
|| lagrangianVectorFieldFields[cloudI].size()
|| lagrangianSphericalTensorFields[cloudI].size()
|| lagrangianSymmTensorFields[cloudI].size()
|| lagrangianTensorFields[cloudI].size()
@ -737,16 +780,31 @@ int main(int argc, char *argv[])
cloudDirs[cloudI],
lagrangianLabelFields[cloudI]
);
fieldDecomposer.decomposeFieldFields
(
cloudDirs[cloudI],
lagrangianLabelFieldFields[cloudI]
);
fieldDecomposer.decomposeFields
(
cloudDirs[cloudI],
lagrangianScalarFields[cloudI]
);
fieldDecomposer.decomposeFieldFields
(
cloudDirs[cloudI],
lagrangianScalarFieldFields[cloudI]
);
fieldDecomposer.decomposeFields
(
cloudDirs[cloudI],
lagrangianVectorFields[cloudI]
);
fieldDecomposer.decomposeFieldFields
(
cloudDirs[cloudI],
lagrangianVectorFieldFields[cloudI]
);
fieldDecomposer.decomposeFields
(
cloudDirs[cloudI],

View File

@ -37,6 +37,7 @@ SourceFiles
#define lagrangianFieldDecomposer_H
#include "Cloud.H"
#include "IOFieldField.H"
#include "indexedParticle.H"
#include "passiveParticle.H"
@ -102,6 +103,19 @@ public:
// PtrList<IOField<Type> >& lagrangianFields
);
template<class Type>
static void readFieldFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList
<
PtrList<IOFieldField<Field<Type>, Type> >
>& lagrangianFields
// PtrList<IOFieldField<Field<Type>, Type > >& lagrangianFields
);
//- Decompose volume field
template<class Type>
tmp<IOField<Type> > decomposeField
@ -110,12 +124,27 @@ public:
const IOField<Type>& field
) const;
template<class Type>
tmp<IOFieldField<Field<Type>, Type> > decomposeFieldField
(
const word& cloudName,
const IOFieldField<Field<Type>, Type>& field
) const;
template<class GeoField>
void decomposeFields
(
const word& cloudName,
const PtrList<GeoField>& fields
) const;
template<class GeoField>
void decomposeFieldFields
(
const word& cloudName,
const PtrList<GeoField>& fields
) const;
};

View File

@ -63,6 +63,56 @@ void Foam::lagrangianFieldDecomposer::readFields
}
template<class Type>
void Foam::lagrangianFieldDecomposer::readFieldFields
(
const label cloudI,
const IOobjectList& lagrangianObjects,
PtrList<PtrList<IOFieldField<Field<Type>, Type> > >& lagrangianFields
)
{
// Search list of objects for lagrangian fields
IOobjectList lagrangianTypeObjectsA
(
lagrangianObjects.lookupClass(IOField<Field<Type> >::typeName)
);
IOobjectList lagrangianTypeObjectsB
(
lagrangianObjects.lookupClass(IOFieldField<Field<Type>, Type>::typeName)
);
lagrangianFields.set
(
cloudI,
new PtrList<IOFieldField<Field<Type>, Type> >
(
lagrangianTypeObjectsA.size() + lagrangianTypeObjectsB.size()
)
);
label lagrangianFieldi=0;
forAllIter(IOobjectList, lagrangianTypeObjectsA, iter)
{
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new IOFieldField<Field<Type>, Type>(*iter())
);
}
forAllIter(IOobjectList, lagrangianTypeObjectsB, iter)
{
lagrangianFields[cloudI].set
(
lagrangianFieldi++,
new IOFieldField<Field<Type>, Type>(*iter())
);
}
}
template<class Type>
Foam::tmp<Foam::IOField<Type> >
Foam::lagrangianFieldDecomposer::decomposeField
@ -94,6 +144,37 @@ Foam::lagrangianFieldDecomposer::decomposeField
}
template<class Type>
Foam::tmp<Foam::IOFieldField<Foam::Field<Type>, Type> >
Foam::lagrangianFieldDecomposer::decomposeFieldField
(
const word& cloudName,
const IOFieldField<Field<Type>, Type>& field
) const
{
// Create and map the internal field values
Field<Field<Type> > procField(field, particleIndices_);
// Create the field for the processor
return tmp<IOFieldField<Field<Type>, Type> >
(
new IOFieldField<Field<Type>, Type>
(
IOobject
(
field.name(),
procMesh_.time().timeName(),
cloud::prefix/cloudName,
procMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
procField
)
);
}
template<class GeoField>
void Foam::lagrangianFieldDecomposer::decomposeFields
(
@ -111,4 +192,21 @@ void Foam::lagrangianFieldDecomposer::decomposeFields
}
template<class GeoField>
void Foam::lagrangianFieldDecomposer::decomposeFieldFields
(
const word& cloudName,
const PtrList<GeoField>& fields
) const
{
if (particleIndices_.size())
{
forAll(fields, fieldI)
{
decomposeFieldField(cloudName, fields[fieldI])().write();
}
}
}
// ************************************************************************* //

View File

@ -402,6 +402,13 @@ int main(int argc, char *argv[])
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFieldFields<label>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFields<scalar>
(
cloudName,
@ -409,6 +416,13 @@ int main(int argc, char *argv[])
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFieldFields<scalar>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFields<vector>
(
cloudName,
@ -416,6 +430,13 @@ int main(int argc, char *argv[])
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFieldFields<vector>
(
cloudName,
mesh,
procMeshes.meshes(),
sprayObjs
);
reconstructLagrangianFields<sphericalTensor>
(
cloudName,

View File

@ -497,10 +497,15 @@ $(Fields)/scalarField/scalarFieldIOField.C
$(Fields)/vectorField/vectorIOField.C
$(Fields)/vectorField/vectorFieldIOField.C
$(Fields)/vector2DField/vector2DIOField.C
$(Fields)/vector2DField/vector2DFieldIOField.C
$(Fields)/sphericalTensorField/sphericalTensorIOField.C
$(Fields)/sphericalTensorField/sphericalTensorFieldIOField.C
$(Fields)/diagTensorField/diagTensorIOField.C
$(Fields)/diagTensorField/diagTensorFieldIOField.C
$(Fields)/symmTensorField/symmTensorIOField.C
$(Fields)/symmTensorField/symmTensorFieldIOField.C
$(Fields)/tensorField/tensorIOField.C
$(Fields)/tensorField/tensorFieldIOField.C
$(Fields)/transformField/transformField.C
pointPatchFields = fields/pointPatchFields

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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
diagTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "diagTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
diagTensorFieldIOField,
"diagTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
diagTensorIOFieldField,
"diagTensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::diagTensorFieldIOField
Description
diagTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef diagTensorFieldIOField_H
#define diagTensorFieldIOField_H
#include "diagTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<diagTensorField> diagTensorFieldIOField;
typedef IOFieldField<diagTensorField, diagTensor> diagTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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
sphericalTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "sphericalTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorFieldIOField,
"sphericalTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorIOFieldField,
"sphericalTensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::sphericalTensorFieldIOField
Description
sphericalTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef sphericalTensorFieldIOField_H
#define sphericalTensorFieldIOField_H
#include "sphericalTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<sphericalTensorField> sphericalTensorFieldIOField;
typedef IOFieldField<sphericalTensorField, sphericalTensor>
sphericalTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,7 +32,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(sphericalTensorIOField, "sphericalTensorField", 0);
defineTemplateTypeNameAndDebugWithName
(
sphericalTensorIOField,
"sphericalTensorField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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
symmTensorField with IO.
\*---------------------------------------------------------------------------*/
#include "symmTensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
symmTensorFieldIOField,
"symmTensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
symmTensorIOFieldField,
"symmTensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::symmTensorFieldIOField
Description
symmTensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef symmTensorFieldIOField_H
#define symmTensorFieldIOField_H
#include "symmTensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<symmTensorField> symmTensorFieldIOField;
typedef IOFieldField<symmTensorField, symmTensor> symmTensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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
tensorField with IO.
\*---------------------------------------------------------------------------*/
#include "tensorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
tensorFieldIOField,
"tensorFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
tensorIOFieldField,
"tensorCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::tensorFieldIOField
Description
tensorFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef tensorFieldIOField_H
#define tensorFieldIOField_H
#include "tensorField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<tensorField> tensorFieldIOField;
typedef IOFieldField<tensorField, tensor> tensorIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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
vector2DField with IO.
\*---------------------------------------------------------------------------*/
#include "vector2DFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebugWithName
(
vector2DFieldIOField,
"vector2DFieldField",
0
);
defineTemplateTypeNameAndDebugWithName
(
vector2DIOFieldField,
"vector2DCompactFieldField",
0
);
}
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Typedef
Foam::vector2DFieldIOField
Description
vector2DFieldField with IO.
\*---------------------------------------------------------------------------*/
#ifndef vector2DFieldIOField_H
#define vector2DFieldIOField_H
#include "vector2DField.H"
#include "IOField.H"
#include "IOFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOField<vector2DField> vector2DFieldIOField;
typedef IOFieldField<vector2DField, vector2D> vector2DIOFieldField;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,7 +32,12 @@ Description
namespace Foam
{
defineTemplateTypeNameAndDebugWithName(vector2DIOField, "vector2DField", 0);
defineTemplateTypeNameAndDebugWithName
(
vector2DIOField,
"vector2DField",
0
);
}
// ************************************************************************* //

View File

@ -60,6 +60,21 @@ Foam::CollisionRecordList<PairType, WallType>::~CollisionRecordList()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class PairType, class WallType>
Foam::Field<PairType>
Foam::CollisionRecordList<PairType, WallType>::pairData() const
{
Field<PairType> f(pairRecords_.size());
forAll(pairRecords_, i)
{
f[i] = pairRecords_[i].collisionData();
}
return f;
}
template<class PairType, class WallType>
Foam::PairCollisionRecord<PairType>&
Foam::CollisionRecordList<PairType, WallType>::matchPairRecord

View File

@ -102,6 +102,17 @@ public:
// Member Functions
//- Return the active pair collisions
inline const DynamicList<PairCollisionRecord<PairType> >&
pairRecords() const;
//- Return the active wall collisions
inline const DynamicList<WallCollisionRecord<WallType> >&
wallRecords() const;
//- Return field of pair data from each record, used for field IO
Field<PairType> pairData() const;
//- Enquires if the proc and id pair of the other particle are
// present in the records. If so, return non-const access to
// the PairCollisionRecord (hence the data) and mark the
@ -172,6 +183,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "CollisionRecordListI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "CollisionRecordList.C"
#endif

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class PairType, class WallType>
const Foam::DynamicList<Foam::PairCollisionRecord<PairType> >&
Foam::CollisionRecordList<PairType, WallType>::pairRecords() const
{
return pairRecords_;
}
template<class PairType, class WallType>
const Foam::DynamicList<Foam::WallCollisionRecord<WallType> >&
Foam::CollisionRecordList<PairType, WallType>::wallRecords() const
{
return wallRecords_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -53,6 +53,8 @@ SourceFiles
#include "KinematicCloud.H"
#include "CollisionRecordList.H"
#include "labelFieldIOField.H"
#include "vectorFieldIOField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,6 +62,8 @@ namespace Foam
{
typedef CollisionRecordList<vector, vector> collisionRecordList;
typedef vectorIOFieldField pairDataIOFieldField;
typedef IOList<collisionRecordList> collisionRecordIOList;
template<class ParcelType>

View File

@ -233,7 +233,8 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
IOField<vector> f(c.fieldIOobject("f", IOobject::NO_READ), np);
IOField<vector> angularMomentum
(
c.fieldIOobject("angularMomentum", IOobject::NO_READ), np
c.fieldIOobject("angularMomentum", IOobject::NO_READ),
np
);
IOField<vector> torque(c.fieldIOobject("torque", IOobject::NO_READ), np);
IOField<scalar> rho(c.fieldIOobject("rho", IOobject::NO_READ), np);
@ -254,6 +255,12 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
np
);
pairDataIOFieldField collisionRecords_pairData
(
c.fieldIOobject("collisionRecords_pairData", IOobject::NO_READ),
np
);
label i = 0;
forAllConstIter(typename Cloud<ParcelType>, c, iter)
@ -272,6 +279,19 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
tTurb[i] = p.tTurb();
UTurb[i] = p.UTurb();
collisionRecords[i] = p.collisionRecords();
collisionRecords_pairData[i] = p.collisionRecords().pairData();
// collisionRecords_pairData[i].setSize
// (
// p.collisionRecords().pairRecords().size()
// );
// forAll(p.collisionRecords().pairRecords(), j)
// {
// collisionRecords_pairData[i][j] =
// p.collisionRecords().pairRecords()[j].collisionData();
// }
i++;
}
@ -287,6 +307,7 @@ void Foam::KinematicParcel<ParcelType>::writeFields(const Cloud<ParcelType>& c)
tTurb.write();
UTurb.write();
collisionRecords.write();
collisionRecords_pairData.write();
}

View File

@ -38,6 +38,7 @@ SourceFiles
#include "cloud.H"
#include "polyMesh.H"
#include "IOobjectList.H"
#include "IOFieldField.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -67,6 +68,16 @@ tmp<IOField<Type> > reconstructLagrangianField
);
template<class Type>
tmp<IOFieldField<Field<Type>, Type> > reconstructLagrangianFieldField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
);
template<class Type>
void reconstructLagrangianFields
(
@ -77,6 +88,16 @@ void reconstructLagrangianFields
);
template<class Type>
void reconstructLagrangianFieldFields
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "IOField.H"
#include "IOFieldField.H"
#include "Time.H"
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
@ -87,6 +88,67 @@ Foam::tmp<Foam::IOField<Type> > Foam::reconstructLagrangianField
}
template<class Type>
Foam::tmp<Foam::IOFieldField<Field<Type>, Type> >
Foam::reconstructLagrangianFieldField
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const word& fieldName
)
{
// Construct empty field on mesh
tmp<IOFieldField<Field<Type>, Type > > tfield
(
new IOFieldField<Field<Type>, Type>
(
IOobject
(
fieldName,
mesh.time().timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
Field<Field<Type> >(0)
)
);
Field<Field<Type> >& field = tfield();
forAll(meshes, i)
{
// Check object on local mesh
IOobject localIOobject
(
fieldName,
meshes[i].time().timeName(),
cloud::prefix/cloudName,
meshes[i],
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (localIOobject.headerOk())
{
IOFieldField<Field<Type>, Type> fieldi(localIOobject);
label offset = field.size();
field.setSize(offset + fieldi.size());
forAll(fieldi, j)
{
field[offset + j] = fieldi[j];
}
}
}
return tfield;
}
template<class Type>
void Foam::reconstructLagrangianFields
(
@ -122,4 +184,67 @@ void Foam::reconstructLagrangianFields
}
template<class Type>
void Foam::reconstructLagrangianFieldFields
(
const word& cloudName,
const polyMesh& mesh,
const PtrList<fvMesh>& meshes,
const IOobjectList& objects
)
{
{
const word fieldClassName(IOFieldField<Field<Type>, Type>::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
Info<< endl;
}
}
{
const word fieldClassName(IOField<Field<Type> >::typeName);
IOobjectList fields = objects.lookupClass(fieldClassName);
if (fields.size())
{
Info<< " Reconstructing lagrangian "
<< fieldClassName << "s\n" << endl;
forAllConstIter(IOobjectList, fields, fieldIter)
{
Info<< " " << fieldIter()->name() << endl;
reconstructLagrangianFieldField<Type>
(
cloudName,
mesh,
meshes,
fieldIter()->name()
)().write();
}
Info<< endl;
}
}
}
// ************************************************************************* //