利用散点插值成连续曲线作为另外一个几何的边界条件?
-
我现在有个一个压强随x方向变化的散点文件,我现在需要对这个散点进行插值形成曲线作为另外一个几何边界的边界条件,在OF中该怎么实现呢?
-
请参考下面的边界条件:
inlet { type fixedProfile; profile csvFile; profileCoeffs { nHeaderLine 1; // Number of header lines refColumn 0; // Reference column index componentColumns (1); // Component column indices separator ","; // Optional (defaults to ",") mergeSeparators no; // Merge multiple separators fileName "inletProfiles/alpha.csv"; outOfBounds clamp; // Optional out-of-bounds handling interpolationScheme linear; // Optional interpolation scheme } direction (1 0 0); origin 0; }
-
boundaryField
{
front
{
type empty;
}
cyc_left
{
type cyclic;
}
top
{
type uniformTotalPressure;
profile csvFile;
profileCoeffs
{
nHeaderLine 0; // Number of header lines
refColumn 0; // Reference column index
componentColumns (1 2); // Component column indices
separator ","; // Optional (defaults to ",")
mergeSeparators no; // Merge multiple separators
fileName "dataFile.csv"; // name of csv data file
outOfBounds clamp; // Optional out-of-bounds handling
interpolationScheme linear; // Optional interpolation scheme
}
direction (1 0 0);
origin 0;
}
bottom
{
type zeroGradient;
}
back
{
type empty;
}
cyc_right
{
type cyclic;
}
}data file 格式
0,0
0.005,0.043
0.01,0.158
0.015,0.311
0.02,0.482
0.025,0.663
0.03,0.845
0.035,1.022
0.04,1.187
0.045,1.334
0.05,1.46
0.055,1.561
0.06,1.637
0.065,1.69
0.07,1.723
0.075,1.737
0.08,1.735
0.085,1.717
0.09,1.688
0.095,1.648
0.1,1.599
0.105,1.543
0.11,1.48
0.115,1.412
0.12,1.34
0.125,1.263
0.13,1.183
0.135,1.099
0.14,1.012
0.145,0.922
0.15,0.829
0.155,0.733
0.16,0.633
0.165,0.531
0.17,0.425
0.175,0.315
0.18,0.201
0.185,0.083
0.19,-0.041
0.195,-0.172
0.2,-0.31
0.205,-0.457
0.21,-0.615
0.215,-0.789
0.22,-0.982
0.225,-1.21
0.23,-1.469
0.235,-1.853
0.24,-2.185
0.245,-2.948
0.25,-2.923
0.255,-2.011
0.26,-1.717
0.265,-1.562
0.27,-1.437
0.275,-1.32
0.28,-1.209
0.285,-1.101
0.29,-0.996
0.295,-0.894
0.3,-0.797
0.305,-0.702
0.31,-0.61
0.315,-0.521
0.32,-0.437
0.325,-0.358
0.33,-0.285
0.335,-0.22
0.34,-0.152
0.345,-0.065
0.35,-0.017但是一直报错,找了好久也没找出原因来
--> FOAM FATAL IO ERROR:
keyword file is undefined in dictionary "/home/qihao/OpenFOAM/qihao-5.0/run/hyporheic/Hyporheic/Groundwater/Stratified/0/p.boundaryField.top.profileCoeffs"file: /home/qihao/OpenFOAM/qihao-5.0/run/hyporheic/Hyporheic/Groundwater/Stratified/0/p.boundaryField.top.profileCoeffs from line 38 to line 45.
From function const Foam::entry& Foam::dictionary::lookupEntry(const Foam::word&, bool, bool) const in file db/dictionary/dictionary.C at line 566.
-
p文件用的是这个,上面回复错了
boundaryField
{
front
{
type empty;
}
cyc_left
{
type cyclic;
}
top
{
type fixedProfile;;
profile csvFile;
profileCoeffs
{
nHeaderLine 0; // Number of header lines
refColumn 0; // Reference column index
componentColumns (1 2); // Component column indices
separator ","; // Optional (defaults to ",")
mergeSeparators no; // Merge multiple separators
fileName "dataFile.csv"; // name of csv data file
outOfBounds clamp; // Optional out-of-bounds handling
interpolationScheme linear; // Optional interpolation scheme
}
direction (1 0 0);
origin 0;
}
bottom
{
type zeroGradient;
}
back
{
type empty;
}
cyc_right
{
type cyclic;
}
}
2/6