How to set non-zero BCs to TimeDependentOperator #4353
-
I am trying to take something like the ConductionOperator in Example 16 and apply non-zero BCs (both Neumann and Dirichlet), but so far I haven't had any success. None of the examples show how to do this for Time-dependent problems. Could someone please show an example of how to do this? I just want to do a simple heat conduction test based on Ex 16 (with alpha=0), using the beam-tet.mesh geometry, where I fix the temperature on one end and apply a heat flux (neumann) on the other end. I tried simply adding a LinearForm object and adding it to the du_dt but it doesn't work. I tried doing something like K.AddBoundaryIntegrator, but I have no idea how to use that. Any guidance is welcome. Thanks, -JD |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
I've figured out how to do Dirichlet. I will post a code snippet soon. However, I am still struggling with Neumann bcs. |
Beta Was this translation helpful? Give feedback.
-
Here is my what my ImplicitSolve and Mult operators looke like: void ConductionOperator::Mult(const Vector &u, Vector &du_dt) const
{
// Compute:
// du_dt = M^{-1}*-Ku
// for du_dt, where K is linearized by using u from the previous timestep
Kmat0.Mult(u, z);
z.Neg(); // z = -z
z += (*b); // b is a pointer, so need to de-reference using *
M_solver.Mult(z, du_dt);
du_dt.SetSubVector(ess_tdof_list,0.0);
}
void ConductionOperator::ImplicitSolve(const real_t dt,
const Vector &u, Vector &du_dt)
{
// Solve the equation:
// du_dt = M^{-1}*[-K(u + dt*du_dt)]
// for du_dt, where K is linearized by using u from the previous timestep
if (!T)
{
T = Add(1.0, Mmat, dt, Kmat);
current_dt = dt;
T_solver.SetOperator(*T);
}
MFEM_VERIFY(dt == current_dt, ""); // SDIRK methods use the same dt
Kmat0.Mult(u, z);
z.Neg();
z += (*b); // b is a pointer, so need to de-reference using *
T_solver.Mult(z, du_dt);
du_dt.SetSubVector(ess_tdof_list,0.0);
} Note that in some parts, I am using For Neumman, I just set the For enforcing Dirichlet BC, I force |
Beta Was this translation helpful? Give feedback.
-
Hi @colmenaresj, There was a discussion on this topic some time ago here: #1720; my comments can be found here #1720 (comment), and here #1720 (comment). Another more recent related issues is #4182 which is about non-homogeneous b.c. for the wave equation. It seems that you already got things working. Is that correct, or do you still need help resolving some issue? |
Beta Was this translation helpful? Give feedback.
Hi @colmenaresj,
There was a discussion on this topic some time ago here: #1720; my comments can be found here #1720 (comment), and here #1720 (comment).
Another more recent related issues is #4182 which is about non-homogeneous b.c. for the wave equation.
It seems that you already got things working. Is that correct, or do you still need help resolving some issue?