-
Notifications
You must be signed in to change notification settings - Fork 471
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
Nonhomogeneous Dirichlet Boundary in Time-dependent Solver #1720
Comments
Hi @Liu0813 , You can define a time-dependent function coefficient and project it to a GridFunction which would hold the non-homogeneous Dirichlet data. Take a look at coefficient.hpp Lines 127 to 147 in b3beafe
Thanks, Socratis |
Thanks for your reply. I use the function |
Hi @Liu0813, Yes, for an H1 space you can use Best, Socratis |
Hi @psocratis, Lines 956 to 976 in 4f521a1
That is, all the corresponding rows and columns are eliminated when the function There is no problem for homogeneous Dirichlet boundary, but for non-homogeneous Dirichlet boundary, I don't think this treatment is reasonable. I am a beginner of MFEM, so I am not sure of this problem. Should I change the right-side item of the linear system non-homogeneous Dirichlet boundary? Thanks, |
Hi @Liu0813, Suppose you have Please let us know if this solves the issue. Best, Socratis |
Hi @psocratis, That is right. The method Thanks, |
@Liu0813, you can still use
A disclaimer is that you'll need to be a little more careful if you want higher-than-first order accuracy in time... but I believe this will work fine for forward/backward Euler. I can also elaborate on my suggested approach if needed. |
Hi @cjvogl,
Thanks, |
Hi @Liu0813, Here are some notes about applying b.c. that might be helpful. If you split the dofs in to two groups:
Since we want to solve just for the
Since we do not want to change the sizes of the vectors and matrices depending on the essential b.c., we can augment the above system of ODEs by
and solve for the vector:
e.g. with initial condition
Note that when
and the complement matrices
where To support SDIRK methods (and backward Euler, in particular) one has to update the implementation of
or
Note that the matrix of the l.h.s. can also be replaced by |
Hi @v-dobrev, |
Hi @v-dobrev , If the boundary condition is nonhomogeneous Dirichlet and time-dependent, i.e.,
In terms of the above explanations, after set essential boundary conditions, we should get
It's not clear to me how to obtain the rhs? |
|
Hi @chang-yiyi, Sorry for not replying earlier. You are correct: when If your Another possibility (I'm not sure if this works well) is to use under-integration for the mass matrix, so that it becomes diagonal and then |
Thanks @v-dobrev , Your answer is very clear. Thanks again. Making a small suggestion that if replacing homogenous boundary conditions into inhomogeneous ones and replacing only Dirichlet boundary conditions into mixed Dirichlet and Neumann boundary conditions in examples in |
Hi @chang-yiyi, Thank you for the feedback, that is useful and definitely appreciated 👍 Yes, we should have more boundary condition in the examples, that's why we added Example 27, and we should continue to add more. We always welcome contributions, so if you have any specific code suggestions, please feel free to open a PR. Tzanio |
Hi @v-dobrev If I am solving the system fully implicitly, and use backward Euler, I can let Due to my preconditioner, I prefer to think the problem in a fully discretized sense. So I always target at solving Qi |
Regarding the need for more examples, I fully agree that more examples would be helpful. However, there are so many special cases that this is difficult. For one example you could look at the Another approach can be seen in the |
@chang-yiyi the PETSc classes can handle time-dependent non-homogeneous boundary conditions (linearity in state vector is assumed), see e.g https://github.com/mfem/mfem/blob/master/linalg/petsc.cpp#L3659. This function computes the value of the residual of the ODE written in implicit form using exact BC. Then, it modifies the residual to properly compute the update when solving the (non)linear system of equations (take a look at how the Jacobian is modified here https://github.com/mfem/mfem/blob/master/linalg/petsc.cpp#L3760). The interface for boundary conditions is quite general https://github.com/mfem/mfem/blob/master/linalg/petsc.hpp#L452. You only need to override the evaluation method https://github.com/mfem/mfem/blob/master/linalg/petsc.hpp#L478. |
Hi @v-dobrev , What I was wondering is: can we instead set Also, for higher order schemes, should the derivative approximation be computed for each intermediate step when calling the overridden Thanks! |
In most examples of MFEM, the homogeneous dirichlet boundary is used. But I want to set nonhomogeneous Dirichlet boundary in a time-dependent solver. I hope to know what I should do. And is there any similar examples? Thanks.
The text was updated successfully, but these errors were encountered: