# ๐ง Debugging Cycle Guide
## ๐ Step-by-Step
### 1. Run CMake Build
```bash
./00_cmk.sh 2>&1 | tee log.cmake_dschen
```
### 2. Check & Debug
Review the generated `log.cmake_dschen` logfile for errors or issues.
### 3. Modify Source Code
Edit the relevant files under the `code/` directory.
---
## ๐ Debugging Cycle Flowchart
```mermaid
graph TD
A[Run CMake Build]
B[Check and Debug Based on Logfile]
C[Modify Source Code]
A --> B
B --> C
C --> A
```
---
# ๐งฐ Modifications & Fixes
## โ OOPS
### 1. Remove Unsupported Intel Flag `-ip`
```bash
cd code/
grep -rn --include='*cmake' '\-ip' .
find . -name '*.cmake' -exec sed -i 's/ -ip / /g' {} +
```
### 2. `f_c_string` Conflict in `iso_c_binding`
#### Original
```fortran
use, intrinsic :: iso_c_binding
```
#### Workaround
```fortran
use, intrinsic :: iso_c_binding, only: c_int, c_double, c_bool, c_char, c_ptr, c_double_complex, &
c_null_char, c_loc, c_f_pointer, c_associated
```
---
## ๐ฆ IODA
### 1. `f_c_string` Conflict
๐ Location:
`/home/cwa/tingchi/mpas_bundle_v3/code/ioda/src/obsspace_mod.F90`
### 2. Narrowing Conversion Error
๐ Location:
`/home/cwa/tingchi/mpas_bundle_v3/code/ufo/src/ufo/filters/ConventionalProfileProcessingParameters.h`
#### Original
```cpp
oops::Parameter<float> AvgP_GapLogPDiffMin {"AvgP_GapLogPDiffMin", std::log(5.0), this};
```
#### Workaround
```cpp
oops::Parameter<float> AvgP_GapLogPDiffMin {"AvgP_GapLogPDiffMin", std::log(5.0f), this};
```
---
## ๐ MPAS
### 1. Remove Incompatible `icx` Flags `-threads` and `-cxxlib`
#### Root Cause:
ESMF introduces these flags in `link.txt`. Since ESMF is not needed, comment out its inclusion.
#### Diff Patch
```diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70a99b2..f446985 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,7 +62,7 @@ ecbuild_bundle( PROJECT ufo GIT "https://github.com/JCSDA/ufo.git"
# Find external ESMF for mpas-model (optional)
-find_package(ESMF 8.3.0 MODULE)
+#find_package(ESMF 8.3.0 MODULE)
set(MPAS_DOUBLE_PRECISION "ON" CACHE STRING "MPAS-Model: Use double precision 64-bit Floating point.")
set(MPAS_CORES init_atmosphere atmosphere CACHE STRING "MPAS-Model: cores to build.")
```
---
## ๐งช mpas-jedi
### 1. Remove Incompatible `icx` Flags
Same root cause as MPAS: ESMF brings `-threads` and `-cxxlib`.
---
# โ
Run CTest
### 1. How to Run?
```bash
nohup ./run_ctest.sh &
```
### 2. Check Results
Review logs under:
```
log/log.ctest.<PKG>
```