Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.
Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Weak Form PDE: how to impose Neumann BCs?
Posted May 1, 2014, 4:45 p.m. EDT Materials, Studies & Solvers Version 4.3b 1 Reply
Please login with a confirmed email address before reporting spam
Hi everyone,
I'm new in Comsol, so I apologise in advance if my question is trivial. I'm exploring Comsol capabilities in solving PDEs, and my current unidimensional equation is the follow:
A(u) u'' = f
where u = u(x). I'm trying to use the weak form, then by using a test function v, it becomes:
[v A ux] - (vx A ux + v A' ux^2)- v f = 0
-test(ux)*A(u)*ux - test(u)*dA(u)*ux^2 - test(u)*f(x) in Comsol
where [ ] denotes the boundary terms, and the apex ' is a derivative wrt the argument of the function (i.e. A' = dA/du = dA). Here (A ux) should be the flux term.
In order to check if what I do is right, I'm using two benchmark case:
- CASE (1): A(u) = u and u(x) = 2 sin(x) + (x/pi)^2 + 0.5
- CASE (2): A(u) = u and u(x) = x^2-x^3 then f = (2-6x)(x^2 - x^3)
By imposing Dirichlet BCs (by means of "Dirichlet Boundary Condition" modules and selecting "prescribed value of u") Comsol computes a solution that (1) does not match the benchmark function, even if the BCs are satisfied. In case (2) it finds the benchmark solution.
By imposing Neumann BCs, instead I have some trouble. A "flux/source" module is added, and then the equation is
-n flux = g - qu
I set q = 0. At the right side, for instance, I compute g as follows (R denotes right side, i.e x = xR):
flux(R) = A(uR) ux(R) = uR*duR = g
where uR denotes the value of u at x=xR whereas duR is the value of derivative at x = xR.
When I compute a solution using these settings (for instance a Dirichlet BC at the left side and a Neumann at right), in the case (1) Comsol reaches the maximum number of iterations allowed (even if I use as initial guess the exact function), whereas in case (2) the final solution breaks the BCs I wanted to impose.
Where is the mistake?
Thanks in advance for all your help.
Pietro
PS
In which direction is the normal vector n assumed to be positive? When does it point inside or outside the domain?
I'm new in Comsol, so I apologise in advance if my question is trivial. I'm exploring Comsol capabilities in solving PDEs, and my current unidimensional equation is the follow:
A(u) u'' = f
where u = u(x). I'm trying to use the weak form, then by using a test function v, it becomes:
[v A ux] - (vx A ux + v A' ux^2)- v f = 0
-test(ux)*A(u)*ux - test(u)*dA(u)*ux^2 - test(u)*f(x) in Comsol
where [ ] denotes the boundary terms, and the apex ' is a derivative wrt the argument of the function (i.e. A' = dA/du = dA). Here (A ux) should be the flux term.
In order to check if what I do is right, I'm using two benchmark case:
- CASE (1): A(u) = u and u(x) = 2 sin(x) + (x/pi)^2 + 0.5
- CASE (2): A(u) = u and u(x) = x^2-x^3 then f = (2-6x)(x^2 - x^3)
By imposing Dirichlet BCs (by means of "Dirichlet Boundary Condition" modules and selecting "prescribed value of u") Comsol computes a solution that (1) does not match the benchmark function, even if the BCs are satisfied. In case (2) it finds the benchmark solution.
By imposing Neumann BCs, instead I have some trouble. A "flux/source" module is added, and then the equation is
-n flux = g - qu
I set q = 0. At the right side, for instance, I compute g as follows (R denotes right side, i.e x = xR):
flux(R) = A(uR) ux(R) = uR*duR = g
where uR denotes the value of u at x=xR whereas duR is the value of derivative at x = xR.
When I compute a solution using these settings (for instance a Dirichlet BC at the left side and a Neumann at right), in the case (1) Comsol reaches the maximum number of iterations allowed (even if I use as initial guess the exact function), whereas in case (2) the final solution breaks the BCs I wanted to impose.
Where is the mistake?
Thanks in advance for all your help.
Pietro
PS
In which direction is the normal vector n assumed to be positive? When does it point inside or outside the domain?
1 Reply Last Post May 4, 2014, 10:45 a.m. EDT