0% found this document useful (0 votes)
250 views

Implementing The Weak Form in COMSOL Multiphysics - COMSOL Blog

1) The document implements a 1D heat transfer problem in the weak form using COMSOL Multiphysics software. It sets up the model geometry and weak form PDE interface, adds weak contributions for the boundary conditions, and computes the solution. 2) The solution gives a linear temperature profile as expected for steady state heat transfer with no heat source and the specified boundary conditions. It verifies that the heat flux satisfies the outgoing boundary condition. 3) The post discusses that COMSOL allows the user to choose whether to solve for auxiliary Lagrange multiplier variables defined for enforcing essential boundary conditions.

Uploaded by

Saif Evony
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
250 views

Implementing The Weak Form in COMSOL Multiphysics - COMSOL Blog

1) The document implements a 1D heat transfer problem in the weak form using COMSOL Multiphysics software. It sets up the model geometry and weak form PDE interface, adds weak contributions for the boundary conditions, and computes the solution. 2) The solution gives a linear temperature profile as expected for steady state heat transfer with no heat source and the specified boundary conditions. It verifies that the heat flux satisfies the outgoing boundary condition. 3) The post discusses that COMSOL allows the user to choose whether to solve for auxiliary Lagrange multiplier variables defined for enforcing essential boundary conditions.

Uploaded by

Saif Evony
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

COMOLlog

earchlog

ImplemenngtheWeakForminCOMOL
Mulphic
ChienLiu|Januar6,2015

Thilogpotipartofaerieaimedatintroducingtheweakformwithminimal
prerequiite.Inthefirtlogpot,welearnedaouttheaicconceptoftheweak
formulation.Allequationwereleftintheanalticalform.Toda,wewillimplement
andolvetheequationnumericalluingtheCOMOLMultiphicimulation
oftware.YouareencouragedtofollowthetepwithaworkingcopoftheCOMOL
oftware.

RecappingtheaicIdea
Recallthatinthepreviouentr,wetudiedaimpleexampleof1Dheattranferat
teadtatewithnoheatource,wherethetemperature iafunctionofthe
poition inthedomaindefinedtheinterval
.
Theweakformulationturnthedifferentialequationfortheheattranferphicinto
anintegralequation,withatetfunction
aalocalizedamplingfunctionwithin
theintegrandtoclampdowntheolution.Integratingtheweakformpartprovide
thenumericalenefitofreduceddifferentiationorder.Italoprovideanaturalwato
pecifoundarconditionintermoftheheatflux.Forfixedoundarcondition,in
termofthetemperature,theweakformulationuetheamemechanimoftet

termofthetemperature,theweakformulationuetheamemechanimoftet
functionanditnaturaloundarconditiontocontructadditionalterminthe
equationtem.
Intheend,wearrivedatanexemplarequationthatlooklikethi:
(1)
Here,theintegrandonthelefthandideinvolveonlthefirtderivativeofthe
temperature,thefirttermontherighthandidedefinethattheoutgoingfluxhould
e2attheleftoundar(
),andtheothertwotermontherighthandide
togetherpecifthatthetemperaturehoulde9attherightoundar(
).

TheWeakFormPDInterface
Toimplementq.(1)inCOMOLMultiphic,weuetheModelWizardtocreatea
new1DmodelwithaWeakFormPD(w)interface(underMathematic>PDInterface)
andatationartud.ThedependentvarialecaneettoTtomatchthenotationin
ourequation.Forthegeometr,wemakeanIntervaletween1and5.Theweak
expreionunderthedefaultWeakFormPD1noderead:
test(Tx)*Tx+1[m^2]*test(T),wherethefirttermcorrepondtotheintegrand
inourq.(1)andtheecondtermcorrepondtoaheatource,whichinotinour
impleexampleandhoulderemovedfromtheinputfield.
Theweakexpreionnowread:test(Tx)*Tx,whereTxitheCOMOL
Multiphicnotationfor

,thefirtderivativeofthetemperature,and

test(Tx)ithefirtderivativeofthetetfunction

.Thenegativeigncome

fromtheconventionthattheinputfieldaumethattheexpreioniontheright
handideoftheequalign(aeeninthequationectionoftheettingwindow),
whiletheintegralinourequationionthelefthandide.

TheWeakContriuonFeature
Toimplementtheweakformtermontherighthandideofq.(1)fortheoundar
condition,rightclicktheWeakFormPD(w)node.Weeethatthereareuiltin
oundarfeatureuchatheDirichletoundarConditionitem,whichiavailalein
thepopupmenuforourconvenience.However,incehereweareinteretedin
enteringtheequationourelve,wehoverthemoueovertheitemMoreinthepopup
menuandclickontheitemWeakContriutioninthenextpopupmenu.

