You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 20.04下Xrotor编译成功后运行出现COLORSPECTRUM错误的求助

Troubleshooting Xrotor 7.55 Runtime Errors on Ubuntu 20.04

Hey there! Let's work through this Xrotor issue together—since you're new to Fortran 77 and Ubuntu, we'll break this down step by step to get you up and running.

First: Address the IEEE_DENORMAL Warning

That floating-point exception warning comes from gfortran's strict default handling of edge-case floating-point values. To suppress this (without hiding critical errors), you have two simple options:

  1. Modify your compile flags in ./bin/Makefile.gfortran:
    Add these flags to your Fortran compiler line:

    -ffpe-summary=none -fno-trapping-math
    

    The first flag hides non-critical floating-point exception summaries, and the second prevents the program from stopping on minor issues like denormals.

  2. Set an environment variable before running Xrotor:
    Before executing ./xrotor, run this command in your terminal:

    export GFORTRAN_FPE=0
    

    This tells gfortran to ignore non-fatal floating-point exceptions (like denormals) during runtime.

Fixing the Non-Monotonic Color Axis Error

Your attempts to modify COLWIDTH and remove the check didn't work probably because the changes weren't properly compiled into the program. Let's fix that first:

Step 1: Force a Full Recompile

Old object files might still be cached, so clean them before rebuilding to ensure your changes take effect:

cd ~/Xrotor/bin
make clean -f Makefile.gfortran
make -f Makefile.gfortran

Step 2: Ensure COLAXIS is Strictly Monotonic

The error is triggered because the COLAXIS array (calculated from COLWIDTH) isn't strictly increasing. Instead of relying on COLWIDTH, you can manually set COLAXIS to a guaranteed monotonic sequence:

  1. Open /plotlib/plt_color.f in a text editor (like nano or vim).
  2. Find the section where COLAXIS is built (look for a loop that uses COLMIN and COLWIDTH to populate the array).
  3. Replace that loop with a hardcoded strictly increasing array. For example:
    ! Replace existing COLAXIS calculation with this
    COLAXIS = (/0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2/)
    
    Adjust the values to match your simulation's needs—just make sure each value is larger than the previous one.

Step 3: Double-Check for Hidden Checks

If you deleted the original stop line but still get the error, search plt_color.f for other instances of similar checks:

grep -n "Non-monotonic color axis" ~/Xrotor/plotlib/plt_color.f

If there are other lines (like in the COLORSPECTRUMTRP subroutine), comment them out or delete them, then recompile again.

Additional Compatibility Tips for Gfortran

Since Xrotor is a legacy Fortran 77 code, adding these flags to your Makefile.gfortran can help with better compatibility:

  • -ffixed-form: Explicitly tells gfortran to treat the code as fixed-format Fortran 77.
  • -fno-range-check: Disables strict range checking on array indices, which is common in older codes.

After making these changes, recompile and run Xrotor again—this should resolve both the floating-point warning and the color axis error.

内容的提问来源于stack exchange,提问作者gab

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 23:23:15