Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialization error in Step 7 #75

Open
Bob-McCrory opened this issue Oct 4, 2020 · 1 comment
Open

Initialization error in Step 7 #75

Bob-McCrory opened this issue Oct 4, 2020 · 1 comment
Labels

Comments

@Bob-McCrory
Copy link

I believe the initialization in the Step 7 diffuse() function is incomplete: Only the nodes with an initial value of 2 are reset; all other nodes are left as they were after the last call to diffuse(). For example, if you run diffuse(10) twice in succession and look at statistics such as the maximum and minimum value of u, you will see that the results differ in the two runs. This occurs because the initial values outside of [0.5, 1.0], [0.5, 1.0] have not been reset to 1.0.

This can be remedied by adding "u = numpy.ones((ny, nx)) as the first statement in diffuse().

Thanks for putting these steps to CFD together; they have been very helpful to me. I hope this is a little helpful for you.

Bob

@piyueh
Copy link
Member

piyueh commented Oct 4, 2020

@Bob-McCrory Yes, you're right. Thanks for pointing this out! There are two ways to fix it, depending on what diffuse(...) wants to achieve.

  1. diffuse(...) always starts the time-marching from t=0. Then, we completely re-initialize u at the the beginning of diffuse(...) as you suggested.
  2. diffuse(...) always continues the time-marching from the current state fo u. In this case, we remove the line of u[int(.5 / dy)...] = ....

@piyueh piyueh added the bug label Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants