mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: ACMI updates
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -154,11 +154,11 @@ Foam::cyclicACMIFvPatchField<Type>::patchNeighbourField() const
|
|||||||
const Field<Type>& iField = this->internalField();
|
const Field<Type>& iField = this->internalField();
|
||||||
const labelUList& nbrFaceCellsCoupled =
|
const labelUList& nbrFaceCellsCoupled =
|
||||||
cyclicACMIPatch_.cyclicACMIPatch().neighbPatch().faceCells();
|
cyclicACMIPatch_.cyclicACMIPatch().neighbPatch().faceCells();
|
||||||
const labelUList& nbrFaceCellsNonOverlap =
|
const labelUList& faceCellsNonOverlap =
|
||||||
cyclicACMIPatch_.cyclicACMIPatch().nonOverlapPatch().faceCells();
|
cyclicACMIPatch_.cyclicACMIPatch().nonOverlapPatch().faceCells();
|
||||||
|
|
||||||
Field<Type> pnfCoupled(iField, nbrFaceCellsCoupled);
|
Field<Type> pnfCoupled(iField, nbrFaceCellsCoupled);
|
||||||
Field<Type> pnfNonOverlap(iField, nbrFaceCellsNonOverlap);
|
Field<Type> pfNonOverlap(iField, faceCellsNonOverlap);
|
||||||
|
|
||||||
tmp<Field<Type> > tpnf
|
tmp<Field<Type> > tpnf
|
||||||
(
|
(
|
||||||
@ -167,7 +167,7 @@ Foam::cyclicACMIFvPatchField<Type>::patchNeighbourField() const
|
|||||||
cyclicACMIPatch_.interpolate
|
cyclicACMIPatch_.interpolate
|
||||||
(
|
(
|
||||||
pnfCoupled,
|
pnfCoupled,
|
||||||
pnfNonOverlap
|
pfNonOverlap
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -287,10 +287,14 @@ Foam::tmp<Foam::Field<Type> > Foam::cyclicACMIFvPatchField<Type>::snGrad
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::cyclicACMIFvPatchField<Type>::updateCoeffs()
|
void Foam::cyclicACMIFvPatchField<Type>::updateCoeffs()
|
||||||
{
|
{
|
||||||
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
// update non-overlap patch - some will implement updateCoeffs, and
|
||||||
|
// others will implement evaluate
|
||||||
|
|
||||||
|
// scale neighbour field by (1 - mask)
|
||||||
|
|
||||||
|
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
||||||
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
||||||
const_cast<fvPatchField<Type>&>(npf).updateCoeffs(mask);
|
const_cast<fvPatchField<Type>&>(npf).updateCoeffs(1.0 - mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,9 +304,21 @@ void Foam::cyclicACMIFvPatchField<Type>::initEvaluate
|
|||||||
const Pstream::commsTypes comms
|
const Pstream::commsTypes comms
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// update non-overlap patch
|
// update non-overlap patch (if not already updated by updateCoeffs)
|
||||||
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
|
||||||
const_cast<fvPatchField<Type>&>(npf).evaluate(comms);
|
// scale neighbour field by (1 - mask)
|
||||||
|
|
||||||
|
fvPatchField<Type>& npf =
|
||||||
|
const_cast<fvPatchField<Type>&>(nonOverlapPatchField());
|
||||||
|
|
||||||
|
if (!npf.updated())
|
||||||
|
{
|
||||||
|
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
||||||
|
|
||||||
|
npf.evaluate(comms);
|
||||||
|
|
||||||
|
npf *= 1.0 - mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -313,13 +329,16 @@ void Foam::cyclicACMIFvPatchField<Type>::evaluate
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// blend contributions from the coupled and non-overlap patches
|
// blend contributions from the coupled and non-overlap patches
|
||||||
|
|
||||||
|
// neighbour patch field is updated via updateCoeffs or initEvaluate
|
||||||
|
// and is already scaled by (1 - mask)
|
||||||
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
||||||
|
|
||||||
coupledFvPatchField<Type>::evaluate(comms);
|
coupledFvPatchField<Type>::evaluate(comms);
|
||||||
const Field<Type>& cpf = *this;
|
const Field<Type>& cpf = *this;
|
||||||
|
|
||||||
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
||||||
Field<Type>::operator=(mask*cpf + (1.0 - mask)*npf);
|
Field<Type>::operator=(mask*cpf + npf);
|
||||||
|
|
||||||
fvPatchField<Type>::evaluate();
|
fvPatchField<Type>::evaluate();
|
||||||
}
|
}
|
||||||
@ -333,7 +352,7 @@ Foam::cyclicACMIFvPatchField<Type>::valueInternalCoeffs
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// note: do not blend based on mask field
|
// note: do not blend based on mask field
|
||||||
// - when applied this is scaled by the areas which area already scaled
|
// - when applied this is scaled by the areas which are already scaled
|
||||||
return coupledFvPatchField<Type>::valueInternalCoeffs(w);
|
return coupledFvPatchField<Type>::valueInternalCoeffs(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +365,7 @@ Foam::cyclicACMIFvPatchField<Type>::valueBoundaryCoeffs
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// note: do not blend based on mask field
|
// note: do not blend based on mask field
|
||||||
// - when applied this is scaled by the areas which area already scaled
|
// - when applied this is scaled by the areas which are already scaled
|
||||||
return coupledFvPatchField<Type>::valueBoundaryCoeffs(w);
|
return coupledFvPatchField<Type>::valueBoundaryCoeffs(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +378,7 @@ Foam::cyclicACMIFvPatchField<Type>::gradientInternalCoeffs
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// note: do not blend based on mask field
|
// note: do not blend based on mask field
|
||||||
// - when applied this is scaled by the areas which area already scaled
|
// - when applied this is scaled by the areas which are already scaled
|
||||||
return coupledFvPatchField<Type>::gradientInternalCoeffs(deltaCoeffs);
|
return coupledFvPatchField<Type>::gradientInternalCoeffs(deltaCoeffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +388,7 @@ Foam::tmp<Foam::Field<Type> >
|
|||||||
Foam::cyclicACMIFvPatchField<Type>::gradientInternalCoeffs() const
|
Foam::cyclicACMIFvPatchField<Type>::gradientInternalCoeffs() const
|
||||||
{
|
{
|
||||||
// note: do not blend based on mask field
|
// note: do not blend based on mask field
|
||||||
// - when applied this is scaled by the areas which area already scaled
|
// - when applied this is scaled by the areas which are already scaled
|
||||||
return coupledFvPatchField<Type>::gradientInternalCoeffs();
|
return coupledFvPatchField<Type>::gradientInternalCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +401,7 @@ Foam::cyclicACMIFvPatchField<Type>::gradientBoundaryCoeffs
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// note: do not blend based on mask field
|
// note: do not blend based on mask field
|
||||||
// - when applied this is scaled by the areas which area already scaled
|
// - when applied this is scaled by the areas which are already scaled
|
||||||
return coupledFvPatchField<Type>::gradientBoundaryCoeffs(deltaCoeffs);
|
return coupledFvPatchField<Type>::gradientBoundaryCoeffs(deltaCoeffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,7 +411,7 @@ Foam::tmp<Foam::Field<Type> >
|
|||||||
Foam::cyclicACMIFvPatchField<Type>::gradientBoundaryCoeffs() const
|
Foam::cyclicACMIFvPatchField<Type>::gradientBoundaryCoeffs() const
|
||||||
{
|
{
|
||||||
// note: do not blend based on mask field
|
// note: do not blend based on mask field
|
||||||
// - when applied this is scaled by the areas which area already scaled
|
// - when applied this is scaled by the areas which are already scaled
|
||||||
return coupledFvPatchField<Type>::gradientBoundaryCoeffs();
|
return coupledFvPatchField<Type>::gradientBoundaryCoeffs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,11 +422,13 @@ void Foam::cyclicACMIFvPatchField<Type>::manipulateMatrix
|
|||||||
fvMatrix<Type>& matrix
|
fvMatrix<Type>& matrix
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// blend contributions from the coupled and non-overlap patches
|
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
||||||
|
|
||||||
|
// nothing to be done by the AMI, but re-direct to non-overlap patch
|
||||||
|
// with non-overlap patch weights
|
||||||
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
const fvPatchField<Type>& npf = nonOverlapPatchField();
|
||||||
|
|
||||||
const scalarField& mask = cyclicACMIPatch_.cyclicACMIPatch().mask();
|
const_cast<fvPatchField<Type>&>(npf).manipulateMatrix(matrix, 1.0 - mask);
|
||||||
const_cast<fvPatchField<Type>&>(npf).manipulateMatrix(matrix, mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -166,9 +166,30 @@ public:
|
|||||||
// Evaluation functions
|
// Evaluation functions
|
||||||
|
|
||||||
//- Return true if coupled. Note that the underlying patch
|
//- Return true if coupled. Note that the underlying patch
|
||||||
// is not coupled() - the points don't align.
|
// is not coupled() - the points don't align
|
||||||
virtual bool coupled() const;
|
virtual bool coupled() const;
|
||||||
|
|
||||||
|
//- Return true if this patch field fixes a value
|
||||||
|
// Needed to check if a level has to be specified while solving
|
||||||
|
// Poissons equations
|
||||||
|
virtual bool fixesValue() const
|
||||||
|
{
|
||||||
|
const scalarField& mask =
|
||||||
|
cyclicACMIPatch_.cyclicACMIPatch().mask();
|
||||||
|
|
||||||
|
if (gMax(mask) > 1e-5)
|
||||||
|
{
|
||||||
|
// regions connected
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// fully separated
|
||||||
|
return nonOverlapPatchField().fixesValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//- Return neighbour coupled internal cell data
|
//- Return neighbour coupled internal cell data
|
||||||
virtual tmp<Field<Type> > patchNeighbourField() const;
|
virtual tmp<Field<Type> > patchNeighbourField() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user