Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

14
COMOL log earch log Implemenng the Weak Form in COMOL Mulphic Chien Liu | Januar 6, 2015 Thi log pot i part of a erie aimed at introducing the weak form with minimal prerequiite. In the firt log pot , we learned aout the aic concept of the weak formulation. All equation were left in the analtical form. Toda, we will implement and olve the equation numericall uing the COMOL Multiphic imulation oftware. You are encouraged to follow the tep with a working cop of the COMOL oftware. Recapping the aic Idea Recall that in the previou entr , we tudied a imple example of 1D heat tranfer at tead tate with no heat ource, where the temperature i a function of the poition in the domain defined the interval . The weak formulation turn the differential equation for the heat tranfer phic into an integral equation, with a tet function a a localized ampling function within the integrand to clamp down the olution. Integrating the weak form part provide the numerical enefit of reduced differentiation order. It alo provide a natural wa to pecif oundar condition in term of the heat flux. For fixed oundar condition, in

description

Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Transcript of Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Page 1: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

     

COMOL log

earch log

Implemen逃㌂ng the Weak Form in COMOLMul逃㌂phicChien Liu | Januar 6, 2015

Thi log pot i part of a erie aimed at introducing the weak form with minimalprerequiite. In the firt log pot, we learned aout the aic concept of the weakformulation. All equation were left in the analtical form. Toda, we will implementand olve the equation numericall uing the COMOL Multiphic imulationoftware. You are encouraged to follow the tep with a working cop of the COMOLoftware.

Recapping the aic IdeaRecall that in the previou entr, we tudied a imple example of 1D heat tranfer attead tate with no heat ource, where the temperature   i a function of thepoition   in the domain defined  the interval  .

The weak formulation turn the differential equation for the heat tranfer phic intoan integral equation, with a tet function   a a localized ampling function withinthe integrand to clamp down the olution. Integrating the weak form  part providethe numerical enefit of reduced differentiation order. It alo provide a natural wa topecif oundar condition in term of the heat flux. For fixed oundar condition, in

term of the temperature, the weak formulation ue the ame mechanim of tet

Page 2: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

(1)

term of the temperature, the weak formulation ue the ame mechanim of tetfunction and it natural oundar condition to contruct additional term in theequation tem.

In the end, we arrived at an exemplar equation that look like thi:

Here, the integrand on the lefthand ide involve onl the firt derivative of thetemperature, the firt term on the righthand ide define that the outgoing flux houlde 2 at the left oundar ( ), and the other two term on the righthand idetogether pecif that the temperature hould e 9 at the right oundar ( ).

The Weak Form PD InterfaceTo implement q. (1) in COMOL Multiphic, we ue the Model Wizard to create anew 1D model with a Weak Form PD (w) interface (under Mathematic > PD Interface)and a tationar tud. The dependent variale can e et to T to match the notation inour equation. For the geometr, we make an Interval etween 1 and 5. The weakexpreion under the default “Weak Form PD 1″ node read: test(Tx)*Tx+1[m^2]*test(T), where the firt term correpond to the integrandin our q. (1) and the econd term correpond to a heat ource, which i not in ourimple example and hould e removed from the input field.

The weak expreion now read: test(Tx)*Tx, where Tx i the COMOLMultiphic notation for  , the firt derivative of the temperature, andtest(Tx) i the firt derivative of the tet function  . The negative ign comefrom the convention that the input field aume that the expreion i on the righthand ide of the equal ign (a een in the “quation” ection of the etting window),while the integral in our equation i on the lefthand ide.

Page 3: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

The Weak Contriu逃㌂on FeatureTo implement the weak form term on the righthand ide of q. (1) for the oundarcondition, rightclick the Weak Form PD (w) node. We ee that there are uiltinoundar feature uch a the Dirichlet oundar Condition item, which i availale inthe popup menu for our convenience. However, ince here we are intereted inentering the equation ourelve, we hover the moue over the item More in the popupmenu and click on the item Weak Contriution in the next popup menu.

Page 4: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

In the etting window for the “Weak Contriution 1″ node under oundar election,we elect oundar 1 at the left end of the domain (at  ). We then enter the weakexpreion a: 2*test(T) under the ection Weak Contriution in the ame ettingwindow. Thi take care of the firt term on the righthand ide of q. (1), whichpecifie the outgoing flux to e 2 at the oundar  .

Fixed oundar Condi逃㌂onFor the fixed oundar condition at  , where the lat two term on the righthandide of q. (1) together pecif that  , we create another “Weak Contriution”node at oundar 2 at the right end of the domain and an Auxiliar Dependent Varialeunode under it.

