Commit 4ede1bc1 authored by mattijs's avatar mattijs
Browse files

Merge branch 'tmp'

parents 6148d8c4 1cdcfd72
......@@ -506,6 +506,7 @@ $(constraintPointPatchFields)/empty/emptyPointPatchFields.C
$(constraintPointPatchFields)/symmetry/symmetryPointPatchFields.C
$(constraintPointPatchFields)/wedge/wedgePointPatchFields.C
$(constraintPointPatchFields)/cyclic/cyclicPointPatchFields.C
$(constraintPointPatchFields)/cyclicSlip/cyclicSlipPointPatchFields.C
$(constraintPointPatchFields)/processor/processorPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
......
......@@ -36,6 +36,7 @@ SourceFiles
#define basicSymmetryPointPatchField_H
#include "pointPatchField.H"
#include "symmetryPointPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -120,6 +121,12 @@ public:
// Evaluation functions
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return symmetryPointPatch::typeName;
}
//- Update the patch field
virtual void evaluate
(
......
......@@ -127,6 +127,14 @@ public:
// Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return cyclicPointPatch::typeName;
}
//- Cyclic coupled interface functions
//- Does the patch field perform the transfromation
......
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
#include "cyclicSlipPointPatchField.H"
#include "pointConstraint.H"
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF
)
:
cyclicPointPatchField<Type>(p, iF)
{}
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const dictionary& dict
)
:
cyclicPointPatchField<Type>(p, iF, dict)
{}
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>& ptf,
const pointPatch& p,
const DimensionedField<Type, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
cyclicPointPatchField<Type>(ptf, p, iF, mapper)
{}
template<class Type>
cyclicSlipPointPatchField<Type>::cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>& ptf,
const DimensionedField<Type, pointMesh>& iF
)
:
cyclicPointPatchField<Type>(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void cyclicSlipPointPatchField<Type>::evaluate(const Pstream::commsTypes)
{
const vectorField& nHat = this->patch().pointNormals();
tmp<Field<Type> > tvalues =
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
setInInternalField(iF, tvalues());
}
template<class Type>
void cyclicSlipPointPatchField<Type>::applyConstraint
(
const label pointi,
pointConstraint& pc
) const
{
pc.applyConstraint(this->patch().pointNormals()[pointi]);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
Class
Foam::cyclicSlipPointPatchField
Description
Specialisation of cyclic that constrains to the patch
SourceFiles
cyclicSlipPointPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef cyclicSlipPointPatchField_H
#define cyclicSlipPointPatchField_H
#include "cyclicPointPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class cyclicSlipPointPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class cyclicSlipPointPatchField
:
public cyclicPointPatchField<Type>
{
public:
//- Runtime type information
TypeName("cyclicSlip");
// Constructors
//- Construct from patch and internal field
cyclicSlipPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&
);
//- Construct from patch, internal field and dictionary
cyclicSlipPointPatchField
(
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<Type> onto a new patch
cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>&,
const pointPatch&,
const DimensionedField<Type, pointMesh>&,
const pointPatchFieldMapper&
);
//- Construct and return a clone
virtual autoPtr<pointPatchField<Type> > clone() const
{
return autoPtr<pointPatchField<Type> >
(
new cyclicSlipPointPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
cyclicSlipPointPatchField
(
const cyclicSlipPointPatchField<Type>&,
const DimensionedField<Type, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<Type> > clone
(
const DimensionedField<Type, pointMesh>& iF
) const
{
return autoPtr<pointPatchField<Type> >
(
new cyclicSlipPointPatchField<Type>
(
*this, iF
)
);
}
// Member functions
//- Update the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Accumulate the effect of constraint direction of this patch
virtual void applyConstraint
(
const label pointi,
pointConstraint&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "cyclicSlipPointPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
#include "cyclicSlipPointPatchFields.H"
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePointPatchFields(cyclicSlip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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/>.
\*---------------------------------------------------------------------------*/
#ifndef cyclicSlipPointPatchFields_H
#define cyclicSlipPointPatchFields_H
#include "cyclicSlipPointPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchFieldTypedefs(cyclicSlip);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -119,6 +119,17 @@ public:
)
);
}
// Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
};
......
......@@ -158,6 +158,15 @@ public:
}
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
// Evaluation functions
//- Evaluate the patch field
......
......@@ -122,6 +122,14 @@ public:
// Member functions
//- Constraint handling
//- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
// Evaluation functions
//- Update the patch field
......
......@@ -50,7 +50,7 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
(
"PointPatchField<Type>::New"
"(const word&, const pointPatch&, const Field<Type>&)"
) << "Unknown patchTypefield type "
) << "Unknown patchFieldType type "
<< patchFieldType
<< endl << endl
<< "Valid patchField types are :" << endl
......@@ -58,16 +58,32 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
<< exit(FatalError);
}
typename pointPatchConstructorTable::iterator patchTypeCstrIter =
pointPatchConstructorTablePtr_->find(p.type());
autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF));
if (patchTypeCstrIter != pointPatchConstructorTablePtr_->end())
if (pfPtr().constraintType() == p.constraintType())
{
return autoPtr<pointPatchField<Type> >(patchTypeCstrIter()(p, iF));
// Compatible (constraint-wise) with the patch type
return pfPtr;
}
else
{
return autoPtr<pointPatchField<Type> >(cstrIter()(p, iF));
// Use default constraint type
typename pointPatchConstructorTable::iterator patchTypeCstrIter =
pointPatchConstructorTablePtr_->find(p.type());
if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
{
FatalErrorIn
(
"PointPatchField<Type>::New"
"(const word&, const pointPatch&, const Field<Type>&)"
) << "inconsistent patch and patchField types for \n"
<< " patch type " << p.type()
<< " and patchField type " << patchFieldType
<< exit(FatalError);
}
return patchTypeCstrIter()(p, iF);
}
}
......@@ -115,34 +131,44 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
}
}
// Construct (but not necesarily returned)
autoPtr<pointPatchField<Type> > pfPtr(cstrIter()(p, iF, dict));
if
(
!dict.found("patchType")
|| word(dict.lookup("patchType")) != p.type()
)
{
typename dictionaryConstructorTable::iterator patchTypeCstrIter
= dictionaryConstructorTablePtr_->find(p.type());
if
(
patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
&& patchTypeCstrIter() != cstrIter()
)
if (pfPtr().constraintType() == p.constraintType())
{
FatalIOErrorIn
(
"PointPatchField<Type>const pointPatch&, "
"const Field<Type>&, const dictionary&)",
dict
) << "inconsistent patch and patchField types for \n"
<< " patch type " << p.type()
<< " and patchField type " << patchFieldType
<< exit(FatalIOError);
// Compatible (constraint-wise) with the patch type
return pfPtr;
}
else
{
// Use default constraint type
typename dictionaryConstructorTable::iterator patchTypeCstrIter
= dictionaryConstructorTablePtr_->find(p.type());
if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"PointPatchField<Type>const pointPatch&, "
"const Field<Type>&, const dictionary&)",
dict
) << "inconsistent patch and patchField types for \n"
<< " patch type " << p.type()
<< " and patchField type " << patchFieldType
<< exit(FatalIOError);
}
return patchTypeCstrIter()(p, iF, dict);
}
}
return autoPtr<pointPatchField<Type> >(cstrIter()(p, iF, dict));
return cstrIter()(p, iF, dict);
}
......@@ -185,7 +211,7 @@ Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
<< exit(FatalError);
}
return autoPtr<pointPatchField<Type> >(cstrIter()(ptf, p, iF, pfMapper));
return cstrIter()(ptf, p, iF, pfMapper);
}
......