ENH: Added uniformJumpAMI boundary condition

This commit is contained in:
andy
2012-10-25 10:03:18 +01:00
parent e83621ba57
commit e18b1ca7c0
5 changed files with 461 additions and 0 deletions

View File

@ -0,0 +1,139 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "uniformJumpAMIFvPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedJumpAMIFvPatchField<Type>(p, iF),
jumpTable_(0)
{}
template<class Type>
Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
(
const uniformJumpAMIFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedJumpAMIFvPatchField<Type>(ptf, p, iF, mapper),
jumpTable_(ptf.jumpTable_().clone().ptr())
{}
template<class Type>
Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedJumpAMIFvPatchField<Type>(p, iF),
jumpTable_(0)
{
if (this->cyclicAMIPatch().owner())
{
jumpTable_ = DataEntry<Type>::New("jumpTable", dict);
}
if (dict.found("value"))
{
fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
}
}
template<class Type>
Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
(
const uniformJumpAMIFvPatchField<Type>& ptf
)
:
fixedJumpAMIFvPatchField<Type>(ptf),
jumpTable_(ptf.jumpTable_().clone().ptr())
{}
template<class Type>
Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
(
const uniformJumpAMIFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedJumpAMIFvPatchField<Type>(ptf, iF),
jumpTable_(ptf.jumpTable_().clone().ptr())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::uniformJumpAMIFvPatchField<Type>::jump() const
{
if (this->cyclicAMIPatch().owner())
{
Type j = jumpTable_->value(this->db().time().value());
return tmp<Field<Type> >(new Field<Type>(this->size(), j));
}
else
{
const uniformJumpAMIFvPatchField& nbrPatch =
refCast<const uniformJumpAMIFvPatchField<Type> >
(
this->neighbourPatchField()
);
return this->cyclicAMIPatch().interpolate(nbrPatch.jump());
}
}
template<class Type>
void Foam::uniformJumpAMIFvPatchField<Type>::write(Ostream& os) const
{
fixedJumpAMIFvPatchField<Type>::write(os);
if (this->cyclicAMIPatch().owner())
{
jumpTable_->writeData(os);
}
this->writeEntry("value", os);
}
// ************************************************************************* //

View File

@ -0,0 +1,180 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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::uniformJumpAMIFvPatchField
Group
grpCoupledBoundaryConditions
Description
Uniform jump
SeeAlso
Foam::jumpCyclicAMIFvPatchField
SourceFiles
uniformJumpAMIFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef uniformJumpAMIFvPatchField_H
#define uniformJumpAMIFvPatchField_H
#include "fixedJumpAMIFvPatchField.H"
#include "DataEntry.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class uniformJumpAMIFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class uniformJumpAMIFvPatchField
:
public fixedJumpAMIFvPatchField<Type>
{
protected:
// Protected data
//- "jump" table
autoPtr<DataEntry<Type> > jumpTable_;
public:
//- Runtime type information
TypeName("uniformJumpAMI");
// Constructors
//- Construct from patch and internal field
uniformJumpAMIFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
uniformJumpAMIFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given uniformJumpAMIFvPatchField onto a
// new patch
uniformJumpAMIFvPatchField
(
const uniformJumpAMIFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
uniformJumpAMIFvPatchField
(
const uniformJumpAMIFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new uniformJumpAMIFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
uniformJumpAMIFvPatchField
(
const uniformJumpAMIFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new uniformJumpAMIFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Access
//- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const;
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
virtual void autoMap
(
const fvPatchFieldMapper&
);
//- Reverse map the given fvPatchField onto this fvPatchField
virtual void rmap
(
const fvPatchField<Type>&,
const labelList&
);
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "uniformJumpAMIFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 "uniformJumpAMIFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(uniformJumpAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 uniformJumpAMIFvPatchFields_H
#define uniformJumpAMIFvPatchFields_H
#include "uniformJumpAMIFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(uniformJumpAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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 uniformJumpAMIFvPatchFieldsFwd_H
#define uniformJumpAMIFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class uniformJumpAMIFvPatchField;
makePatchTypeFieldTypedefs(uniformJumpAMI);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //