BUGFIX: Seg-fault in multiphaseInterFoam. Author: Henrik Rusche. Merge: Hrvoje Jasak

This commit is contained in:
Henrik Rusche 2015-06-02 11:09:16 +02:00
commit 7b2e4e547a
9 changed files with 85 additions and 65 deletions

View file

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmakeLnInclude .
wmake
# ----------------------------------------------------------------- end-of-file

View file

@ -1,5 +1,5 @@
multiphaseMixture/phase/phase.C
multiphaseMixture/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
multiphaseMixture/multiphaseAlphaContactAngle/multiphaseAlphaContactAngleFvPatchScalarField.C
multiphaseMixture/multiphaseMixture.C
multiphaseInterFoam.C

View file

@ -1,8 +1,5 @@
EXE_INC = \
-I../interFoam \
-ImultiphaseMixture \
-ImultiphaseMixture/phase \
-ImultiphaseMixture/alphaContactAngle \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
@ -23,16 +23,14 @@ License
\*---------------------------------------------------------------------------*/
#include "alphaContactAngleFvPatchScalarField.H"
#include "multiphaseAlphaContactAngleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
alphaContactAngleFvPatchScalarField::interfaceThetaProps::interfaceThetaProps
Foam::multiphaseAlphaContactAngleFvPatchScalarField::
interfaceThetaProps::interfaceThetaProps
(
Istream& is
)
@ -44,10 +42,10 @@ alphaContactAngleFvPatchScalarField::interfaceThetaProps::interfaceThetaProps
{}
Istream& operator>>
Foam::Istream& Foam::operator>>
(
Istream& is,
alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
multiphaseAlphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
)
{
is >> tp.theta0_ >> tp.uTheta_ >> tp.thetaA_ >> tp.thetaR_;
@ -55,10 +53,11 @@ Istream& operator>>
}
Ostream& operator<<
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
const
multiphaseAlphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
)
{
os << tp.theta0_ << token::SPACE
@ -72,7 +71,8 @@ Ostream& operator<<
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
Foam::multiphaseAlphaContactAngleFvPatchScalarField::
multiphaseAlphaContactAngleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
@ -82,9 +82,10 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
{}
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
Foam::multiphaseAlphaContactAngleFvPatchScalarField::
multiphaseAlphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField& gcpsf,
const multiphaseAlphaContactAngleFvPatchScalarField& gcpsf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
@ -95,7 +96,8 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
{}
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
Foam::multiphaseAlphaContactAngleFvPatchScalarField::
multiphaseAlphaContactAngleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
@ -109,9 +111,10 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
}
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
Foam::multiphaseAlphaContactAngleFvPatchScalarField::
multiphaseAlphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField& gcpsf,
const multiphaseAlphaContactAngleFvPatchScalarField& gcpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
@ -122,7 +125,11 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
void
Foam::multiphaseAlphaContactAngleFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchScalarField::write(os);
os.writeKeyword("thetaProperties")
@ -133,9 +140,14 @@ void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, alphaContactAngleFvPatchScalarField);
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
multiphaseAlphaContactAngleFvPatchScalarField
);
} // End namespace Foam

View file