IntheettingwindowfortheWeakContriution1nodeunderoundarelection,
weelectoundar1attheleftendofthedomain(at
).Wethenentertheweak
expreiona:2*test(T)undertheectionWeakContriutionintheameetting
window.Thitakecareofthefirttermontherighthandideofq.(1),which
pecifietheoutgoingfluxtoe2attheoundar
.

FixedoundarCondion
Forthefixedoundarconditionat
,wherethelattwotermontherighthand
ideofq.(1)togetherpecifthat
,wecreateanotherWeakContriution
nodeatoundar2attherightendofthedomainandanAuxiliarDependentVariale
unodeunderit.
Weenterlambda2fortheFieldvarialenameintheunodeandthenentertheweak
expreionathetwoterminq.(1):lambda2*test(T)test(lambda2)*(T9)

Dicrezaon
TheCOMOLoftwaredicretizethedomaincreatingameh.Letrightclickthe
Meh1nodeandelectdgeandthenrightclickdge1andelectDitriution.Then,
weettheNumerofelementto4andclickuildAll.Weintentionallkeepthe
numerofelementmalltomakeiteaierwhenwedicuthedicretizationinmore
detaillater.

Alo,undertheDicretizationectionintheettingwindowfortheWeakFormPD(w)
interfacenode,weetthelementordertoLinear(clickonthehowuttonunder
ModeluilderandthentheitemDicretizationinthepopupmenutoenalethe
Dicretizationection):

ComputetheoluoninCOMOLMulphic
NowwearereadtoclickComputeandcheckwhethertheolutionmakeene.
Theolutiongiveatraightlinewithinthedomain,whichiconitentwiththe
temperatureprofileatteadtatewithnoheatource.Thelopeofthelinei2,
whichiconitentwiththeoundarconditionthattheoutgoingfluxi2at
.
Thetemperaturei9at
,apecifiedthefixedoundarcondition.ince
thereinoheatource,thetotalheatfluxgoingoutofthedomainhouldumupto
zerointheteadtate.Thu,theoutgoingfluxhoulde2at
.
Wereadilverifthimakingapointevaluationoftheheatfluxvarialelambda2,
ahowninthecreenhotelow:

omereadermawonderwhetheritialwaneceartoolvefortheauxiliar
varialelambda2,theocalledLagrangemultiplier,epeciallifitinotneededthe
modelerandolvingforitinevitalrequiremorecomputation.Awewilleeinthe
followingpot,COMOLMultiphicprovidealternativefeatureandallowthe
uertodecidewhetherornottoolvefortheLagrangemultiplier.

ummarandNextUp
Toda,werefrehedtheconceptoftheweakformulationandimplementedan
exemplarweakformequation(1)inCOMOLMultiphic.Thereultingnumerical
olutionehaveaexpectedfromimplephicalargument.
Infuturelogpot,wewilltakealookunderthehoodtoeehowtheweakform
equation,uchaq.(1),aredicretizedandolvednumericall.Wewilleehowthe
ameprolemcaneolvedindifferentwaandhowdifferentoundarcondition
caneetupfordifferenttpeofprolem.
tatuned!

PotCategorie
CoreFunctionalit quationaedModeling

PotTag
TechnicalContent|WeakForm

PreviouPot

NextPot

ringingMultiphicintoArchitecture

DetectingDarkMatterAxionwitha
MicrowaveCavit

Comment

tefanoMaffeiJanuar8,2015at6:03am
Thankalotforthicleararticle.Iamlookingforwardforthenext
one.
Doouhaveapecificreferenceconcerningfiniteelement/pectral
elementthatIcanuetogetmoreinightintotheeconcept?

ChienLiuJanuar8,2015at10:19am
Deartefano,
Thankouforourinteretinthilogpot.Youmafindthelitof
ookelowofinteret.
incerel,
Chien
Theeookmighteofinteretforgettinganindepthknowledgeof
finiteelementanali:
*T.J.R.Hughe,TheFinitelementMethod:Lineartaticand
DnamicFinitelementAnali,DoverPulication(2000)

*O.C.Zienkiewicz&R.L.Talor,TheFinitelementMethodet,
utterworthHeinemann;7thedition(2011)
*.C.renner&L.R.cott,TheMathematicalTheorofFinitelement
Method,pringer;3rdedition(2009)
Fortheapplicationofthefiniteelementmethodtopartialdifferential
equationinparticular,theeookmighteofinteret:
*K.rikon,D.tep,P.Hano,C.Johnon,Computational
Differentialquation,CamridgeUniveritPre;2ndedition(1996)
*C.Johnon,NumericalolutionofPartialDifferentialquationthe
FinitelementMethod,DoverPulication(2009)
Forfluidflow,thiookhaaectiononcomparionetweenthe
finitevolumemethodandthefiniteelementmethod.Itialoagood
referencefordifferentfiniteelementtpeuedforCFD:
*P.M.Greho&R.L.ani,IncompreileFlowandtheFinitelement
Method,Volume2,IothermalLaminarFlow,JohnWile&on(2000)
Forlectromagnetic,epeciallhighfrequenc,thiianexcellent
reference:
*JianmingJin,TheFinitelementMethodinlectromagnetic,Wile
IPre;3rdedition(2014)