We enter lambda2 for the Field variale name in the unode and then enter the weakexpreion a the two term in q. (1): lambda2*test(T)test(lambda2)*(T9)

Page 5: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Dicre逃㌂za逃㌂onThe COMOL oftware dicretize the domain  creating a meh. Let’ rightclick theMeh 1 node and elect dge and then rightclick dge 1 and elect Ditriution. Then,we et the “Numer of element” to 4 and click uild All. We intentionall keep thenumer of element mall to make it eaier when we dicu the dicretization in moredetail later.

Alo, under the Dicretization ection in the etting window for the Weak Form PD (w)interface node, we et the “lement order” to Linear (click on the how utton underModel uilder and then the item Dicretization in the popup menu to enale theDicretization ection):

Page 6: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Compute the olu逃㌂on in COMOL Mul逃㌂phicNow we are read to click Compute and check whether the olution make ene.

The olution give a traight line within the domain, which i conitent with thetemperature profile at tead tate with no heat ource. The lope of the line i 2,which i conitent with the oundar condition that the outgoing flux i 2 at  .The temperature i 9 at  , a pecified  the fixed oundar condition. incethere i no heat ource, the total heat flux going out of the domain hould um up tozero in the tead tate. Thu, the outgoing flux hould e 2 at  .

We readil verif thi  making a point evaluation of the heat flux variale lambda2,a hown in the creenhot elow:

Page 7: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

ome reader ma wonder whether it i alwa necear to olve for the auxiliarvariale lambda2, the ocalled Lagrange multiplier, epeciall if it i not needed  themodeler and olving for it inevital require more computation. A we will ee in thefollowing pot, COMOL Multiphic provide alternative feature and allow theuer to decide whether or not to olve for the Lagrange multiplier.

ummar and Next UpToda, we refrehed the concept of the weak formulation and implemented anexemplar weak form equation (1) in COMOL Multiphic. The reulting numericalolution ehave a expected from imple phical argument.

In future log pot, we will take a look “under the hood” to ee how the weak formequation, uch a q. (1), are dicretized and olved numericall. We will ee how theame prolem can e olved in different wa and how different oundar conditioncan e et up for different tpe of prolem.

ta tuned!

Pot Categorie

Page 8: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

« Previou Potringing Multiphic into Architecture

Next Pot »Detecting Dark Matter Axion with aMicrowave Cavit

Pot Categorie

Core Functionalit   quationaed Modeling

Pot Tag

Technical Content | Weak Form

Comment

tefano Maffei Januar 8, 2015 at 6:03 am

Thank a lot for thi clear article. I am looking forward for the nextone.Do ou have a pecific reference concerning finite element/pectralelement that I can ue to get more inight into thee concept?

Chien Liu Januar 8, 2015 at 10:19 am

Dear tefano,

Thank ou for our interet in thi log pot. You ma find the lit ofook elow of interet.

incerel,

Chien

Thee ook might e of interet for getting an indepth knowledge offinite element anali:

* T. J. R. Hughe, The Finite lement Method: Linear tatic andDnamic Finite lement Anali, Dover Pulication (2000)

* O. C. Zienkiewicz & R. L. Talor, The Finite lement Method et,

Page 9: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

* O. C. Zienkiewicz & R. L. Talor, The Finite lement Method et,utterworthHeinemann; 7th edition (2011)

* .C. renner & L.R. cott, The Mathematical Theor of Finite lementMethod, pringer; 3rd edition (2009)

For the application of the finite element method to partial differentialequation in particular, thee ook might e of interet:

* K. rikon, D. tep, P. Hano, C. Johnon, ComputationalDifferential quation, Camridge Univerit Pre; 2nd edition (1996)

* C. Johnon, Numerical olution of Partial Differential quation  theFinite lement Method, Dover Pulication (2009)

For fluid flow, thi ook ha a ection on comparion etween thefinite volume method and the finite element method. It i alo a goodreference for different finite element tpe ued for CFD:

* P. M. Greho & R. L. ani, Incompreile Flow and the Finite lementMethod, Volume 2, Iothermal Laminar Flow, John Wile & on (2000)

For lectromagnetic, epeciall highfrequenc, thi i an excellentreference:

* Jianming Jin, The Finite lement Method in lectromagnetic, WileI Pre; 3rd edition (2014)

Camille pingarn Feruar 3, 2015 at 5:12 am

