openfoam-31-solver-log-residual-format

Sub-skill of openfoam: 3.1 Solver Log Residual Format (+5).

5 stars

Best use case

openfoam-31-solver-log-residual-format is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of openfoam: 3.1 Solver Log Residual Format (+5).

Teams using openfoam-31-solver-log-residual-format should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/31-solver-log-residual-format/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/engineering/cfd/openfoam/31-solver-log-residual-format/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/31-solver-log-residual-format/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How openfoam-31-solver-log-residual-format Compares

Feature / Agentopenfoam-31-solver-log-residual-formatStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of openfoam: 3.1 Solver Log Residual Format (+5).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 3.1 Solver Log Residual Format (+5)

## 3.1 Solver Log Residual Format


Each iteration produces lines in this format:
```
smoothSolver:  Solving for Ux, Initial residual = 0.0118755, Final residual = 0.000302581, No Iterations 1
GAMG:  Solving for p, Initial residual = 0.150883, Final residual = 0.00896498, No Iterations 3
```

**Regex for extraction:**
```python
import re
pattern = r'^(\w+):\s+Solving for (\w+), Initial residual = ([0-9.e+-]+), Final residual = ([0-9.e+-]+), No Iterations (\d+)'
# Groups: solver_name, field_name, initial_residual, final_residual, iterations
```

**Time step markers:**
```
Time = 150                    # steady: iteration number
Time = 0.0345                 # transient: physical time
```

**Courant number (transient only):**
```
Courant Number mean: 0.123 max: 0.987
```

**Continuity errors:**
```
time step continuity errors : sum local = 1.23e-07, global = -2.34e-15, cumulative = -5.67e-14
```

**Convergence marker (SIMPLE):**
```
SIMPLE solution converged in 285 iterations
```

**End marker:** `End`


## 3.2 foamLog Utility


```bash
foamLog log.simpleFoam
# Creates logs/ directory with per-field residual files:
#   logs/p_0          — initial residual for p
#   logs/Ux_0         — initial residual for Ux
#   logs/k_0          — initial residual for k
#   logs/contLocal_0  — local continuity error
#   logs/contGlobal_0 — global continuity error
# Format: two columns (iteration, value)
```


## 3.3 Python Log Parsing


```python
import re
from pathlib import Path

def parse_openfoam_log(log_path):
    """Parse OpenFOAM solver log and extract residuals per field."""
    residuals = {}
    time_step = 0
    pattern = re.compile(
        r'(\w+):\s+Solving for (\w+), '
        r'Initial residual = ([0-9.e+-]+), '
        r'Final residual = ([0-9.e+-]+), '
        r'No Iterations (\d+)'
    )
    time_pattern = re.compile(r'^Time = ([0-9.e+-]+)')

    for line in Path(log_path).read_text().splitlines():
        time_match = time_pattern.match(line)
        if time_match:
            time_step = float(time_match.group(1))
            continue
        match = pattern.search(line)
        if match:
            field = match.group(2)
            if field not in residuals:
                residuals[field] = []
            residuals[field].append({
                'time': time_step,
                'initial': float(match.group(3)),
                'final': float(match.group(4)),
                'iterations': int(match.group(5)),
            })
    return residuals
```


## 3.4 postProcessing/ Directory


Function objects write to `postProcessing/<name>/<startTime>/`:

| Function Object | Output File | Content |
|-----------------|-------------|---------|
| `yPlus` | `yPlus/0/yPlus.dat` | Wall y+ values |
| `solverInfo` | `solverInfo/0/solverInfo.dat` | Residuals per timestep |
| `forceCoeffs` | `forceCoeffs/0/coefficient.dat` | Cd, Cl, Cm vs time |
| `probes` | `probes/0/p`, `probes/0/U` | Field values at probe points |
| `fieldMinMax` | `fieldMinMax/0/fieldMinMax.dat` | Min/max per field |


## 3.5 checkMesh Output


Key lines to parse:
```
Max aspect ratio = 5.08 OK.
Mesh non-orthogonality Max: 45.2 average: 12.3
Max skewness = 0.127 OK.
Min volume = 4.2e-11. Max volume = 1.68e-09.
Mesh OK.                                    # or: Failed N mesh checks.
```


## 3.6 Exit Codes


| Code | Meaning |
|------|---------|
| 0 | Success (`End` printed) |
| 1 | FOAM FATAL ERROR or FOAM FATAL IO ERROR |
| 134 | SIGABRT — assertion failure |
| 136 | SIGFPE — floating point exception |
| 139 | SIGSEGV — memory / corrupted mesh |
| 137 | SIGKILL — out of memory (OOM killer) |
| 255 | MPI error / decomposition mismatch |

---

Related Skills

multi-format-transaction-parser

5
from vamseeachanta/workspace-hub

Parse and consolidate financial transaction data across multiple CSV formats and years

multi-format-csv-parser-with-deduplication

5
from vamseeachanta/workspace-hub

Parse brokerage CSV exports that exist in multiple formats with overlapping data across files

multi-format-csv-detection-and-deduplication

5
from vamseeachanta/workspace-hub

Detect and handle multiple CSV format versions from the same data source; deduplicate records across format variants

engineering-solver-domain-recon

5
from vamseeachanta/workspace-hub

Deep reconnaissance of an engineering solver domain (OrcaWave, OrcaFlex, CalculiX, OpenFOAM, etc.) across a multi-repo ecosystem — map infrastructure, issues, skills, data artifacts, machine constraints, and solver queue state before planning work.

core-context-management-response-format-rules

5
from vamseeachanta/workspace-hub

Sub-skill of core-context-management: Response Format Rules (+3).

instrument-data-allotrope-output-format-selection

5
from vamseeachanta/workspace-hub

Sub-skill of instrument-data-allotrope: Output Format Selection.

clinical-trial-protocol-waypoint-file-formats

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: Waypoint File Formats (+2).

n8n-5-data-transformation-with-code-node

5
from vamseeachanta/workspace-hub

Sub-skill of n8n: 5. Data Transformation with Code Node (+1).

gmsh-openfoam-orcaflex-stub-mode-details

5
from vamseeachanta/workspace-hub

Sub-skill of gmsh-openfoam-orcaflex: Stub Mode Details.

gmsh-openfoam-orcaflex-real-mode-requirements

5
from vamseeachanta/workspace-hub

Sub-skill of gmsh-openfoam-orcaflex: Real Mode Requirements.

gmsh-openfoam-orcaflex-quick-invocation

5
from vamseeachanta/workspace-hub

Sub-skill of gmsh-openfoam-orcaflex: Quick Invocation.

gmsh-openfoam-orcaflex-gate-1-mesh-quality

5
from vamseeachanta/workspace-hub

Sub-skill of gmsh-openfoam-orcaflex: Gate 1 — Mesh Quality (+1).