Steriva / FEniCSx-tutorials

Tutorials for FEniCSx - Take a Look at ERMETE-LAB/MP-OFELIA
https://github.com/ERMETE-Lab/MP-OFELIA
4 stars 1 forks source link

Navier Stokes Cavity example not running #1

Closed marc-git closed 7 months ago

marc-git commented 8 months ago

Hi, the code at Cavity 2D doesn't run anymore as is. Adding the data type to the domain fixes the first error: self.domain = create_rectangle(MPI.COMM_WORLD,[np.array([0, 0]), np.array([1, 1])], [N, N], CellType.triangle, np.float64, GhostMode.none)

Then I get: AttributeError: 'Vector' object has no attribute 'set'

related to self.zero_p.x.set(0.0)

Steriva commented 8 months ago

Hi, the code in this folder has been tested with dolfinx version 0.6.0. I'm aware that there has been new releases till version 0.7.3, I didn't have the time to update everything. In the coming weeks/months, I will try to update the repo to the latest version with some additional examples.

In the meantime, the error you reported can be solved in different ways:


self.zero_p.x.array[:] = 0.

# Alternatively
self.zero_p.interpolate(lambda x: 0.0 + 0.0 * x[0])
marc-git commented 8 months ago

no worries. Looking forward to it. This example is very nicely written.