Ren Wenxi Feruar 7, 2015 at 6:48 am

Dear Liu,Thank ou o much for our article aout the weak form. I have eenintereted in the application of the weak form in tructure anali.Recentl, i am tring to deign a imple tructure anali module weak form. ut there i a prolem in m code. I hope our help. Thefollowing i m code:% Diplacement field% Dependent variale u, v% Variale 1.44*10^4[MPa] % Young modulu

Page 10: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

 1.44*10^4[MPa] % Young modulupr 0.2 % Poion’ ratio% laticit matrixD11 /(1pr^2)D22 /(1pr^2)D33 /(2*(1+pr))D12 *pr/(1pr^2)D21 D12D23 0[Pa]D32 0[Pa]D13 0[Pa]D31 0[Pa]% trainex uxe vex 0.5*(u+vx)% trex D11*ex+D12*e+2*D13*ex D21*ex+D22*e+2*D23*exx D31*ex+D32*e+2*D33*ex% quationx*tet(ux)x*tet(u) % X Direction*tet(v)x*tet(vx) % Y Direction

Ren Wenxi Feruar 7, 2015 at 6:49 am

Look forward to our repl~

Chien Liu Feruar 9, 2015 at 10:37 am

Hi Ren,

Thank ou for contacting u on thi. In thi cae we recommend thatou pleae contact our upport team for help. The can e reached at:

http://www.comol.com/upport

et regard,

Chien

Page 11: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Chien

tefano Maffei Feruar 18, 2015 at 5:38 am

Hi Chien,Let’ a I have a tem of equation (in m cae i have an eigenvalueprolem). Then I multipl oth equation  their correponding tetfunction (a m variale are  and c), integrate  part and appl theoundar condition I have. Imagine after all I am left with omethinglike:

\int [ weak form for  ] dx = [lamda*tet()*x]_x1\int [ weak form for c ] dx = [tet(c)*cx]_x1

where lamda i the eigenvalue (orr if thi look complicated, I jutthink that with an example i etter to talk aout thing). Imagine thatomehow i have no information aout the derivative in x0 (a i x1everthing vanihe).

M quetion i: thee oundar term have t e retained, a the mighte important in adjuting the ehaviour of the olution near x1. Howhould I treat them? hould I put in the weak contriution unodelamda*tet()*x + tet(c)*cxapplied on x1?

Thank

Chien Liu Feruar 18, 2015 at 8:17 am

Hi tefano,

Thank ou for contacting u on thi. In thi cae we recommend thatou pleae contact our upport team for help. The can e reached at:

http://www.comol.com/upport

Thank!

Chien

Page 12: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Pu Zhang April 16, 2015 at 11:54 pm

Ver nice log pot! o i thi poiilit of inpecting tem matrix anew feature in COMOL 5?

Chien Liu April 17, 2015 at 11:01 am

Hello Pu,

Thank ou for the comment. You were proal referring to thi entr:

http://www.comol.com/log/implementingtheweakformwithacomolapp/

The poiilit of inpecting the tem matrix i not new. In fact it haeen availale to uer from the eginning.

Of coure the Application uilder i a rand new feature in COMOL5.0 (and further enhanced in 5.1). We elieve the uer’ productivitcan e greatl improved  COMOL App, a illutrated in the aovelog pot (and man other).

Chien

Chien Liu April 17, 2015 at 1:11 pm

In the previou meage I forgot to add the link to other log pot onCOMOL App. The can e found here:

http://www.comol.com/log/categor/all/application/

jackhine ma June 18, 2015 at 9:12 pm

Dear Chien Liu,Ver glad to learn from our log on Weak form of comol and it’ aver good log pecifing on weak form that merel introduced

detailedl anwhere. However, I wonder that wh there i a 2order

Page 13: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog

Login Create New COMOL Acce Account Forgot our Paword?

detailedl anwhere. However, I wonder that wh there i a 2orderdifferential in integrand ut onl 1 time integral on the left of equation1. If like thi, the calculating reult of left term would e in a differentialform, which i not like the right polmial.

Chien Liu June 22, 2015 at 11:47 am

Hi jackhine ,Thank ou for the comment.I’m not ure I undertand our quetion ince there i no time integral inequation 1.The integrand hould e interpreted a having parenthei a follow:(dx T) (dx T_tet).Hope thi help clarif the equation.Chien

Login elow to leave a comment ↴

mail *

Paword

Log in automaticall next time

Login

Page 14: Implementing the Weak Form in COMSOL Multiphysics _ COMSOL Blog