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
fluids: Add diffusive flux projection to Navier-Stokes #1031
base: main
Are you sure you want to change the base?
Conversation
Can you tighten the tolerance on the linear solve and test the reduction in nonlinear residual per Newton step? I think including this stabilization term shouldn't greatly change the nonlinear convergence, and thus I would leave it out, especially so long as we aren't using a very strong preconditioner. It can't be included in the assembled Jacobian without significant cost/loss of sparsity (if we were to assemble the exact Jacobian) and I think that definitely won't pay off. It may be good to document what approximations are made in the Jacobian. We don't differentiate through |
Sure. Just do an A/B test of zeroing the diffusive flux and not?
Yeah, that's the conclusion I was leaning towards.
I can definitely do that, probably also include a blurb about the diffusive flux projection. |
Yeah, like |
f798db5
to
e9b0b98
Compare
I've added a flag
it converges within 4 non-linear iterations per timestep. But using
|
That sounds like a bug in |
Is it possible that it actually should be zero? Thinking from the integral form of the SUPG term: We currently do take the derivative of |
Note that Yes, it's true that we "freeze" |
Yep, you're right.
I doubt that it'd have a significant impact either. Given that, would you agree that the behavior I saw with adding the divergence of diffusive flux is correct though? ie. we should leave it out of the jacobian (or more explicitly set it to zero in the function). |
This branch had conflicts with main and will need a rebase or merge. Do you think it's close? We don't need this term in the Jacobian. |
The primary thing left here is to actually validate it against Ken's original paper. I had been trying to do that with the channel example, but ran into issues. There are two routes to doing that:
Route 1 is stalled as I can't manipulate the grid with periodic BCs. Or at least I can't do that with the current methodology. Route 2 is stalled in two ways. The channel inflow doesn't have a jacobian QF defined. I tried to run it with Running full production cases became priority, so I put this on hold until Route 1 becomes feasible, as getting the periodic BCs is necessary in the future anyways. I also have some local work for getting the boundary integral term working. That could be another PR though if that's preferred. |
I think periodic non-equally spaced should work, we just need to map the cell geometry and won't be able to evaluate surface integrals (for now). I'll try to fix the general periodic case in PETSc. |
Do you have a general idea of what needs to be done mapping the cell geometry? |
Can you rebase (it's needed anyway) and leave a stub for what you've tried? |
Yep, working on that now. |
e9b0b98
to
5c40130
Compare
Branch is rebased now. It looks like I never commited my changes to get an non-equispaced grid. I can try to throw that together real quick. |
Actually I did commit them, but was looking at the wrong file history to find them. They're now pushed to |
build errors? What should I run to test your attempt at mesh modification? (Let's ignore inflow/outflow for now.)
|
Sorry about that. Should build fine now. I've moved the inflow/outflow stuff into a different (local) branch for right now. |
I'm having trouble getting a convergent channel simulation. My previous copy of the branch is running fine, so I'm guessing I missed something in the rebasing that didn't get caught by the tests. I'll let you know when the branch is actually ready to look at. |
Turned out to just be a
|
Note that the values returned by Anywho, I'll try and get validation results soon. |
@jrwrigh You are correct that the bounding box calculation was wrong for periodic things. I believe it is now fixed. |
Ok, cool. I'm currently on |
Dang, you are right. I fixed it in this unfortunate branch that is taking forever: https://gitlab.com/danofinn/petsc/-/commits/danfinn/feature-swarm-poisson-test |
@jrwrigh I don't think it's necessary to actually do the surface integrals, just to zero the wall nodes. The reason comes from the identity that |
Adds projection of the divergence of diffusive flux ($F^{diff}_{i,i}$ ) to the strong residual.$\int_\Omega v_{,i} F^{diff}_i d \Omega$ . Note that there should be a boundary integral term here for consistencies ($\int_\Gamma v \cdot F^{diff}_i \hat n_i d\Gamma$ ).
The projection is done by a lumped mass matrix multiplied against
TODOs:
Add into Jacobian (currently just zeroed, not sure if it can/should be in the Jacobian)Shouldn't be done, see discussion below.