CamillepingarnFeruar3,2015at5:12am

RenWenxiFeruar7,2015at6:48am
DearLiu,
Thankouomuchforourarticleaouttheweakform.Ihaveeen
interetedintheapplicationoftheweakformintructureanali.
Recentl,iamtringtodeignaimpletructureanalimodule
weakform.utthereiaproleminmcode.Ihopeourhelp.The
followingimcode:
%Diplacementfield
%Dependentvarialeu,v
%Variale

1.44*10^4[MPa]%Youngmodulu
pr0.2%Poionratio
%laticitmatrix
D11/(1pr^2)
D22/(1pr^2)
D33/(2*(1+pr))
D12*pr/(1pr^2)
D21D12
D230[Pa]
D320[Pa]
D130[Pa]
D310[Pa]
%train
exux
ev
ex0.5*(u+vx)
%tre
xD11*ex+D12*e+2*D13*ex
D21*ex+D22*e+2*D23*ex
xD31*ex+D32*e+2*D33*ex
%quation
x*tet(ux)x*tet(u)%XDirection
*tet(v)x*tet(vx)%YDirection

RenWenxiFeruar7,2015at6:49am
Lookforwardtoourrepl~

ChienLiuFeruar9,2015at10:37am
HiRen,
Thankouforcontactinguonthi.Inthicaewerecommendthat
oupleaecontactourupportteamforhelp.Thecanereachedat:
http://www.comol.com/upport
etregard,
Chien

Chien

tefanoMaffeiFeruar18,2015at5:38am
HiChien,
LetaIhaveatemofequation(inmcaeihaveaneigenvalue
prolem).ThenImultiplothequationtheircorrepondingtet
function(amvarialeareandc),integratepartandapplthe
oundarconditionIhave.ImagineafterallIamleftwithomething
like:
\int[weakformfor]dx=[lamda*tet()*x]_x1
\int[weakformforc]dx=[tet(c)*cx]_x1
wherelamdaitheeigenvalue(orrifthilookcomplicated,Ijut
thinkthatwithanexampleiettertotalkaoutthing).Imaginethat
omehowihavenoinformationaoutthederivativeinx0(aix1
everthingvanihe).
Mquetioni:theeoundartermhaveteretained,athemight
eimportantinadjutingtheehaviouroftheolutionnearx1.How
houldItreatthem?houldIputintheweakcontriutionunode
lamda*tet()*x+tet(c)*cx
appliedonx1?
Thank

ChienLiuFeruar18,2015at8:17am
Hitefano,
Thankouforcontactinguonthi.Inthicaewerecommendthat
oupleaecontactourupportteamforhelp.Thecanereachedat:
http://www.comol.com/upport
Thank!
Chien

PuZhangApril16,2015at11:54pm
Vernicelogpot!oithipoiilitofinpectingtemmatrixa
newfeatureinCOMOL5?

ChienLiuApril17,2015at11:01am
HelloPu,
Thankouforthecomment.Youwereproalreferringtothientr:
http://www.comol.com/log/implementingtheweakformwitha
comolapp/
Thepoiilitofinpectingthetemmatrixinotnew.Infactitha
eenavailaletouerfromtheeginning.
OfcouretheApplicationuilderiarandnewfeatureinCOMOL
5.0(andfurtherenhancedin5.1).Weelievetheuerproductivit
canegreatlimprovedCOMOLApp,aillutratedintheaove
logpot(andmanother).
Chien

ChienLiuApril17,2015at1:11pm
IntheprevioumeageIforgottoaddthelinktootherlogpoton
COMOLApp.Thecanefoundhere:
http://www.comol.com/log/categor/all/application/

jackhinemaJune18,2015at9:12pm
DearChienLiu,
VergladtolearnfromourlogonWeakformofcomolandita
vergoodlogpecifingonweakformthatmerelintroduced

detailedlanwhere.However,Iwonderthatwhthereia2order
differentialinintegrandutonl1timeintegralontheleftofequation
1.Iflikethi,thecalculatingreultoflefttermwouldeinadifferential
form,whichinotliketherightpolmial.

ChienLiuJune22,2015at11:47am
Hijackhine,
Thankouforthecomment.
ImnotureIundertandourquetionincethereinotimeintegralin
equation1.
Theintegrandhouldeinterpretedahavingparentheiafollow:
(dxT)(dxT_tet).
Hopethihelpclariftheequation.
Chien

Loginelowtoleaveacomment

Login

CreateNewCOMOLAcceAccount

mail*

Paword

Loginautomaticallnexttime
Login

ForgotourPaword?

You might also like