初めまして.CFD初心者の田中と申します.
以下に述べる問題について,何かアドバイスを戴ければと思い投稿しました.
[状況と目標]
1. 対象とするのは,淀み圧力で駆動され,途中にノズル様の細い流路を含むような流れ.
2. OpenFOAMでこの流れの定常解を発散させず,かつなるべく早く収束させたい.
3. 最終的にはrhoSimpleFoam & RASで計算したいが,まずはsimpleFoam & laminarで収束する解を得たい.
[考えられる策]
1. 初期条件において勾配のある圧力分布を与える(internalField #codeStreamで実現できた).
2. 緩和係数を反復ステップに対し徐々に増加するように与える.
[今回相談したい点]
方策2.の緩和係数の制御についてです.反復ステップnに対して (緩和係数) = a/(1+exp(-(n-0.5b)/0.1b) といった風にシグモイド関数で緩和係数を与えたいと考えています.
試みに,system/fvSolutionにてUの緩和係数を#codeStreamを用いて下記"fvSolution"のように書き換えてみましたが,同じく下記"log.simpleFoam"に示すようなエラーを得ました(なぜか添付するとエラーで投稿できなかったので直打ちで失礼します).
原因として考えているのは,以下の2通りです.
1. もしかすると計算実行時にfvSolutionが参照されるのは最初の1回だけで,反復ステップと結び付けること自体がナンセンスなのではないか.
2. codeInclude等の記述に誤りがあるのではないか.依存関係の漏れなど.
上記緩和係数の制御について,またそれ以外のお気づきの点についてご意見戴けると幸いです.宜しくお願いします.
****************** 以下,"fvSolution" ******************
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver GAMG;
tolerance 1e-06;
relTol 0.1;
smoother GaussSeidel;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0.1;
}
Phi
{
solver GAMG;
smoother DIC;
tolerance 1e-06;
relTol 0.01;
}
}
potentialFlow
{
nNonOrthogonalCorrectors 10;
}
SIMPLE
{
nNonOrthogonalCorrectors 1;
consistent yes;
residualControl
{
p 1e-3;
U 1e-4;
}
}
relaxationFactors
{
equations
{
U #codeStream
{
codeInclude
#{
#include "fvCFD.H"
#};
codeOptions
#{
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
#};
codeLibs
#{
-lmeshTools \
-lfiniteVolume
#};
code
#{
const IOdictionary& d = static_cast<const IOdictionary&>(dict);
const scalar t = d.db().time().timeOutputValue();
const scalar N = 1000.;
scalar relax = 0.001;
relax = 0.8 / ( 1. + exp(-(t-N/2.)*10/N) );
os << relax;
#};
};
".*" 0.002; //
}
}
// ************************************************************************* //
****************** 以上,"fvSolution" ******************
**************** 以下,"log.simpleFoam" ****************
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : v2006 OPENFOAM=2006
Arch : "LSB;label=32;scalar=64"
Exec : simpleFoam -parallel
Date : Jan 07 2021
Time : 00:39:39
Host : 94a34c429a4d
PID : 713
I/O : uncollated
Case : /mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run
nProcs : 4
Hosts :
(
(94a34c429a4d 4)
)
Pstream initialized with:
floatTransfer : 0
nProcsSimpleSum : 0
commsType : nonBlocking
polling iterations : 0
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 5, maxFileModificationPolls 20)
allowSystemOperations : Allowing user-supplied system call operations
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time
Create mesh for time = 0
Using #codeStream at line 65 in file "/mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/system/fvSolution.relaxationFactors.equations"
Using #codeStream with "/mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444.so"
Could not load "/mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444.so"
/mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444.so: cannot open shared object file: No such file or directory
Creating new library in "dynamicCode/_99d2e90d9645a19e3a54f4f1b9350a139906a444/platforms/linux64GccDPInt32Opt/lib/libcodeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444.so"
Invoking wmake libso /mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/_99d2e90d9645a19e3a54f4f1b9350a139906a444
wmake libso /mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/_99d2e90d9645a19e3a54f4f1b9350a139906a444
make: Warning: File `Make/options' has modification time 0.1 s in the future
make: Warning: File `Make/linux64GccDPInt32Opt/options' has modification time 0.13 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File `Make/linux64GccDPInt32Opt/options' has modification time 0.097 s in the future
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File `Make/linux64GccDPInt32Opt/sourceFiles' has modification time 0.11 s in the future
ln: ./lnInclude
make: warning: Clock skew detected. Your build may be incomplete.
make: Warning: File `Make/linux64GccDPInt32Opt/sourceFiles' has modification time 0.048 s in the future
dep: codeStreamTemplate.C
make: Warning: File `Make/linux64GccDPInt32Opt/codeStreamTemplate.C.dep' has modification time 0.12 s in the future
Ctoo: codeStreamTemplate.C
/mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/system/fvSolution.relaxationFactors.equations.#codeStream: In function 'void Foam::codeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444(Foam::Ostream&, const Foam::dictionary&)':
/mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/system/fvSolution.relaxationFactors.equations.#codeStream:88:21: warning: variable 'relax' set but not used [-Wunused-but-set-variable]
ld: /mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/_99d2e90d9645a19e3a54f4f1b9350a139906a444/../platforms/linux64GccDPInt32Opt/lib/libcodeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444.so
make: warning: Clock skew detected. Your build may be incomplete.
[0] #0 Foam::error::printStack(Foam::Ostream&) at ??:?
[0] #1 Foam::sigSegv::sigHandler(int) at ??:?
[0] #2 ? in /lib64/libpthread.so.0
[0] #3 codeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444 at /opt/OpenFOAM/OpenFOAM-v2006/src/OpenFOAM/lnInclude/TimeStateI.H:32
[0] #4 Foam::functionEntries::codeStream::evaluate(Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #5 Foam::functionEntries::codeStream::execute(Foam::dictionary const&, Foam::primitiveEntry&, Foam::Istream&) at ??:?
[0] #6 Foam::functionEntry::execute(Foam::word const&, Foam::dictionary const&, Foam::primitiveEntry&, Foam::Istream&) at ??:?
[0] #7 Foam::primitiveEntry::acceptToken(Foam::token const&, Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #8 Foam::primitiveEntry::read(Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #9 Foam::primitiveEntry::readEntry(Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #10 Foam::primitiveEntry::primitiveEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #11 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?
[0] #12 Foam::dictionary::read(Foam::Istream&, bool) at ??:?
[0] #13 Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&, bool) at ??:?
[0] #14 Foam::dictionaryEntry::dictionaryEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #15 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?
[0] #16 Foam::dictionary::read(Foam::Istream&, bool) at ??:?
[0] #17 Foam::dictionary::dictionary(Foam::fileName const&, Foam::dictionary const&, Foam::Istream&, bool) at ??:?
[0] #18 Foam::dictionaryEntry::dictionaryEntry(Foam::keyType const&, Foam::dictionary const&, Foam::Istream&) at ??:?
[0] #19 Foam::entry::New(Foam::dictionary&, Foam::Istream&, Foam::entry::inputMode, int) at ??:?
[0] #20 Foam::dictionary::read(Foam::Istream&, bool) at ??:?
[0] #21 Foam::operator>>(Foam::Istream&, Foam::dictionary&) at ??:?
[0] #22 Foam::baseIOdictionary::readData(Foam::Istream&) at ??:?
[0] #23 Foam::fileOperations::uncollatedFileOperation::read(Foam::regIOobject&, bool, Foam::IOstreamOption::streamFormat, Foam::word const&) const at ??:?
[0] #24 Foam::regIOobject::readHeaderOk(Foam::IOstreamOption::streamFormat, Foam::word const&) at ??:?
[0] #25 Foam::IOdictionary::IOdictionary(Foam::IOobject const&) at ??:?
[0] #26 Foam::solution::solution(Foam::objectRegistry const&, Foam::fileName const&) at ??:?
[0] #27 Foam::fvMesh::fvMesh(Foam::IOobject const&) at ??:?
[0] #28 ? at ??:?
[0] #29 __libc_start_main in /lib64/libc.so.6
[0] #30 ? at ??:?
[94a34c429a4d:00713] *** Process received signal ***
[94a34c429a4d:00713] Signal: Segmentation fault (11)
[94a34c429a4d:00713] Signal code: (-6)
[94a34c429a4d:00713] Failing at address: 0x3e8000002c9
[94a34c429a4d:00713] [ 0] /lib64/libpthread.so.0(+0xf5e0)[0x7fc90c5e45e0]
[94a34c429a4d:00713] [ 1] /lib64/libpthread.so.0(raise+0x2b)[0x7fc90c5e44ab]
[94a34c429a4d:00713] [ 2] /lib64/libpthread.so.0(+0xf5e0)[0x7fc90c5e45e0]
[94a34c429a4d:00713] [ 3] /mnt/d/OpenFOAM/STAR-CCM+training/0101_MSNozzleIncompressibleLaminar/2_run/dynamicCode/platforms/linux64GccDPInt32Opt/lib/libcodeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444.so(codeStream_99d2e90d9645a19e3a54f4f1b9350a139906a444+0x15)[0x7fc8efa519e5]
[94a34c429a4d:00713] [ 4] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam15functionEntries10codeStream8evaluateERKNS_10dictionaryERNS_7IstreamE+0x398)[0x7fc90d7150d8]
[94a34c429a4d:00713] [ 5] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam15functionEntries10codeStream7executeERKNS_10dictionaryERNS_14primitiveEntryERNS_7IstreamE+0x5a)[0x7fc90d715bea]
[94a34c429a4d:00713] [ 6] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam13functionEntry7executeERKNS_4wordERKNS_10dictionaryERNS_14primitiveEntryERNS_7IstreamE+0x229)[0x7fc90d719319]
[94a34c429a4d:00713] [ 7] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam14primitiveEntry11acceptTokenERKNS_5tokenERKNS_10dictionaryERNS_7IstreamE+0x1b7)[0x7fc90d70c7c7]
[94a34c429a4d:00713] [ 8] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam14primitiveEntry4readERKNS_10dictionaryERNS_7IstreamE+0xeb)[0x7fc90d70cdcb]
[94a34c429a4d:00713] [ 9] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam14primitiveEntry9readEntryERKNS_10dictionaryERNS_7IstreamE+0x2d)[0x7fc90d70d9ad]
[94a34c429a4d:00713] [10] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam14primitiveEntryC2ERKNS_7keyTypeERKNS_10dictionaryERNS_7IstreamE+0x2d9)[0x7fc90d70e2e9]
[94a34c429a4d:00713] [11] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5entry3NewERNS_10dictionaryERNS_7IstreamENS0_9inputModeEi+0x1104)[0x7fc90d708814]
[94a34c429a4d:00713] [12] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam10dictionary4readERNS_7IstreamEb+0x143)[0x7fc90d6ff913]
[94a34c429a4d:00713] [13] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam10dictionaryC1ERKNS_8fileNameERKS0_RNS_7IstreamEb+0x112)[0x7fc90d700f82]
[94a34c429a4d:00713] [14] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam15dictionaryEntryC2ERKNS_7keyTypeERKNS_10dictionaryERNS_7IstreamE+0x45)[0x7fc90d70ee65]
[94a34c429a4d:00713] [15] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5entry3NewERNS_10dictionaryERNS_7IstreamENS0_9inputModeEi+0x1564)[0x7fc90d708c74]
[94a34c429a4d:00713] [16] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam10dictionary4readERNS_7IstreamEb+0x143)[0x7fc90d6ff913]
[94a34c429a4d:00713] [17] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam10dictionaryC1ERKNS_8fileNameERKS0_RNS_7IstreamEb+0x112)[0x7fc90d700f82]
[94a34c429a4d:00713] [18] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam15dictionaryEntryC2ERKNS_7keyTypeERKNS_10dictionaryERNS_7IstreamE+0x45)[0x7fc90d70ee65]
[94a34c429a4d:00713] [19] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam5entry3NewERNS_10dictionaryERNS_7IstreamENS0_9inputModeEi+0x1564)[0x7fc90d708c74]
[94a34c429a4d:00713] [20] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam10dictionary4readERNS_7IstreamEb+0x143)[0x7fc90d6ff913]
[94a34c429a4d:00713] [21] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4FoamrsERNS_7IstreamERNS_10dictionaryE+0x3e)[0x7fc90d7001ae]
[94a34c429a4d:00713] [22] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam16baseIOdictionary8readDataERNS_7IstreamE+0x20)[0x7fc90d724d00]
[94a34c429a4d:00713] [23] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZNK4Foam14fileOperations23uncollatedFileOperation4readERNS_11regIOobjectEbNS_14IOstreamOption12streamFormatERKNS_4wordE+0x13a)[0x7fc90d5b05fa]
[94a34c429a4d:00713] [24] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam11regIOobject12readHeaderOkENS_14IOstreamOption12streamFormatERKNS_4wordE+0x62)[0x7fc90d734f42]
[94a34c429a4d:00713] [25] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam12IOdictionaryC1ERKNS_8IOobjectE+0x37)[0x7fc90d725057]
[94a34c429a4d:00713] [26] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so(_ZN4Foam8solutionC1ERKNS_14objectRegistryERKNS_8fileNameE+0x95)[0x7fc90d79db15]
[94a34c429a4d:00713] [27] /opt/OpenFOAM/OpenFOAM-v2006/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so(_ZN4Foam6fvMeshC2ERKNS_8IOobjectE+0x97)[0x7fc9109c6ee7]
[94a34c429a4d:00713] [28] simpleFoam[0x41b8a7]
[94a34c429a4d:00713] [29] /lib64/libc.so.6(__libc_start_main+0xf5)[0x7fc90c233c05]
[94a34c429a4d:00713] *** End of error message ***
--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 713 on node 94a34c429a4d exited on signal 11 (Segmentation fault).
--------------------------------------------------------------------------
**************** 以上,"log.simpleFoam" ****************