Comsol use properties in weak form

By providing your email address, you consent to receive emails from COMSOL AB and its affiliates about the COMSOL Blog, and agree that COMSOL may process your information according to its Privacy Policy. This consent may be withdrawn.

Suggested Posts

Comments (18)

Tae Eun Kim
June 16, 2015 Can I get this app if it is possible? thanks.
Jing Wang

July 6, 2015 Dear Chien, I‘ve followed your instruction step by step in my comsol 5.0, however, i couldn’t get the same load vector as yours although i got the same stiffness matrix. My load vector is
0
0
-8.881784197001252E-16
1.7763568394002505E-15
-1.1102230246251565E-15
0
instead of
-2
0
0
0
0
9
Can you please post your mph.file here so i can check it out?
Thank you anyway! Best regards, Jing

Chien Liu

Chien Liu

July 13, 2015 COMSOL Employee Dear Jing, Thank you for the comments. Most likely the boundary conditions were not specified as described. If you need further assistance, please contact us at
support@comosl.com Sincerely, Chien

Jing Wang
July 15, 2015
Jing Wang

July 18, 2015 Dear Chien,
Thanks for your reply! I’ve checked the boundary conditions, they are just the same as those in your post “Implementing the Weak Form in COMSOL Multiphysics”. Can you please send your mph.file to me (My email: comsol@foxmail.com)? Thank you anyway!
Sincerely,
Jing

Chien Liu

Chien Liu

July 20, 2015 COMSOL Employee Dear Jing, Thank you for following up and please contact us at
support@comsol.com Sincerely, Chien

Roland Ernst

February 9, 2016 Dear Chien, Very interesting blog about how the weak_form is implemented in Comsol! I followed a specialized Comsol seminary about these aspects about 10 years ago and would like to remind this again. So I have 2 questions about that:
1/ I have not understood how the matrices Null, Kc and Lc are formed. What means for example your sentence: “Null are formed by the basis vectors spanning the null space of the constraint Jacobian matrix N”? Is there a book or some publications about all these aspects and more specifically the theory of Lagrange multipliers?
2/ I have not completely understood what is the difference between ideal and non ideal constraints and when to use either one or the other one (I think now this has been replaced by options like “apply reaction terms on all physics/or individual dependant variables”). Could you please give me some explanations about that and how it influences the former matrices and also what’s the physical signification of this? A blog about that special aspect would also be very appreciated!
Thanks in advance for your help!
Sincerely
Roland

Chien Liu

Chien Liu

February 9, 2016 COMSOL Employee Dear Roland, Thank you for the comments! Regarding the questions, you should be able to find more information in the COMSOL Multiphysics Reference Manual > Equation-Based Modeling > Modeling with PDEs > About Weak Form PDE (and the following sections). And yes we plan to continue the blog series with more topics on the constraints. Thank you for your interest in this. Sincerely, Chien

Roland Ernst

February 16, 2016 Dear Chien, Thank you for your comments. But sorry when I go to your mentioned Comsol documentation I find nothing speaking about the Null, Kc, Lc (etc…) matrices you use in your weak form implementation explanations of your blog. Could you please give me some more details about for instance your Null matrix is built? Meaning I don’t understand what you mean by saying ” The columns of the matrix Null are formed by the basis vectors spanning the null space of the constraint Jacobian matrix N” . Thank you for your help!
Regards
Roland

Evgeni Sergeev

March 10, 2016 Thank you very much for the blog series. A tremendous value-adder to Comsol. I think this is helping every user of Comsol who is serious about understanding what they’re doing, and not just generating pretty pictures. If anybody is interested in condition numbers, just wanted to add that computing cond(K) is meaningless, while cond(Kc) is correct. (Even though K is called the “stiffness matrix”, so that one might intuitively attempt to compute its condition number.) It’s the equation Kc×Un=Lc that gets sent to the linear solver, so Kc is the relevant one. The condition number of the original system
cond([ms.K ms.NF; ms.N zeros(size(ms.N,1))])
might also make sense to check [in my case this is similar to cond(Kc)], but not cond(K). I suspect that the condition number is somehow related to LinErr (trying to understand why the relative error in my model is so high, when the residual is plotted as zero everywhere and LinRes is ~1e-15). This isn’t clear from how LinErr is defined in the documentation, but they seem correlated to some extent.

wang shuo

March 13, 2016 I think there might be a error about the load vector which should be,
(-2,0,0,0,0,\lamda_2)^T
and also the solution vector,
(a_1,a_2,a_3,a_4,a_5,9)^T
Please correct me if I am wrong

Chien Liu

Chien Liu

March 15, 2016 COMSOL Employee Dear shuo,
\lambda_2 belongs to the vector formed by U and \Lambda. Please see Eq. (2) and the graph below it.
Sincerely,
Chien

Evgeni Sergeev

June 20, 2016 I’ve ran into the same issue as Jing Wang above: the load vector entries are all zero or near machine epsilon. I posted my 1-element MPH model and a detailed description on the forum:
https://www.comsol.com/community/forums/general/thread/116751/#p259471 It also shows a way to get the load vector, by messing with “Linear perturbation” settings. I don’t fully understand the meaning of that, but it may be of interest for those who wish to get the matrices using LiveLink and solve in Matlab. Regards,
Evgeni

Chien Liu

Chien Liu

June 20, 2016 COMSOL Employee Dear Evgeni, Thank you for the comment. Did you perform this step as described in the text of the blog post: “Make sure to drag the Assemble node up to position it before the Stationary Solver node.” ? If this step is not done and the Assemble node is left after (below) the Stationary Solver node, then the content of the load vector may be altered by the solver as you have observed. Hope this helps. Sincerely, Chien

ChienShun Liu

July 31, 2020 Dear Chien: I saw in your post ‘Implementing the Weak Form with a COMSOL App’
how to extract/view the stiffness matrix and the right hand side Lc.
I wonder if it is possible to extract the (extended) mass matrix without
using Livelink? Problem description:
Lap u = f in Omega
u = g_D on Gamma_1 (pointwise constraint)
du/dn = g_N on Gamma_2 (natural BC) By extended mass matrix I mean one that takes
the input (f_DOF,g_D,g_N) and out put to the
right hand side Lc in the final equation Kc u = Lc Here f_DOF means the point values of the source term f
on the degrees of freedom (nodes) of the underlying finite element
method.

Chien Liu

Chien Liu

July 31, 2020 COMSOL Employee Dear ChienShun, If you meant Eq. (6) then yes, as you can see in the last screenshot in the post, Kc and Lc are evaluated. No LiveLink products are used in the App, only the base package is used. If you need further assistance, please contact us using your COMSOL support portal (log in to your COMSOL Access account at https://www.comsol.com/access and then click on the Submit New Support Case button). Sincerely, Chien

Nmisha Arora

March 26, 2021 Sir, I have implemented this model in COMSOL 5.5, as described in this blog post and earlier posts. I didn’t get the exact same stiffness matrix but the load matrix was up-to mark.
Following is what I get: 2.3333 -2.6667 0.33333 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
-2.6667 5.3333 -2.6667 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.33333 -2.6667 4.6667 -2.6667 0.33333 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 -2.6667 5.3333 -2.6667 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.33333 -2.6667 4.6667 -2.6667 0.33333 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 -2.6667 5.3333 -2.6667 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000 0.33333 -2.6667 4.6667 -2.6667 0.33333 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 -2.6667 5.3333 -2.6667 0.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.33333 -2.6667 2.3333 1.0000
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.0000 0.0000