SummaryofBuilt-InVariablesWithReservedNamesThissectionisanoverviewofthebuilt-inelementsofthefollowingcategoriesasdefinedbytheunderlyingCOMSOLlanguage:?Constants?Variables?FunctionsTheselanguageelementsarebuilt-inoruser-defined.Inadditionthereaoperatorsthatcannotbeuser-defined,andexpressions,whicharealwaysuser-defined.具有保留名称的内置变量摘要本节概述了由基础COMSOL语言定义的以下类别的内置元素:这些语言元素是内置的或用户定义的止匕外,还有不能由用户定义的运算符,以及始终由用户定义的表达式ABOUTRESERVEDNAMES关于预留名称Built-invariableshavereservedname,snamesthatcannotberedefinedbytheuser.Itisnotrecommendedtouseareservedvariablenameforauser-definedvariable,parameter,orfunction.Forsomeofthemostcommonreservedvariablenames,suchaspi,i,andj,thetextwhereyouenterthenameturnsorangeandyougetatooltipmessageifyouselectthetextstring.Reservedfunctionnamesarereservedonlyforfunctionnames,whichmeansthatsuchnamescanbeusedforvariableandparameternames,andviceversa.Thefollowingtableslistmostbuilt-inelementsandhencethosereservednames.内置变量具有保留名称,用户无法重新定义。
不建议对用户定义的变量,参数或函数使用保留的变量名对于一些最常见的保留变量名称,例如pi,i和j,输入名称变为橙色,如果选择文本字符串,则会得到工具提示消息保留的函数名称仅作为函数名保留,这意味着此类名称可用于变量和参数名称,反之亦然下表列出了大多数内置元素,因此列出了这些保留名称CONSTANTSANDPARAMETERS常量和参数Therearethreedifferenttypesofconstants:built-inmathematicalandnumericalconstants,built-inphysicalconstants,andparameters.Parametersareuser-definedconstantsthatcanvaryoverparametersweeps.Constantsarescalarvalued.Thefollowingtableliststhebuilt-inphysicalconstants.Constantsandparameterscanhaveunits.有三种不同类型的常数:内置的数学和数值常数,内置的物理常数和参数境数是用户定义的常量,可以随参数扫描而变化。
常量是标量值下表列出了内置物理常量常量和参数可以有单位BUILT-INPHYSICALCONSTANTS内置物理常数TABLE5-12:BUILT-INPHYSICALCONSTANTSNAMEDESCRIPTION描述g_constAccelerationofgravityN_A_constAvogadroconstantk_B_constBoltzmannconstantZ0_constCharacteristicimpedanceofvacuum(impedanceoffreespace)真空的特性阻抗(自由空间的阻抗)me_constElectronmass电子质量e_constElementarycharge元电荷F_constFaradayconstan林拉第常数alpha_constFine-structureconstan界青细结构常数G_constGravitationalconstant方有引力常量V_m_constMolarvolumeofidealgas(at273.15Kand1atm)理想气体的摩尔体积(在273.15K和1atm下)mn_constNeutronmass中子质量mu0_constPermeabilityofvacuum(magneticconstant)真空的磁导率(磁常数)epsilon0_constPermittivityofvacuum(electricconstant)真空介电常数(电常数)h_constPlancksconst酹朗克常数hbar_constPlancksconstantover缈过2pi的普朗克常数mp_constProtonmass质子质量c_constSpeedoflightinvacuum真空中的光速sigma_constStefan-Boltzmannconstant斯伯分一玻R_constUniversalgasconstant®用气体常数b_constWiendisplacementlawconstan潍恩位移常数BUILT-INMATHEMATICALFUNCTIONS内置数学函数Thesefunctionsdonothaveunitsfortheirinputoroutputargument这些函数没有用于其输入或输出参数的单位。
TABLE5-13:BUILT-INMATHEMATICALFUNCTIONSNAMEDESCRIPTIONabsAbsolutevalue绝对值acosInversecosine(inradians)^余弦(以弧度表小)acoshInversehyperboliccosine反双曲余弦acotInversecotangent(inradians)^余切(单位为弧度)acothInversehyperboliccotangent®双曲余切acscInversecosecant(inradians)!余弦(以弧度表小)acschInversehyperboliccosecant5双曲余割argPhaseangle(inradiansB位角(以弧度表小)asecInversesecant(inradian亚正切(以弧度表小)asechInversehyperbolicsecant5双曲正割asinInversesine(inradians反正弦(以弧度表小)asinhInversehyperbolicsine反双曲正弦atanInversetangent(inradians)^正切(弧度)atan2Four-quadrantinversetangent(inradians)l象限反正切(以弧度表示)atanhInversehyperbolictangent反双曲正切besseljBesselfunctionofthefirstkind第一类贝塞尔函数besselyBesselfunctionofthesecondkind第二类贝塞尔函数besseliModifiedBesselfunctionofthefirstkind第一类修改的贝塞尔函数besselkModifiedBesselfunctionofthesecondkind第二类修改的贝塞尔函数ceilNearestfollowingintegerconjComplexconjugate复共腕cosCosine余弦coshHyperboliccosine双曲余弦cotCotangent余切cothHyperboliccotangent双曲余切cscCosecant余割cschHyperboliccosecant双曲余割erfErrorfunction误差函数expExponential指数floorNearestpreviousintegergammaGammafunction伽马函数imagImaginarypart虚部logNaturallogarithm自然对数10g10Base-10logarithmlog2Base-2logarithmmaxMaximumoftwoargumentsminMinimumoftwoargumentsmodModulooperator模运算符psiPsifunctionanditsderivatives巾函数及其导数rangeCreatearangeofnumber电」建——个数字范围realRealpart实部roundRoundtoclosestintegerBI舍五入为最接近的整数secSecant割线sechHyperbolicsecant双曲正割signSignumfunction符号函数sinSine正弦sinhHyperbolicsine双曲正弦sqrtSquareroot平力根tanTangent双曲正切tanhHyperbolictangentThefollowingtablesummarizesthebuilt-invariablesandconstantsthataregenerallyavailableinallCOMSOLmodels.Someareonlyavailableincertaingeometriesorintime-dependentmodels,forexample.Thesevariablenamesarereservednamesandappearinorangeintheettingswindowsforparametersandvariables.下表总结了通常在所有COMSOL模型中用到的内置变量和常量。
例如,一些仅在某些几何形状或在瞬态模型中可用这些变量名称是保留的名称,在参数和变量的设置窗口中显示为橙色TABLE5-14:BUILT-INVARIABLESANDCONSTANTSNAMEDESCRIPTIONTYPEtTime.时间Scalar机电freqFrequency频率ScalarlambdaEigenvalues特征值ScalarphasePhaseangle.目位角ScalarnumberofdofsNumberofdegreesoffreedom自由度数Scalarx,y,z,r,X,Y,Z,RPosition.位置Field域s,s1,s2Edge/surfaceparameter边/面参数Fieldn,nx,ny,nz,nrEdge/surfacenormals4/。