Jie,
> I am solving time-dependent Navier-Stokes equations with varying
> Dirichlet boundary conditions. Although I have read the "Constraints on
> degrees of freedom" for many times, I am still not sure what the best
> way to implement changing boundary conditions is. My time scheme is
> fully implicit, so there is an outer time loop, plus an inner Newton
> iteration, and I am solving for the* newton_increment*. My code works
> fine when the Dirichlet boundary conditions are not changing in time.
> The way I implemented it is that I have two ConstraintMatrix, one for
> nonzero_constraints and one for zero_constraints. At the *first* Newton
> iteration in the *first* time step, I apply nonzero_constraint in the
> assembly process using distribute_local_to_global and after solving it
> call distribute to recover the constrained values. At all the following
> iterations, use zero_constraints to assemble. This gives me the correct
> solution because I start with v = 0, so the first newton iteration will
> correctly set the boundary values, and after that I do want the
> newton_increment at the Dirichlet boundary to be 0 since the boundary
> condition do not change in time.
>
> My first question is, if the boundary conditions are time-dependent,
> then I would have to use nonzero constraints at the *first* Newton
> iteration in *every* time step, right?
Correct.
> In addition, the value of those
> constraints should *not* be the fluid velocity that I want, instead, it
> should be the velocity *delta* between time steps, because the degrees
> of freedom to be solved are the velocity increment, not the velocity
> itself, right?
Yes, also correct. But you could always rewrite things in such a way
that in the first Newton iteration in each time step, you solve for the
velocity and not the increment. In that case, the boundary values are
the correct velocity at the boundary, not just the increment from the
previous time step.
> This issue gets more complicated when not only the constrained values
> change in time, but also the dofs to be constrained also change in time.
> This issue arises in my fluid-structure interaction application with
> immersed method: I need to force the fluid velocity in certain area to
> be the same as the solid velocity, and the solid location always
> changes. Therefore, I want to apply totally different Dirichlet boundary
> conditions at different time steps. This means I have to 1. recreate the
> ConstraintMatrix 2. recreate the sparsity pattern, which is related to
> the constraints, and reinitialize the system matrix, solution vectors
> etc. Is this reasonable?
Yes. But if you do not eliminate constrained degrees of freedom from the
sparsity pattern (there is a function argument to
make_sparsity_pattern()), then you also don't need to recreate the
sparsity pattern in each time step and don't need to reinitialize the
matrix -- you just need to set it to zero.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/