Skip to content

Division by zero for uniform grids during mesh initialisation #214

@ia267

Description

@ia267

When running the TGV case in debug mode after compiling with NVHPC 25.3.0, the code fails mesh initialisation in src/mesh_content.f90 line 165.

The cause is a division by zero when calculating alpha at line 165

alpha = abs((L_inf - sqrt((pi*beta)**2 + L_inf**2))/(2*beta*L_inf))

where beta is 0 for a given direction for a uniform grid.

Proposed solution

if (abs(beta) < 1.0e-12) then
    alpha = 0.0
else
    alpha = abs((L_inf - sqrt((pi*beta)**2 + L_inf**2))/(2*beta*L_inf))
endif

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions