CEL教程Word文档下载推荐.docx

上传人:b****6 文档编号:16517936 上传时间:2022-11-24 格式:DOCX 页数:12 大小:36.41KB
下载 相关 举报
CEL教程Word文档下载推荐.docx_第1页
第1页 / 共12页
CEL教程Word文档下载推荐.docx_第2页
第2页 / 共12页
CEL教程Word文档下载推荐.docx_第3页
第3页 / 共12页
CEL教程Word文档下载推荐.docx_第4页
第4页 / 共12页
CEL教程Word文档下载推荐.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

CEL教程Word文档下载推荐.docx

《CEL教程Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《CEL教程Word文档下载推荐.docx(12页珍藏版)》请在冰豆网上搜索。

CEL教程Word文档下载推荐.docx

∙CELExamples

∙CELTechnicalDetails

Release13.0-©

2010SASIP,Inc.Allrightsreserved.

13.1. 

CELFundamentals

Thefollowingtopicswillbediscussed:

∙ValuesandExpressions

∙CFXExpressionLanguageStatements

13.1.1. 

ValuesandExpressions

CELcanbeusedtogeneratebothvaluesandexpressions.Valuesaredimensional(thatis,withunits)ordimensionlessconstants.Thesimplesttypeofdefinitionisthedimensionlessvalue,forexample:

b=3.743

Youcanalsospecifyavaluewithunits,forexample:

g=9.81[ms^-2]

ThedimensionsofthequantitiesofinterestforCFDcalculationscanbewrittenintermsofmass,length,time,temperatureandangle.Theconceptofunitsisfundamentaltothebehaviorofvaluesandexpressions.

Valuescanbeuseddirectly,ortheycanbeusedaspartofanexpression.Forexample,youcanuseanexpressiontoaddtwovaluestogether:

<

Expr_1>

Value_1>

Value_2>

Inthisexample,youmaywanttopredefine<

and<

butthisisnotrequired.However,inordertoaddtwoquantitiestogether,theymusthavethesamedimension;

thatis,itismeaningfultoaddaquantityininchestooneexpressedinmeters,butitisnotmeaningfultoaddoneexpressedinkilogramstooneinsquarefeet.

Expressionscanalsobefunctionsofother(predefined)expressions:

Expr_2>

Value_3>

UnitsfollowtheconventionsintherestofCFX,inthatacalculationhasasetofsolutionunits(bydefault,SIunits),andthatanyquantitycanbedefinedeitherintermsofthesolutionunits,oranyothersetofunitswiththecorrectform.

Anexpressiondoesnothaveitsownunitsstring,butifitreferencesquantitiesthathavedimensions,thesewilldeterminetheresultingunitsfortheexpression.Forexample,ifanexpressiondependsinverselyonthesquareofthex 

coordinate,thenithasimplieddimensionsoflengthtothepower-2.

13.1.1.1. 

UsingLocatorsinExpressions

ACFXsimulationhasphysicsareasandmeshareas;

physicsareasareboundarieswhilemeshareasareregions.Thesetwotypesofareacanoccupycompletelydifferentspacesinasimulation;

however,thereisnorequirementthatareanamesbeuniquebetweenphysicsandmesh.Thiscanleadtoambiguitieswhenyouusethesenamesinexpressions.

Toavoidtheseambiguities,ANSYSCFXfirstcheckstoseeif"

@<

locator>

"

isaphysicsname;

ifthisisnotfound,thenameischeckedinthelistofmeshnames.Thusif"

in1"

isboththenameofaphysicsareaandthenameofamesharea,"

istakentoindicatethephysicsarea.

ANSYSCFXalsohas@REGIONCELsyntaxsothatyoucanidentifyanamedareaasbeingamesharea.Thustoidentifythemeshareain1,youwouldusethesyntax:

@REGION:

in1

Notethatif<

doesnotappearasaphysicsnameorameshname,theexpressionfails.

13.1.2. 

CFXExpressionLanguageStatements

TheCFXExpressionLanguageisdeclarative.Youdeclarethenameanddefinitionoftheexpressionusingexpressionlanguagestatements.ThestatementsmustconformtoapredefinedsyntaxthatissimilartoFortranmathematicalstatementsandtoCstatementsforlogicalexpressions.

Thestatementmustconsistofthefollowing:

∙anumber,optionallywithassociatedunits.Thisdefinesaconstant.Constantswithoutunitsaretermeddimensionless.

∙formathematicalexpressions,oneormorereferencestomathematicalconstants,systemvariables,orexistinguservariables,separatedby+(addition),-(subtraction),* 

(multiplication),/(division)and^(exponentiation),withoptionalgroupingofthesebyparentheses.Thesyntaxrulesfortheseexpressionsarethesameasthoseforconventionalarithmetic.