@ -1,9 +1,9 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
\\ / O peration |
\\ / A nd | For copyright notice see file Copyright
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
@ -22,19 +22,19 @@ License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::alphaContactAngleFvPatchScalarField
Foam::multiphaseAlphaContactAngleFvPatchScalarField
Description
Contact-angle boundary condition for multi-phase interface-capturing
simulations. Used in conjuction with multiphaseMixture.
SourceFiles
alphaContactAngleFvPatchScalarField.C
multiphaseAlphaContactAngleFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphaContactAngleFvPatchScalarField_H
#define alphaContactAngleFvPatchScalarField_H
#ifndef multiphaseAlphaContactAngleFvPatchScalarField_H
#define multiphaseAlphaContactAngleFvPatchScalarField_H
#include "zeroGradientFvPatchFields.H"
#include "multiphaseMixture.H"
@ -45,10 +45,10 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class alphaContactAngleFvPatch Declaration
Class multiphaseAlphaContactAngleFvPatch Declaration
\*---------------------------------------------------------------------------*/
class alphaContactAngleFvPatchScalarField
class multiphaseAlphaContactAngleFvPatchScalarField
:
public zeroGradientFvPatchScalarField
{
@ -132,31 +132,32 @@ private:
public:
//- Runtime type information
TypeName("alphaContactAngle");
TypeName("multiphaseAlphaContactAngle");
// Constructors
//- Construct from patch and internal field
alphaContactAngleFvPatchScalarField
multiphaseAlphaContactAngleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphaContactAngleFvPatchScalarField
multiphaseAlphaContactAngleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given alphaContactAngleFvPatchScalarField
//- Construct by mapping given
// multiphaseAlphaContactAngleFvPatchScalarField
// onto a new patch
alphaContactAngleFvPatchScalarField
multiphaseAlphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField&,
const multiphaseAlphaContactAngleFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
@ -167,14 +168,14 @@ public:
{
return tmp<fvPatchScalarField>
(
new alphaContactAngleFvPatchScalarField(*this)
new multiphaseAlphaContactAngleFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphaContactAngleFvPatchScalarField
multiphaseAlphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField&,
const multiphaseAlphaContactAngleFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
@ -186,7 +187,7 @@ public:
{
return tmp<fvPatchScalarField>
(
new alphaContactAngleFvPatchScalarField(*this, iF)
new multiphaseAlphaContactAngleFvPatchScalarField(*this, iF)
);
}

View file

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "multiphaseMixture.H"
#include "alphaContactAngleFvPatchScalarField.H"
#include "multiphaseAlphaContactAngleFvPatchScalarField.H"
#include "Time.H"
#include "subCycle.H"
#include "fvCFD.H"
@ -361,16 +361,20 @@ void Foam::multiphaseMixture::correctContactAngle
surfaceVectorField::GeometricBoundaryField& nHatb
) const
{
const volScalarField::GeometricBoundaryField& gbf = refPhase_.boundaryField();
const volScalarField::GeometricBoundaryField& gbf =
refPhase_.boundaryField();
const fvBoundaryMesh& boundary = mesh_.boundary();
forAll(boundary, patchi)
{
if (typeid(gbf[patchi]) == typeid(alphaContactAngleFvPatchScalarField))
if (isA<multiphaseAlphaContactAngleFvPatchScalarField>(gbf[patchi]))
{
const alphaContactAngleFvPatchScalarField& acap =
refCast<const alphaContactAngleFvPatchScalarField>(gbf[patchi]);
const multiphaseAlphaContactAngleFvPatchScalarField& acap =
refCast<const multiphaseAlphaContactAngleFvPatchScalarField>
(
gbf[patchi]
);
vectorField& nHatPatch = nHatb[patchi];
@ -378,7 +382,7 @@ void Foam::multiphaseMixture::correctContactAngle
mesh_.Sf().boundaryField()[patchi]
/mesh_.magSf().boundaryField()[patchi];
alphaContactAngleFvPatchScalarField::thetaPropsTable::
multiphaseAlphaContactAngleFvPatchScalarField::thetaPropsTable::
const_iterator tp =
acap.thetaProps().find(interfacePair(alpha1, alpha2));
@ -389,7 +393,8 @@ void Foam::multiphaseMixture::correctContactAngle
"multiphaseMixture::correctContactAngle"
"(const phase& alpha1, const phase& alpha2, "
"fvPatchVectorFieldField& nHatb) const"
) << "Cannot find interface " << interfacePair(alpha1, alpha2)
) << "Cannot find interface "
<< interfacePair(alpha1, alpha2)
<< "\n in table of theta properties for patch "
<< acap.patch().name()
<< exit(FatalError);
@ -408,7 +413,8 @@ void Foam::multiphaseMixture::correctContactAngle
scalar thetaA = convertToRad*tp().thetaA(matched);
scalar thetaR = convertToRad*tp().thetaR(matched);
// Calculated the component of the velocity parallel to the wall
// Calculated the component of the velocity parallel
// to the wall
vectorField Uwall =
U_.boundaryField()[patchi].patchInternalField()
- U_.boundaryField()[patchi];

View file

@ -15,19 +15,14 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Select the type of dynamicFvMesh, and load custom library
dynamicFvMesh dynamicMotionSolverFvMesh;
solver mesquiteMotionSolver;
//solver laplace;
//diffusivity uniform 1.0;
//diffusivity quadratic;
//distancePatches (topWall);
//frozenDiffusion off;
mesquiteOptions
{
standardCellTypes yes;
// Optimization metric
// optMetric AspectRatioGamma;
optMetric
@ -45,7 +40,8 @@ mesquiteOptions
optAlgorithm FeasibleNewton;
// optAlgorithm ConjugateGradient;
// Termination criteria sub-dictionary (takes default values if not specified)
// Termination criteria sub-dictionary
// (takes default values if not specified)
// Specifying an empty sub-dictionary terminates with available options
tcInner
{

View file

@ -2294,19 +2294,19 @@ boundaryField
{
leftWall
{
type alphaContactAngle;
type multiphaseAlphaContactAngle;
thetaProperties ( ( water air ) 90 0 0 0 ( oil air ) 90 0 0 0 ( mercury air ) 90 0 0 0 ( water oil ) 90 0 0 0 ( water mercury ) 90 0 0 0 ( oil mercury ) 90 0 0 0 );
value uniform 0;
}
rightWall
{
type alphaContactAngle;
type multiphaseAlphaContactAngle;
thetaProperties ( ( water air ) 90 0 0 0 ( oil air ) 90 0 0 0 ( mercury air ) 90 0 0 0 ( water oil ) 90 0 0 0 ( water mercury ) 90 0 0 0 ( oil mercury ) 90 0 0 0 );
value uniform 0;
}
lowerWall
{
type alphaContactAngle;
type multiphaseAlphaContactAngle;
thetaProperties ( ( water air ) 90 0 0 0 ( oil air ) 90 0 0 0 ( mercury air ) 90 0 0 0 ( water oil ) 90 0 0 0 ( water mercury ) 90 0 0 0 ( oil mercury ) 90 0 0 0 );
value uniform 0;
}

View file

@ -34226,19 +34226,19 @@ boundaryField
{
leftWall
{
type alphaContactAngle;
type multiphaseAlphaContactAngle;
thetaProperties ( ( water air ) 90 0 0 0 ( oil air ) 90 0 0 0 ( mercury air ) 90 0 0 0 ( water oil ) 90 0 0 0 ( water mercury ) 90 0 0 0 ( oil mercury ) 90 0 0 0 );
value uniform 0;
}
rightWall
{
type alphaContactAngle;
type multiphaseAlphaContactAngle;
thetaProperties ( ( water air ) 90 0 0 0 ( oil air ) 90 0 0 0 ( mercury air ) 90 0 0 0 ( water oil ) 90 0 0 0 ( water mercury ) 90 0 0 0 ( oil mercury ) 90 0 0 0 );
value uniform 0;
}
lowerWall
{
type alphaContactAngle;
type multiphaseAlphaContactAngle;
thetaProperties ( ( water air ) 90 0 0 0 ( oil air ) 90 0 0 0 ( mercury air ) 90 0 0 0 ( water oil ) 90 0 0 0 ( water mercury ) 90 0 0 0 ( oil mercury ) 90 0 0 0 );
value uniform 0;
}