gaza |
February 8, 2019 05:56 |
Hi
I have similar problem
after mesh refinement one of the field is unchanged
Code:
--> FOAM FATAL ERROR:
index 10240 out of range 0 ... 10239
From function void Foam::UList<T>::checkIndex(Foam::label) const [with T = double; Foam::label = int]
in file /home/przemek/OpenFOAM/OpenFOAM-v1612+/src/OpenFOAM/lnInclude/UListI.H at line 106.
FOAM aborting
I found that the reason is the line
Code:
volVectorField gradAlpha(fvc::grad(smoothAlpha_));
smoothAlpha_ is created in the constructor as follows
Code:
Foam::smoothInterfaceProperties::smoothInterfaceProperties
(
const volScalarField& alpha1,
const volVectorField& U,
const IOdictionary& dict
)
:
transportPropertiesDict_(dict),
cAlpha_
(
readScalar
(
alpha1.mesh().solverDict(alpha1.name()).lookup("cAlpha")
)
),
smoothItr_
(
readScalar
(
alpha1.mesh().solutionDict().subDict("PIMPLE").lookup("smoothItr")
)
),
kSmoothItr_
(
readScalar
(
alpha1.mesh().solutionDict().subDict("PIMPLE").lookup("kSmoothItr")
)
),
sigma_("sigma", dimensionSet(1, 0, -2, 0, 0), dict),
deltaN_
(
"deltaN",
1e-8/pow(average(alpha1.mesh().V()), 1.0/3.0)
),
smoothAlpha_(alpha1),
alpha1_(alpha1),
U_(U),
nHatf_
(
IOobject
(
"nHatf",
alpha1_.time().timeName(),
alpha1_.mesh()
),
alpha1_.mesh(),
dimensionedScalar("nHatf", dimArea, 0.0)
),
K_
(
IOobject
(
"smoothInterfaceProperties:K",
alpha1_.time().timeName(),
alpha1_.mesh()
),
alpha1_.mesh(),
dimensionedScalar("K", dimless/dimLength, 0.0)
)
{
calculateK();
}
and
Code:
class smoothInterfaceProperties
{
// Private data
//- Keep a reference to the transportProperties dictionary
const dictionary& transportPropertiesDict_;
//- Compression coefficient
scalar cAlpha_;
// iteration numbers over smooth function
scalar smoothItr_;
// iteration numbers over smooth function for curvature, 0 represent no smooth
scalar kSmoothItr_;
//- Surface tension
dimensionedScalar sigma_;
//- Stabilisation for normalisation of the interface normal
const dimensionedScalar deltaN_;
volScalarField smoothAlpha_;
const volScalarField& alpha1_;
const volVectorField& U_;
surfaceScalarField nHatf_;
volScalarField K_;
// Private Member Functions
//- Disallow default bitwise copy construct and assignment
smoothInterfaceProperties(const smoothInterfaceProperties&);
void operator=(const smoothInterfaceProperties&);
//- Correction for the boundary condition on the unit normal nHat on
// walls to produce the correct contact dynamic angle
// calculated from the component of U parallel to the wall
void correctContactAngle
(
surfaceVectorField::Boundary& nHat,
surfaceVectorField::Boundary& gradAlphaf
) const;
//- Re-calculate the interface curvature
void calculateK();
public:
//- Conversion factor for degrees into radians
static const scalar convertToRad;
// Constructors
//- Construct from volume fraction field gamma and IOdictionary
smoothInterfaceProperties
(
const volScalarField& alpha1,
const volVectorField& U,
const IOdictionary&
);
// Member Functions
scalar cAlpha() const
{
return cAlpha_;
}
const dimensionedScalar& deltaN() const
{
return deltaN_;
}
const surfaceScalarField& nHatf() const
{
return nHatf_;
}
const volScalarField& K() const
{
return K_;
}
const volScalarField& smoothAlpha() const
{
return smoothAlpha_;
}
const dimensionedScalar& sigma() const
{
return sigma_;
}
tmp<volScalarField> sigmaK() const
{
return sigma_*K_;
}
tmp<surfaceScalarField> surfaceTensionForce() const;
//- Indicator of the proximity of the interface
// Field values are 1 near and 0 away for the interface.
tmp<volScalarField> nearInterface() const;
void correct()
{
calculateK();
}
//- Read transportProperties dictionary
bool read();
};
When I change the problematic line into
Code:
volVectorField gradAlpha(fvc::grad(alpha1_));
everything goes well. But I need the version
Code:
volVectorField gradAlpha(fvc::grad(smoothAlpha_));
Can anybody explain why the line with alpha1_ works and smoothAlpha_ does not?
|