∙forlogicalexpressionsinvolvingrelationaloperators,oneormorereferencestomathematicalconstantsorresultsfrommathematicalexpressions,separatedby<

=(islessthanorequalto),<

(islessthan),==(isequalto),!

=(isnotequalto),>

(isgreaterthan)and>

=(isgreaterthanorequalto)withoptionalgroupingofthesebyparentheses.

∙forlogicalexpressionsinvolvinglogicaloperators,oneormorereferencestologicalconstantsorresultsfromrelationaloperationsseparatedby!

(negation),&

&

(logicalAND)and||(logicalOR),withoptionalgroupingbyparentheses.

13.1.2.1. 

UseofConstants

Constantsdonotneedtobedefinedpriortobeingusedinanexpression.Forexample,youcouldchoosetoevaluatetheexpressionx+5[m].Or,youcoulddefineaconstant,b=5[m]andthencreateanexpressionx+b.

Thelogicalconstantsarefalseandtrue.Resultsoflogicalexpressionsareexpressedas0and1(correspondingtofalseandtrue,respectively).

Theuseofconstantsmaybeofbenefitingeneratingcomplicatedexpressionsorifyouhaveseveralexpressionsthatusethesameconstants.

13.1.2.2. 

ExpressionSyntax

Allnumbersaretreatedasrealnumbers.

Theprecedenceofmathematicaloperatorsisasfollows(fromhighesttolowest):

∙Thepoweroperator^asinx^y.

∙Theunaryminusornegationoperator-asin-x.

∙Multiplicationanddivisionasinx*y/z.

∙Additionandsubtractionasinx+y-z.

Pleasenotethat,asofANSYSCFX10.0,theprecedenceofmathematicaloperatorshasbeenmadeconsistentwithstandardprogramminglanguagessuchasFortranandC.Therefore,thepoweroperator,whichpreviouslyhadlowerprecedencethanunaryminus,nowhasthehighestprecedence.

Theprecedenceoflogicalandrelationaloperatorsisasfollows(fromhighesttolowest):

∙Thenegationoperator!

asin!

x.

∙Therelationaloperatorsinvolvinglessthanorgreaterthan(<

=,<

>

and>

=)asinx>

=y.

∙Therelationaloperatorisequaltoandisnotequalto(==and!

=)asinx!

∙ThelogicalANDoperator(&

)asinx&

y.

∙ThelogicalORoperator(||)asinx||y.

13.1.2.3. 

Multiple-LineExpressions

Itisoftenuseful,particularlywithcomplexexpressions,tousemorethanonelinewhencreatingyourexpression.CFXallowsyoutousemultiplelinestogenerateanexpression,providedeachlineisseparatedbyanappropriateoperator.

Forexample,youmayhaveanequation,A+B/C,thatconsistsofthreecomplexterms,A,B,andC.Inthiscase,youcouldusethreelinestosimplifycreatingtheexpression:

A+

B

/C

Notethattheoperatormaybeusedattheendofaline(A+)oratthebeginningofaline(/C).Youdonotneedtoentertheoperatortwice.

Oncetheexpressionhasbeencreated,itwillappearintheExistingDefinitionslistboxasifitweregeneratedonasingleline(A+B/C).

13.2. 

CELOperators,Constants,andExpressions

Thefollowingtopicsarediscussed:

∙CELOperators

∙ConditionalifStatement

∙CELConstants

∙UsingExpressions

13.2.1. 

CELOperators

CFXprovidesarangeofmathematical,logicalandoperationaloperatorsasbuilt-infunctionstohelpyoucreatecomplexexpressionsusingtheExpressiondetailsview.

Table 

13.1 

Operator

FirstOperand’sDimensions[x]

SecondOperand’sDimensions[y]

Operands’Values(Approx)

Result’sDimensions

-x

Any

[x]

x+y

Any

x-y

x*y

[x]*[y]

x/y

[x]/[y]

x^y(ifyisasimple,constant,integerexpression)

Dimensionless

Any[a]

[x]^y

x^y(ifyisanysimple,constant,expression)

x>

0

x^y(ifyisnotsimple&

constant)

!

x

0or1

x<

=y

y

x==y

x!

x&

x||y

[a]Fory<

0,xmustbenon-zero.

13.2.2. 

ConditionalifStatement

CELsupportstheconditionalifstatementusingthefollowingsyntax:

if(cond_expr,true_expr,false_expr)

where:

∙cond_expr:

isthelogicalexpressionusedastheconditionaltest

∙true_expr:

isthemathematicalexpressionusedtodeterminetheresultiftheconditionaltestistrue.

∙false_expr:

isthemathematicalexpressionusedtodeterminetheresultiftheconditionaltestisfalse.

Note:

Theexpressionstrue_exprandfalse_exprarealwaysevaluatedindependentofwhethertheevaluationofcond_expristrueorfalse.Asaconsequence,aconditionalstate

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 工作计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1