新手求问冲击波管喷出的低马赫数supersonic的 边界条件问题
-
感谢李老师回复!
用snappyHexMesh画六面体网格后发现问题解决了!!
但是还有个问题为什么画的网格感觉好多小的瑕疵。。。。而且这还是完全没有细化也没有添加layers的情况。。
还想请老师帮忙看下snappyHexMeshDic。
这个是snappyHexMeshDic:
https://www.dropbox.com/s/ehr4vknk6injnvr/snappyHexMeshDict?dl=0这个是case
https://www.dropbox.com/s/xzhhygrywtj3g2r/1.zip?dl=0Ryo
-
@李东岳 在 新手求问冲击波管喷出的低马赫数supersonic的 边界条件问题 中说:
volScalar
感谢回复
这个代码的意思是修改求解器重新建立一个可单独计算密度的场吗,如果是的话 还需不需要在ControlDic里加rho function。
然后代码是不是要放在 applications/solvers/compressible/sonicFoam/createFields.H里面?不知道是不是我用的Mac系统,找了一下午找不到createFields.H这个文件。。applications文件夹也没有找到。这些文件是不是隐藏在docker里面,怎么打开这些隐藏文件?
麻烦老师了🙏Ryo
-
@李东岳
李老师,现在发现openfoam Mac版的applications文件夹好像只存在于docker模拟的虚拟机里面在Mac上找不到。用vim在docker状态下找到createfields.H文件了,用vim打开后发现里面已经有一个rho的场存在,代码和您写的是一样的。
是不是要像速度场那样 加上IOobject::MUST_READ,IObject::AUTO_WRITE这些代码才行,现在还没有完全理解这些代码的含义。比如 "Reading field U\n" << endl里面的这个n和endl是什么意思。。网上找了很久也没有发现答案。希望老师能解答一下🙏 -
@李东岳
感谢回复🙏现在所在的这个研究室在做用独创的激光CT法观测从冲击波管里面喷出的冲击波密度场。 所以我现在想用OpenFOAM作为CFD工具模拟出冲击波的密度场,然后再和真实实验中的图像数据做对比。
sonicfoam里面计算出的结果没发显示密度,在网上找了个代表密度函数的代码放到controldict里面后可以显示密度了但是不能直接在0文件夹里面调节初始密度场。
这是放在controlDict里面的代码
现在把Oobject::MUST_READ,IObject::AUTO_WRITE加到createFields.H里面后,计算时仍然不读取0文件夹里面的密度边界条件和初始密度场。。
想问还需要编译什么才能直接调节初始场的密度。
麻烦老师啦🙏 -
@李东岳 李老师,现在想重新编译时按照http://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam。 这个教程想练一遍,发现wmake的时候出现错误
/opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::STARCDCore::STARCDCore()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::fileName const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::STARCDCore::starFileName(Foam::fileName const&, Foam::fileFormats::STARCDCore::fileExt)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `typeinfo for Foam::OBJstream' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::vtk::legacy::contentNames' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::reduce(Foam::Vector2D<double>&, Foam::sumOp<Foam::Vector2D<double> > const&, int, int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::OBJstream::~OBJstream()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::freePstreamCommunicator(int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::geometricSurfacePatch::geometricSurfacePatch(Foam::word const&, int, Foam::word const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::UPstream::finishedRequest(int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::scalePoints(double)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::xferPoints()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::DimensionedField<double, Foam::triSurfacePointGeoMesh>::typeName' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::STARCDCore::writePoints(Foam::Ostream&, Foam::Field<Foam::Vector<double> > const&, double)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::xferFaces()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::OBJstream::write(Foam::Vector<double> const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::NASCore::parseNASCoord(Foam::string const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::fileName const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::STARCDCore::writeHeader(Foam::Ostream&, Foam::fileFormats::STARCDCore::fileHeader)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::abort()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::vtk::legacy::fileHeader(Foam::vtk::formatter&, std::string const&, std::string const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::DimensionedField<double, Foam::triSurfaceGeoMesh>::typeName' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::subsetMesh(Foam::List<bool> const&, Foam::List<int>&, Foam::List<int>&) const' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::OBJstream::write(Foam::face const&, Foam::UList<Foam::Vector<double> > const&, bool)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::vtk::outputOptions::legacy(bool)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::canRead(Foam::fileName const&, bool)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::STARCDCore::readPoints(Foam::IFstream&, Foam::Field<Foam::Vector<double> >&, Foam::List<int>&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::resetRequests(int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::allocatePstreamCommunicator(int, int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::edgeOwner() const' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::OBJstream::OBJstream(Foam::fileName const&, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::OBJstream::write(Foam::UList<Foam::face> const&, Foam::Field<Foam::Vector<double> > const&, bool)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::List<Foam::labelledTri> const&, Foam::List<Foam::geometricSurfacePatch> const&, Foam::Field<Foam::Vector<double> > const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::init(int&, char**&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::geometricSurfacePatch::geometricSurfacePatch()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::UPstream::allToAll(Foam::UList<int> const&, Foam::UList<int>&, int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::STARCDCore::readHeader(Foam::IFstream&, Foam::fileFormats::STARCDCore::fileHeader)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::UIPstream::UIPstream(int, Foam::PstreamBuffers&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::~triSurface()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UIPstream::UIPstream(Foam::UPstream::commsTypes, int, Foam::DynamicList<char, 0u, 2u, 1u>&, int&, int, int, bool, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::sumReduce(double&, int&, int, int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::reduce(double&, Foam::minOp<double> const&, int, int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::operator=(Foam::triSurface const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `typeinfo for Foam::vtk::formatter' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::sortedEdgeFaces() const' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::vtk::legacy::dataTypeNames' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::coordSet::coordSet(Foam::word const&, Foam::word const&, Foam::List<Foam::Vector<double> > const&, Foam::List<double> const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::List<Foam::labelledTri> const&, Foam::Field<Foam::Vector<double> > const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::triSurface const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::List<Foam::labelledTri>&, Foam::List<Foam::geometricSurfacePatch> const&, Foam::Field<Foam::Vector<double> >&, bool)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::addValidParOptions(Foam::HashTable<Foam::string, Foam::word, Foam::string::hash>&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libOpenFOAM.so: undefined reference to `Foam::UPstream::exit(int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::vtk::newFormatter(std::ostream&, Foam::vtk::formatType, unsigned int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::vtkUnstructuredReader::vtkUnstructuredReader(Foam::objectRegistry const&, Foam::ISstream&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::operator==(Foam::geometricSurfacePatch const&, Foam::geometricSurfacePatch const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::~triSurface()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libfiniteVolume.so: undefined reference to `Foam::UPstream::waitRequest(int)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::OBJstream::write(Foam::UList<Foam::edge> const&, Foam::UList<Foam::Vector<double> > const&, bool)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::write(Foam::fileName const&, bool) const' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `typeinfo for Foam::triSurface' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::movePoints(Foam::Field<Foam::Vector<double> > const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::DimensionedField<int, Foam::triSurfaceGeoMesh>::typeName' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::triSurface(Foam::triSurface const&)' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::markZones(Foam::List<bool> const&, Foam::List<int>&) const' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::fileFormats::NASCore::NASCore()' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::writeStats(Foam::Ostream&) const' /opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/lib/libmeshTools.so: undefined reference to `Foam::triSurface::clearOut()' collect2: error: ld returned 1 exit status make: *** [/opt/OpenFOAM/OpenFOAM-v1706/platforms/linux64GccDPInt32Opt/bin/my_icoFoam] Error 1 sh-4.2#
我在想是不是用mac的原因于是 我又在虚拟机上(linux mint)上试了下,直接告诉我wmke command can not found
。。不知道时怎搞的了。。能帮忙看下哪里出错了吗。
🙏 -
@李东岳 感谢老师回复 🙏
Mac上还是没有找到什么原因wmake出错,但是在虚拟机(Linux Mint)上在按照openfoam wiki上添加温度的教程编译成功了。
发现 在createfields.H里加Oobject::MUST_READ,IObject::AUTO_WRITE,和在/systym/controlDict里面加
效果一样 都只是根据初始p,U,粘度等来计算密度,不能直接读取0文件夹里面的rho文件。。。
这是0文件夹里面的rho文件 虽然设置的是1但是计算后在paraview上显示是0.23
怎么才能跟fluent一样直接调节初始场密度呢。
麻烦老师在看下🙏 -
@李东岳
老师好!发现openfoam是不能直接进入密度场的因为openfoam用的是kinematic viscasity.fluent用的是动力粘度。
所以感觉还是得调节p,之前的压力边界条件我设置的是outlet为0.2大气压,inlet为zerogradient。现在调换后inlet为0.2大气压,outlet为zerogradient,initial为1个大气压。然后按照
更改fvscheme后达到预期的冲击波外的区域密度场都1左右,但是发现冲击波前面的涡很微弱。
这是实验得到的图像。冲击波前面有很明显的蓝色的涡。
这是openfoam得到的图像,冲击波前面基本没有涡
-
@东岳 Hi!
又要来麻烦老师了🙏之前的涡的存在问题已经解决。原因是因为压力边界条件设置问题,还有发现k和epsilon之前按照公式算的是10的5次方级别的数字 但是我把他调节成0.5也能算而且精度更准,这个还不知道什么原因。。
现在(其实从之前)就有个关于paraview的问题,把data放到paraview里面显示rho跑第一遍的colour legend和先显示p跑一遍在切换到rho显示的colour legend有些许的不同。
这是显示rho跑第一遍的图 colour legend只显示到0.23
这是先跑完一遍p在切换到rho, colour legend就可以显示到0.06
求老师给点指示