CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   directMapped problem (https://www.cfd-online.com/Forums/openfoam-bugs/77836-directmapped-problem.html)

panda60 July 6, 2010 02:35

directMapped problem
 
I used the "directMapped" to recycle the velocity back.
This has 3 sampleMode : nearestCell , nearestFace , nearestPatchFace.
in his example , tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped,
nearestCell method works fine. This is the boundary file for nearestCell.
5
(
inlet
{
type directMappedPatch;
nFaces 30;
startFace 27238;
sampleMode nearestCell;
sampleRegion region0;
samplePatch none;
offset (0.0495 0 0);
}
outlet
{
type patch;
nFaces 57;
startFace 27268;
}
upperWall
{
type wall;
nFaces 275;
startFace 27325;
}
lowerWall
{
type wall;
nFaces 302;
startFace 27600;
}
frontAndBack
{
type empty;
nFaces 27570;
startFace 27902;
}
)


but nearestFace method doesn't work well.
In the begining, it doesn't work. Then I changed the startFace to 0, it works, but it doesn't works well, several steps later, it crashed. Who have used this sampleMode, can give some suggestions ? The following is my boundary file for nearestFace.

5
(
inlet
{
type directMappedPatch;
nFaces 30;
startFace 0;
//startFace 27238;
sampleMode nearestFace;
sampleRegion region0;
samplePatch none;
offset (0.05 0 0);
}
outlet
{
type patch;
nFaces 57;
startFace 27268;
}
upperWall
{
type wall;
nFaces 275;
startFace 27325;
}
lowerWall
{
type wall;
nFaces 302;
startFace 27600;
}
frontAndBack
{
type empty;
nFaces 27570;
startFace 27902;
}
)

panda60 July 6, 2010 02:40

This is the mistake, It can run for some steps , but the courant number become larger and larger. but for the same case , courant number is very small for nearestCell mode.

Starting time loop

Reading/calculating field UMean

Reading/calculating field pMean

Reading/calculating field UPrime2Mean

Reading/calculating field pPrime2Mean

fieldAverage: starting averaging at time 0

Time = 1e-05

Courant Number mean: 0.024204 max: 1.13764
DILUPBiCG: Solving for Ux, Initial residual = 0.00135981, Final residual = 1.04805e-07, No Iterations 2
DILUPBiCG: Solving for Uy, Initial residual = 0.00141252, Final residual = 7.49693e-06, No Iterations 1
DICPCG: Solving for p, Initial residual = 1, Final residual = 0.0499349, No Iterations 194
time step continuity errors : sum local = 8.7322e-06, global = 6.38996e-08, cumulative = 6.38996e-08
DICPCG: Solving for p, Initial residual = 0.127359, Final residual = 8.65339e-07, No Iterations 226
time step continuity errors : sum local = 1.94082e-08, global = -1.3159e-10, cumulative = 6.3768e-08
DILUPBiCG: Solving for k, Initial residual = 1, Final residual = 7.12535e-09, No Iterations 3
bounding k, min: 0 max: 2e-05 average: 4.83687e-11
ExecutionTime = 1.16 s ClockTime = 1 s

Calculating averages

Time = 2e-05

Courant Number mean: 0.000585711 max: 0.871542
DILUPBiCG: Solving for Ux, Initial residual = 0.303857, Final residual = 1.61598e-08, No Iterations 3
DILUPBiCG: Solving for Uy, Initial residual = 0.114333, Final residual = 7.83029e-08, No Iterations 3
DICPCG: Solving for p, Initial residual = 0.898325, Final residual = 0.0369587, No Iterations 2
time step continuity errors : sum local = 0.00592267, global = -0.000124207, cumulative = -0.000124144
DICPCG: Solving for p, Initial residual = 0.0244231, Final residual = 9.83326e-07, No Iterations 226
time step continuity errors : sum local = 3.02535e-07, global = -7.0775e-10, cumulative = -0.000124144
DILUPBiCG: Solving for k, Initial residual = 1, Final residual = 4.89965e-06, No Iterations 6
bounding k, min: 0 max: 25.3168 average: 0.0532316
ExecutionTime = 1.68 s ClockTime = 2 s

Calculating averages

Time = 3e-05

Courant Number mean: 0.0246538 max: 36.0409
DILUPBiCG: Solving for Ux, Initial residual = 0.294253, Final residual = 4.29506e-06, No Iterations 16
DILUPBiCG: Solving for Uy, Initial residual = 0.458164, Final residual = 3.0518e-06, No Iterations 16
DICPCG: Solving for p, Initial residual = 0.492606, Final residual = 0.0206054, No Iterations 5
time step continuity errors : sum local = 0.00579525, global = 4.14652e-05, cumulative = -8.26792e-05
DICPCG: Solving for p, Initial residual = 0.773387, Final residual = 9.1193e-07, No Iterations 221
time step continuity errors : sum local = 7.8813e-07, global = -2.04419e-10, cumulative = -8.26794e-05
DILUPBiCG: Solving for k, Initial residual = 0.999976, Final residual = 6.80055e-06, No Iterations 21
bounding k, min: -3.20149e+07 max: 4.00063e+07 average: 95738.9
ExecutionTime = 2.26 s ClockTime = 2 s

Calculating averages

Time = 4e-05

Courant Number mean: 0.315197 max: 1068.95
DILUPBiCG: Solving for Ux, Initial residual = 0.979042, Final residual = 9.4061e-06, No Iterations 18
DILUPBiCG: Solving for Uy, Initial residual = 0.949818, Final residual = 8.38876e-06, No Iterations 18
DICPCG: Solving for p, Initial residual = 0.827225, Final residual = 0.0301906, No Iterations 13
time step continuity errors : sum local = 0.0169686, global = -0.000103875, cumulative = -0.000186555
DICPCG: Solving for p, Initial residual = 0.85666, Final residual = 8.15768e-07, No Iterations 232
time step continuity errors : sum local = 2.46641e-06, global = -5.16787e-09, cumulative = -0.00018656
DILUPBiCG: Solving for k, Initial residual = 0.978689, Final residual = 4.5579e-06, No Iterations 15
bounding k, min: -1.10588e+09 max: 4.91812e+09 average: 1.17185e+07
ExecutionTime = 2.84 s ClockTime = 3 s

Calculating averages

Time = 5e-05

Courant Number mean: 1.41046 max: 1555.81
DILUPBiCG: Solving for Ux, Initial residual = 0.924203, Final residual = 1.62506e-06, No Iterations 16
DILUPBiCG: Solving for Uy, Initial residual = 0.94029, Final residual = 5.49383e-06, No Iterations 15
DICPCG: Solving for p, Initial residual = 0.913204, Final residual = 0.0450328, No Iterations 19
time step continuity errors : sum local = 0.109966, global = -0.00022542, cumulative = -0.00041198
DICPCG: Solving for p, Initial residual = 0.596696, Final residual = 9.26406e-07, No Iterations 238
time step continuity errors : sum local = 9.56009e-06, global = 1.13432e-08, cumulative = -0.000411968
DILUPBiCG: Solving for k, Initial residual = 0.662062, Final residual = 5.35556e-06, No Iterations 16
bounding k, min: -1.99423e+08 max: 1.8116e+10 average: 2.58451e+07
ExecutionTime = 3.42 s ClockTime = 3 s

Calculating averages

Time = 6e-05

Courant Number mean: 5.72067 max: 3297.35
DILUPBiCG: Solving for Ux, Initial residual = 0.923302, Final residual = 6.99527e-06, No Iterations 37
DILUPBiCG: Solving for Uy, Initial residual = 0.929089, Final residual = 6.33574e-06, No Iterations 34
DICPCG: Solving for p, Initial residual = 0.409462, Final residual = 0.0197329, No Iterations 42
time step continuity errors : sum local = 0.379714, global = -8.4655e-06, cumulative = -0.000420434
DICPCG: Solving for p, Initial residual = 0.939138, Final residual = 8.8431e-07, No Iterations 313
time step continuity errors : sum local = 0.000222557, global = -6.49959e-09, cumulative = -0.00042044
DILUPBiCG: Solving for k, Initial residual = 0.998731, Final residual = 3.47805e-06, No Iterations 69
bounding k, min: -6.69884e+12 max: 2.40664e+13 average: 2.25661e+11
ExecutionTime = 4.22 s ClockTime = 4 s

Calculating averages

Time = 7e-05

Courant Number mean: 436.283 max: 1.17029e+06
DILUPBiCG: Solving for Ux, Initial residual = 0.995348, Final residual = 9.2986e-06, No Iterations 57
DILUPBiCG: Solving for Uy, Initial residual = 0.992744, Final residual = 6.17724e-06, No Iterations 54
DICPCG: Solving for p, Initial residual = 0.487341, Final residual = 0.02222, No Iterations 25
time step continuity errors : sum local = 3.22783, global = -0.00159004, cumulative = -0.00201048
DICPCG: Solving for p, Initial residual = 0.10418, Final residual = 8.93725e-07, No Iterations 299
time step continuity errors : sum local = 0.0078815, global = 6.62659e-05, cumulative = -0.00194422
DILUPBiCG: Solving for k, Initial residual = 0.94952, Final residual = 7.63282e-06, No Iterations 69
bounding k, min: -5.5737e+13 max: 9.88183e+14 average: 2.78675e+12
ExecutionTime = 5.05 s ClockTime = 5 s

Calculating averages

Time = 8e-05

Courant Number mean: 1395.91 max: 2.24264e+06
DILUPBiCG: Solving for Ux, Initial residual = 0.964108, Final residual = 0.000784567, No Iterations 1001
DILUPBiCG: Solving for Uy, Initial residual = 0.96877, Final residual = 0.328677, No Iterations 1001
DICPCG: Solving for p, Initial residual = 0.988575, Final residual = 0.251688, No Iterations 1001
time step continuity errors : sum local = 432823, global = -0.00106481, cumulative = -0.00300903
DICPCG: Solving for p, Initial residual = 0.995421, Final residual = 0.61434, No Iterations 1001
time step continuity errors : sum local = 5.2277e+08, global = 0.0130431, cumulative = 0.0100341
DILUPBiCG: Solving for k, Initial residual = 0.999993, Final residual = 177.682, No Iterations 1001
bounding k, min: -1.62152e+26 max: 3.6456e+27 average: 3.17189e+23
ExecutionTime = 11.18 s ClockTime = 11 s

Calculating averages

Time = 9e-05

Courant Number mean: 2.34159e+09 max: 2.46191e+12
DILUPBiCG: Solving for Ux, Initial residual = 0.999974, Final residual = 192336, No Iterations 1001
DILUPBiCG: Solving for Uy, Initial residual = 0.999985, Final residual = 1.85635, No Iterations 1001
DICPCG: Solving for p, Initial residual = 1, Final residual = 1.7607, No Iterations 1001
time step continuity errors : sum local = 1.06145e+20, global = 4.30835e+12, cumulative = 4.30835e+12
DICPCG: Solving for p, Initial residual = 0.0924095, Final residual = 0.998441, No Iterations 1001
time step continuity errors : sum local = 2.50599e+23, global = 7.6643e+15, cumulative = 7.66861e+15
#0 Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/OSspecific/POSIX/printStack.C:202
#1 Foam::sigFpe::sigFpeHandler(int) at ~/OpenFOAM/OpenFOAM-1.7.0/src/OSspecific/POSIX/signals/sigFpe.C:127
#2 ?? in "/lib64/libc.so.6"
#3 Foam::NVDTVD::r(double, double, double, Foam::Vector<double> const&, Foam::Vector<double> const&, Foam::Vector<double> const&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/NVDTVD.H:117
#4 Foam::limitedLinearLimiter<Foam::NVDTVD>::limiter( double, double, double const&, double const&, Foam::Vector<double> const&, Foam::Vector<double> const&, Foam::Vector<double> const&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/limitedLinear.H:93
#5 Foam::LimitedScheme<double, Foam::limitedLinearLimiter<Foam::NVDTVD>, Foam::limitFuncs::magSqr>::limiter(Foam::Geometric Field<double, Foam::fvPatchField, Foam::volMesh> const&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/LimitedScheme.C:85
#6 Foam::limitedSurfaceInterpolationScheme<double>::w eights(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/limitedSurfaceInterpolationScheme.C:208
#7 Foam::fv::gaussConvectionScheme<double>::fvmDiv(Fo am::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/gaussConvectionScheme.C:75
#8 Foam::tmp<Foam::fvMatrix<double> > Foam::fvm::div<double>(Foam::GeometricField<double , Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvmDiv.C:60
#9 Foam::tmp<Foam::fvMatrix<double> > Foam::fvm::div<double>(Foam::GeometricField<double , Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvmDiv.C:86
#10 Foam::incompressible::LESModels::oneEqEddy::correc t(Foam::tmp<Foam::GeometricField<Foam::Tensor<doub le>, Foam::fvPatchField, Foam::volMesh> > const&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/turbulenceModels/incompressible/LES/oneEqEddy/oneEqEddy.C:110
#11 Foam::incompressible::LESModel::correct() at ~/OpenFOAM/OpenFOAM-1.7.0/src/turbulenceModels/incompressible/LES/LESModel/LESModel.C:154
#12 main at ~/OpenFOAM/OpenFOAM-1.7.0/applications/solvers/incompressible/pisoFoam/pisoFoam.C:130
#13 __libc_start_main in "/lib64/libc.so.6"
#14 _start at /usr/src/packages/BUILD/glibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116
Floating point exception

panda60 July 8, 2010 03:00

In OpeFOAM's own tutorial, tutorials/incompressible/pisoFoam/les/pitzDailyDirectMapped,

I just change "nearestCell" to "nearestFace" in boundary file, but has the following error:

Courant Number mean: 0.024204 max: 0.660037

--> FOAM FATAL ERROR:
start 27238 out of range 0 ... 29

From function UList<T>::checkStart(const label)
in file /home/yoshie27-openfoam/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/UListI.H at line 77.
FOAM aborting
#0 Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/OSspecific/POSIX/printStack.C:202
#1 Foam::error::abort() at ~/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/error.C:249
#2 Foam::Ostream& Foam::operator<< <Foam::error>(Foam::Ostream&, Foam::errorManip<Foam::error>) at ~/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/errorManip.H:86
#3 Foam::UList<Foam::Vector<double> >::checkStart(int) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/UListI.H:81
#4 Foam::SubList<Foam::Vector<double> >::SubList(Foam::UList<Foam::Vector<double> > const&, int, int) at ~/OpenFOAM/OpenFOAM-1.7.0/src/OpenFOAM/lnInclude/SubListI.H:60
#5 Foam::List<Foam::Vector<double> >::subList const Foam::fvPatch::patchSlice<Foam::Vector<double> >(Foam::List<Foam::Vector<double> > const&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvPatch.H:189
#6 Foam::directMappedFixedValueFvPatchField<Foam::Vec tor<double> >::updateCoeffs() in "/home/yoshie27-openfoam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPDebug/libfiniteVolume.so"
#7 Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::updateCoef fs() in "/home/yoshie27-openfoam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPDebug/libincompressibleLESModels.so"
#8 Foam::fvMatrix<Foam::Vector<double> >::fvMatrix(Foam::GeometricField<Foam::Vector<doub le>, Foam::fvPatchField, Foam::volMesh>&, Foam::dimensionSet const&) in "/home/yoshie27-openfoam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPDebug/libincompressibleLESModels.so"
#9 Foam::fv::gaussLaplacianScheme<Foam::Vector<double >, double>::fvmLaplacianUncorrected(Foam::GeometricFi eld<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianScheme.C:63
#10 Foam::fv::gaussLaplacianScheme<Foam::Vector<double >, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/finiteVolume/laplacianSchemes/gaussLaplacianScheme/gaussLaplacianSchemes.C:113
#11 Foam::fv::laplacianScheme<Foam::Vector<double>, double>::fvmLaplacian(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) in "/home/yoshie27-openfoam/OpenFOAM/OpenFOAM-1.7.0/lib/linux64GccDPDebug/libfiniteVolume.so"
#12 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&, Foam::word const&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvmLaplacian.C:219
#13 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvmLaplacian.C:251
#14 Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > > Foam::fvm::laplacian<Foam::Vector<double>, double>(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) at ~/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvmLaplacian.C:264
#15 Foam::incompressible::LESModels::GenEddyVisc::divD evBeff(Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/turbulenceModels/incompressible/LES/GenEddyVisc/GenEddyVisc.C:94
#16 Foam::incompressible::LESModel::divDevReff(Foam::G eometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&) const at ~/OpenFOAM/OpenFOAM-1.7.0/src/turbulenceModels/incompressible/LES/LESModel/LESModel.H:240
#17 main at ~/OpenFOAM/OpenFOAM-1.7.0/applications/solvers/incompressible/pisoFoam/pisoFoam.C:69
#18 __libc_start_main in "/lib64/libc.so.6"
#19 _start at /usr/src/packages/BUILD/glibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:116
Aborted


It said "start 27238 out of range 0 ... 29". So it seems that we should use:
nFaces 30;
startFace 0;
sampleMode nearestFace;

or
nFaces 30;
startFace 0;
sampleMode nearestCell;

why startFace should be 0 when using nearestFace ?

when using "startFace 0" , simulation can begin, but the courant number is very large, and several steps later, crashed.

Can anybody give me some suggestions ? Thanks.

mattijs July 8, 2010 05:07

This is not a bug - you cannot change the startFace in the boundary file, this is part of the mesh description.

Changing the sampleMode to nearestFace means that now the underlying directMappedPatch returns face labels instead of cell labels. The boundary condition does not know this and just uses these incorrect labels to index the field.

You will have to write your own boundary condition if you want to map from a surfaceField (on faces).

Thanks,

Mattijs

panda60 July 8, 2010 10:23

Dear mattijs ,

Thank you very much.
You means nearestFace can't be used at all ? I should write my own boundary condition totally ?

How can I modify to make nearestFace method can be used ? I have tested this condition, the error just come from the last part.
newValues = this->patch().patchSlice(allValues); here has problem.

case directMappedPatchBase::NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const fieldType& nbrField = nbrMesh.lookupObject<fieldType>
(
fldName
);
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf =
nbrField.boundaryField()[patchI];
label faceStart = pf.patch().patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
allValues
);
// Here can't pass
newValues = this->patch().patchSlice(allValues);
break;
}


All times are GMT -4. The time now is 20:18.