# 【OpenFOAMv1706】new cannot satisfy memory request.

OpenFOAMv1706で出たエラーとその原因・対処法

スポンサーリンク

## エラー内容

log.pimpleFOAMを見ると次のようなエラーが出ていた

/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v1706                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : v1706
Arch   : "LSB;label=64;scalar=64"
Exec   : pimpleFoam -parallel
Date   : Nov 27 2021
Time   : 11:07:05
Host   : "ZZZ"
PID    : 01234
Case   : /home/XXX/OpenFOAM/XXX-v1706/caseName
nProcs : 36
Slaves :
35
(
:
)

Pstream initialized with:
floatTransfer      : 0
nProcsSimpleSum    : 0
commsType          : nonBlocking
polling iterations : 0
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

PIMPLE: Operating solver in PISO mode

AMI: Creating addressing and weights between 1552 source faces and 1552 target faces
AMI: Patch source sum(weights) min/max/average = 1, 1, 1
AMI: Patch target sum(weights) min/max/average = 1, 1, 1
AMI: Creating addressing and weights between 1552 source faces and 1552 target faces
AMI: Patch source sum(weights) min/max/average = 1, 1, 1
AMI: Patch target sum(weights) min/max/average = 1, 1, 1
Selecting incompressible transport model Newtonian
Selecting turbulence model type LES
Selecting LES turbulence model HLR
Selecting LES delta type maxSqrtFace
Selecting patchDistMethod meshWave
new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared librarynew cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library
[sca1147:13011] *** Process received signal ***
[sca1147:13011] Signal: Aborted (6)
[sca1147:13011] Signal code:  (-6)
new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library
[sca1147:13002] *** Process received signal ***
[sca1147:13002] Signal: Aborted (6)
[sca1147:13002] Signal code:  (-6)
new cannot satisfy memory request.
This does not necessarily mean you have run out of virtual memory.
It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library
[sca1147:13006] *** Process received signal ***
[sca1147:13006] Signal: Aborted (6)
[sca1147:13006] Signal code:  (-6)
（以下，無限に続くエラー文）

## 原因

newのメモリーリクエストのエラーと書いてあるので，新しい配列を宣言した箇所を探ってみる

ソースコードを調べたところ，.Cファイルで粘性散逸率epsilon_を宣言する前に他の変数の初期化で使ってしまっていた

    epsilonLES_
(
IOobject
(
"epsilonLES",
runTime_.timeName(),
mesh_,
IOobject::AUTO_WRITE
),
epsilon_ // <- error!
),

epsilonRANS_
(
IOobject
(
"epsilonRANS",
runTime_.timeName(),
mesh_,
IOobject::AUTO_WRITE
),
epsilon_ // <- error!
),

epsilon_
(
IOobject
(
IOobject::groupName("epsilon", alphaRhoPhi.group()),
runTime_.timeName(),
mesh_,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("small",dimensionSet(0,2,-3,0,0,0,0),SMALL)
),

## 対処法

（.Cファイル）

    epsilonLES_
(
IOobject
(
"epsilonLES",
runTime_.timeName(),
mesh_,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("small",dimensionSet(0,2,-3,0,0,0,0),SMALL)
),

epsilonRANS_
(
IOobject
(
"epsilonRANS",
runTime_.timeName(),
mesh_,
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar("small",dimensionSet(0,2,-3,0,0,0,0),SMALL)
),

epsilon_
(
IOobject
(
IOobject::groupName("epsilon", alphaRhoPhi.group()),
runTime_.timeName(),
mesh_,
),