Error when applying k-e model to flow over airfoil problem

Hello, I am trying to apply k-e model to flow over 2D airfoil problem with Re = 1e5.
I have encountered a error when setting up the wall function constraint.
I generated a geometry that is a little bit thicker than the original airfoil, trying to make the y+ = 30. Then I use this as the geometry in the wall function constraint definition, as shown in the following:

wf_pt = PointwiseBoundaryConstraint(
            nodes=nodes_ke + nodes_u_tau,
                "velocity_wall_normal_wf": 0,
                "velocity_wall_parallel_wf": 0,
                "ep_wf": 0,
                "k_wf": 0,
                "wall_shear_stress_x_wf": 0,
                "wall_shear_stress_y_wf": 0,
                "velocity_wall_normal_wf": 100,
                "velocity_wall_parallel_wf": 100,
                "ep_wf": 1,
                "k_wf": 1,
                "wall_shear_stress_x_wf": 100,
                "wall_shear_stress_y_wf": 100,
            parameterization={"normal_distance": resolved_y_start},
        domain.add_constraint(wf_pt, "WF1")

Then I got the error report on this constraint, it is:

Error executing job with overrides: []
An error occurred during Hydra's exception formatting:
Traceback (most recent call last):
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/_internal/", line 252, in run_and_report
    assert mdl is not None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 672, in <module>
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/hydra/", line 91, in func_decorated
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/_internal/", line 377, in _run_hydra
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/_internal/", line 294, in run_and_report
    raise ex
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/_internal/", line 211, in run_and_report
    return func()
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/_internal/", line 378, in <lambda>
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/_internal/", line 111, in run
    _ = ret.return_value
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/core/", line 233, in return_value
    raise self._return_value
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/hydra/core/", line 160, in run_job
    ret.return_value = task_function(task_cfg)
  File "", line 240, in run
    wf_pt = PointwiseBoundaryConstraint(
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/domain/constraint/", line 276, in __init__
    invar = geometry.sample_boundary(
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 474, in sample_boundary
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 475, in <listcomp>
    curve.approx_area(parameterization, criteria=closed_boundary_criteria)
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 129, in approx_area
    s, p = self._sample(
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 211, in sample
    invar, params = internal_sample(
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 268, in sample
    computed_angle = angle(params)
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/geometry/", line 97, in func
    return fn_func(**inputs)
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/utils/sympy/", line 144, in grouped_lambda
  File "/home/svu/e0444197/.local/lib/python3.8/site-packages/modulus-22.9-py3.8.egg/modulus/utils/sympy/", line 113, in lambdify_f_i
    v = np.stack(
  File "<__array_function__ internals>", line 180, in stack
  File "/usr/local/lib/python3.8/dist-packages/numpy/core/", line 422, in stack
    raise ValueError('need at least one array to stack')
ValueError: need at least one array to stack

I have tried changing the geometry I provided to this constraint but it didn’t work. Can anyone help me with this problem?

Thank you very much

Hi @TinsenLY

Its a little difficult to tell the exact problem here, but from I can tell its most likely because the geometry module is failing to sample the boundary of this geometry.

Perhaps you can try to isolate the boundary to verify and just call:

invar = geo.airfoil1_geo.sample_boundary(100)

And see if that works, if it does try adding the parameterization:

invar = geo.airfoil1_geo.sample_boundary(100, parameterization={"normal_distance": resolved_y_start})

If the first fails theres a problem with your geometry, if the second fails its the parameterization.

Hi @ngeneva ,

Thanks for your advice, I tried to comment the parameterization line and the code comes up with an fail unroll graph error. I checked the log and find that “normal_distance” is required for the nodes to calculate variables like “velocity_wall_parallel_wf”, “ep_wf”, “k_wf”, “wall_shear_stress_x_wf”, “wall_shear_stress_y_wf”.

Then I provided the paratmer “normal_distance” with the parameterization.

In my case, I don’t need the normal_distance to calculate the geometry for wall function, I read in airfoil points and use the polygon method to generate the airfoil geometry. I read in the airfoil boundary geometries that I to apply wall function directly. Yet I still import the normal_distance with the resolved_y_start value, which is a constant.

Could you please help me figure out how the parameterization result in an error shown above?

Hi @TinsenLY

So both of the code samples I gave work?

What is resolved_y_start here? Again its hard to debug this with the limited code snippet here. These numpy printer problems typically occur when some node/variable is not returning data. But its hard to say.

In my case, I don’t need the normal_distance to calculate the geometry for wall function

Yes this is correct. Its just that parameters are sampled with geometry which is why I wanted to verify the geometry was first functioning.