google / google/jax-cfd

Question about the random intial velocity in notebook spectral_forced_turbulence.ipynb

Open
#99 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
964
Forks
142
Avg merge
3h 9m
Merged PRs (30d)
1

Description

Hello,

This is a very nice JAX implementation for CFDs! I have a few questions about your latest released notebook [spectral_forced_turbulence.ipynb](https://github.com/google/jax-cfd/blob/main/notebooks/spectral_forced_turbulence.ipynb).

1. What is the exact NS equation that the notebook aims to solve? Would it be possible to provide some detailed expressions of NS equations and boundary conditions? Or would it be possible to provide some references? I think It will be super helpful to people like me who are more familiar with machine learning and know less about CFD.

2. If I understand correctly, I think the code aims to solve the NS equation (vorticity-velocity form) using the pseudo-spectral method. So we need to enforce periodic boundary conditions for the velocity (or vorticity?) However, when I try to run the following piece of code (which should give me a random velocity field and visualize it at the boundary)
```
v0 = cfd.initial_conditions.filtered_velocity_field(jax.random.PRNGKey(0), grid, max_velocity, 4)
u = v0[0].data
v = v0[1].data

plt.plot(u[:, 0])
plt.plot(u[:, -1])
plt.show()

plt.plot(u[0, :])
plt.plot(u[-1, :])
plt.show()
```
I got the following figures below. It seems that the periodic boundary condition is not fully imposed. Could you please take a look or correct me if I am wrong?

![bc](https://user-images.githubusercontent.com/70182613/139506375-95b7ddb4-8a32-4640-8482-1684882dc5f0.png)
![bc2](https://user-images.githubusercontent.com/70182613/139506405-ce35d0d4-f6c5-4ebe-b3b8-3d62c94762f9.png)

Once again, this is really a project! Looking forward to your reply.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.