WhydidmyprogramcrashorHowtodebugyourOpenFOAM

上传人:t****d 文档编号:243017159 上传时间:2024-09-13 格式:PPT 页数:22 大小:64KB
返回 下载 相关 举报
WhydidmyprogramcrashorHowtodebugyourOpenFOAM_第1页
第1页 / 共22页
WhydidmyprogramcrashorHowtodebugyourOpenFOAM_第2页
第2页 / 共22页
WhydidmyprogramcrashorHowtodebugyourOpenFOAM_第3页
第3页 / 共22页
点击查看更多>>
资源描述
Klicka fr att ndra format p bakgrundsrubriken,Klicka fr att ndra format p bakgrundstexten,Niv tv,Niv tre,Niv fyra,Niv fem,Chalmers University of Technology,Fabian Peng K,rrholm,Why did my program crash?,or,How to debug your OpenFOAM codes using GDB,Running your code,Coding your own software good & bad,Programming your own codes without bugs is near impossible,even for Weller & Jasak,Debugging your code,Debugging is a necessary evil to resolve bugs and examine crashes when developing all codes, and OpenFOAM is not an exception,Built-in debug feature shows more details, but gives only “passive” information,Debugging your code built-in,Debugflags available in,.OpenFOAM-1.4.1/controlDict,lduMatrix 2;,Will give output for each matrix-iteration:,DICPCG: Iteration 475 residual = 0.542126,No Recompilation of code needed.,Flags set in code by:,defineTypeNameAndDebug(PCG, 0);,Debugging your code,Alternative way:,Inserting,Info U is Ucelli endl;,Requires Re-compilation (usually many times),GDB - Introduction,GDB is the GNU project debugger,It can be used for,- Programs written in C, C+, Ada, Pascal etc,- Run & Stop at specific positions,- Examine variables at run-time,- Change your program at run-time,You need to recompile EVERYTHING!,Debug version of OpenFOAM requires 1 Gb of diskspace, vs 64 Mb for Opt,It is also slower,Even slower when run with GDB,You need to recompile,Before we start Bad news,Compiling with Debug,File:,.OpenFOAM-1.4.1/bashrc,Comment,setenv WM_COMPILE_OPTION Opt,Uncomment,setenv WM_COMPILE_OPTION Debug,Then run the Allwmake script and go for a very long break.,When youre back, some packages (e.g. the paraview reader) will have failed,Compiling with Debug,These packages can be compiled seperately with debug flags,Quick Solution:,Use the Opt version, as were most likely not interested in debugging such packages,Done by simple copy of libPackageName.so,Setup on Student Installation,Pre-compiled version of Debug done by Hkan,Used by copying,.OpenFOAM-1.4.1 from local installation to,/chalmers/users/userdir/,And editing .cshrc/.bashrc like described before,First Debug,Objective: To find out what a part of the code does,Code: icoFoam - for incompressible, laminar flow,Simple code, suitable to start debugging, as there are not that many files included.,Example icoFoam,73: U = rUA*UEqn.H();,74: phi = (fvc:interpolate(U) & mesh.Sf(),+ fvc:ddtPhiCorr(rUA, U, phi);,77: adjustPhi(phi, U, p);,79: for (int nonOrth=0; nonOrthmuu()/(rhou*epsilon);,Possible issue with division, inspection of some epsilon values shows low epsilon.,Post-debugging,Codes run without gdb that crash,Set system to dump core-file,Core-files can be used to inspect where errors occurred,In cshrc:,limit coredumpsize unlimited,In bashrc:,ulimit -c unlimited,Then simply loaded in gdb by core-file ,Questions GDB can answer,What does .flux do?,What happens when .solve is issued?,When does my variable go below x?,How does scheme x work?,Where did my code crash?,End,Thanks for listening!,
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸专区 > 大学资料


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!