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.

Representation of a PDE in COMSOL

Please login with a confirmed email address before reporting spam

Need help with representing the following equation in the general form:

∂u1/∂t+∇.D.∇(u1+u2)=f

6 Replies Last Post Nov 8, 2011, 5:24 p.m. EST

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 1, 2011, 11:56 p.m. EDT
I think you will have to use the weak form.

You can look at the weak forms of the equations in a species transport problem, the equations are similar. You will have a good idea of how to develop you're equation.
I think you will have to use the weak form. You can look at the weak forms of the equations in a species transport problem, the equations are similar. You will have a good idea of how to develop you're equation.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 2, 2011, 11:08 a.m. EDT
I don't really use general form modelling it should look like

∂u1/∂t + ∇• Γ = f'

with Γ = D∇u1 and f' = f - ∇• D∇u2 as long as there is not some sort of functional dependency of type u2[u1]. Also, weak form modelling can be easily applied to this equation and may offer some advantages if you are interested in moving domains. Weak form (for Neumann boundary conditions) looks like

∫(ψ ∂u1/∂t) dx - ∫(∇ψ • ∇u1) dx = ∫ψf' dx

Hope this helps,
Alex
I don't really use general form modelling it should look like ∂u1/∂t + ∇• Γ = f' with Γ = D∇u1 and f' = f - ∇• D∇u2 as long as there is not some sort of functional dependency of type u2[u1]. Also, weak form modelling can be easily applied to this equation and may offer some advantages if you are interested in moving domains. Weak form (for Neumann boundary conditions) looks like ∫(ψ ∂u1/∂t) dx - ∫(∇ψ • ∇u1) dx = ∫ψf' dx Hope this helps, Alex

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 2, 2011, 2:20 p.m. EDT
Thanks for your response...I will try with the weak form...
Thanks for your response...I will try with the weak form...

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 2, 2011, 3:49 p.m. EDT
Thanks for your reply. I am trying to represent my system of equations in the general/coefficient form first. How do I represent ∇u1 or ∇^2 u1 in COMSOL either in the conservative flux or the source term?
Thanks for your reply. I am trying to represent my system of equations in the general/coefficient form first. How do I represent ∇u1 or ∇^2 u1 in COMSOL either in the conservative flux or the source term?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 2, 2011, 7:52 p.m. EDT
Differential operations are represented by

∂u1/∂x → diff(u1,x) or simply u1x

which works for all coordinates as well as time. The first expression is the actual formulation, by default COMSOL defines the second one as the first for but only for variables within the model, so it will not work for any self defined functions. Scalar products need to be written as sums of these expressions.

Depending on u2, higher order operators can be a little bit tricky. If you have an analytic form of u2, you should be fine, however, if u2 is a solution of an FEM-simulation you may notice that the operation

∂²u2/∂x² → diff(diff(u2,x),x)

is 0 everywhere which is a consequence from the underlying H1-discretization. If that should be the case, it usually helps to define an additional application mode and set u3 via something like u2x = u3 and employ

∂²u2/∂x² = ∂u3/∂x→ diff(u3,x)

in the original set of equations. However, I am still working with COMSOL 3.5, so it is possible that there have been some changes in the syntax. Just try it, otherwise, you will have to check the doku.

Alex
Differential operations are represented by ∂u1/∂x → diff(u1,x) or simply u1x which works for all coordinates as well as time. The first expression is the actual formulation, by default COMSOL defines the second one as the first for but only for variables within the model, so it will not work for any self defined functions. Scalar products need to be written as sums of these expressions. Depending on u2, higher order operators can be a little bit tricky. If you have an analytic form of u2, you should be fine, however, if u2 is a solution of an FEM-simulation you may notice that the operation ∂²u2/∂x² → diff(diff(u2,x),x) is 0 everywhere which is a consequence from the underlying H1-discretization. If that should be the case, it usually helps to define an additional application mode and set u3 via something like u2x = u3 and employ ∂²u2/∂x² = ∂u3/∂x→ diff(u3,x) in the original set of equations. However, I am still working with COMSOL 3.5, so it is possible that there have been some changes in the syntax. Just try it, otherwise, you will have to check the doku. Alex

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Nov 8, 2011, 5:24 p.m. EST
Thanks Alex. In version 4.1 i figured out the 2nd derivative is represented as u1xx.
Thanks Alex. In version 4.1 i figured out the 2nd derivative is represented as u1xx.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.