@@ -8732,7 +8732,7 @@ end propagateModFinal;
87328732// ------ PDE extension: ------
87338733// ------------------------------
87348734
8735- public type DomainFieldsLst = List < tuple< DAE . ComponentRef ,List < Absyn . ComponentRef >>>;
8735+ public type DomainFieldsLst = list < tuple< DAE . ComponentRef ,list < Absyn . ComponentRef >>>;
87368736
87378737public function elabField
87388738// For field variables: finds the "domain" modifier,
@@ -8834,14 +8834,14 @@ protected function findN
88348834"a map function to find N in domain class modifiers"
88358835 input DAE . Var inVar;
88368836 output Option < Integer > optN;
8837- algorithm
8838- optN := match inVar
8837+ algorithm
8838+ optN := match inVar
88398839 local
88408840 Integer N ;
8841- case DAE . TYPES_VAR (name= "N" ,binding= DAE . Binding . EQBOUND (evaluatedExp= SOME (Values . INTEGER (N ))))
8842- then SOME (N );
8843- else NONE ();
8844- end match;
8841+ case DAE . TYPES_VAR (name= "N" ,binding= DAE . EQBOUND (evaluatedExp= SOME (Values . INTEGER (N ))))
8842+ then SOME (N );
8843+ else NONE ();
8844+ end match;
88458845end findN;
88468846
88478847protected function addEach
@@ -8923,84 +8923,84 @@ public function discretizePDE
89238923 output List < SCode . Equation > outDiscretizedEQs;
89248924 protected List < SCode . Equation > newDiscretizedEQs;
89258925algorithm
8926- newDiscretizedEQs := {inEQ};
8927- // TODO: fix:
8928-
8929- newDiscretizedEQs := matchcontinue inEQ
8930- local
8931- Absyn . Exp lhs_exp, rhs_exp;
8932- Absyn . ComponentRef domainCr, domainCr1, fieldCr;
8933- SCode . Comment comment;
8934- SCode . SourceInfo info;
8935- Integer N ;
8936- List < Absyn . ComponentRef > fieldLst;
8937- Absyn . Ident name;
8938- list< Absyn . Subscript > subscripts;
8939- // Normal equation withhout domain specified, no field variables present:
8940- case SCode . EQUATION (SCode . EQ_EQUALS ())
8941- then {inEQ};
8942- // PDE with domain specified, allow for field variables:
8943- case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8944- domain = domainCr as Absyn . CREF_IDENT (), comment = comment, info = info))
8945- equation
8946- (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr,info);
8947- // then list(newEQFun(i, lhs_exp, rhs_exp, domainCr, comment, info, fieldLst) for i in 2:N-1);
8948- then creatFieldEqs(lhs_exp, rhs_exp, domainCr, N , comment, info, fieldLst);
8949- // same as previous but with ".interior"
8950- case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8951- domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "interior" )),
8952- comment = comment, info = info))
8953- equation
8954- domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8955- (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8956- // then list(newEQFun(i, lhs_exp, rhs_exp, domainCr1, comment, info, fieldLst) for i in 2:N-1);
8957- then creatFieldEqs(lhs_exp, rhs_exp, domainCr, N , comment, info, fieldLst);
8958-
8959- // left boundary extrapolation
8960- case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8961- domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "left" )),
8962- comment = comment, info = info))
8963- equation
8964- // Absyn.CALL(function_ = Absyn.CREF_IDENT(name="extrapolateField", subscripts={}), functionArgs = Absyn.FUNCTIONARGS(args = {})) = rhs_exp;
8965- // Absyn.CREF(fieldCr as Absyn.CREF_IDENT()) = lhs_exp;
8926+ newDiscretizedEQs := {inEQ};
8927+ // TODO: fix:
8928+
8929+ newDiscretizedEQs := matchcontinue inEQ
8930+ local
8931+ Absyn . Exp lhs_exp, rhs_exp;
8932+ Absyn . ComponentRef domainCr, domainCr1, fieldCr;
8933+ SCode . Comment comment;
8934+ SCode . SourceInfo info;
8935+ Integer N ;
8936+ List < Absyn . ComponentRef > fieldLst;
8937+ Absyn . Ident name;
8938+ list< Absyn . Subscript > subscripts;
8939+ // Normal equation withhout domain specified, no field variables present:
8940+ case SCode . EQUATION (SCode . EQ_EQUALS ())
8941+ then {inEQ};
8942+ // PDE with domain specified, allow for field variables:
8943+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8944+ domain = domainCr as Absyn . CREF_IDENT (), comment = comment, info = info))
8945+ equation
8946+ (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr,info);
8947+ // then list(newEQFun(i, lhs_exp, rhs_exp, domainCr, comment, info, fieldLst) for i in 2:N-1);
8948+ then creatFieldEqs(lhs_exp, rhs_exp, domainCr, N , comment, info, fieldLst);
8949+ // same as previous but with ".interior"
8950+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8951+ domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "interior" )),
8952+ comment = comment, info = info))
8953+ equation
8954+ domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8955+ (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8956+ // then list(newEQFun(i, lhs_exp, rhs_exp, domainCr1, comment, info, fieldLst) for i in 2:N-1);
8957+ then creatFieldEqs(lhs_exp, rhs_exp, domainCr, N , comment, info, fieldLst);
8958+
8959+ // left boundary extrapolation
8960+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8961+ domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "left" )),
8962+ comment = comment, info = info))
8963+ equation
8964+ // Absyn.CALL(function_ = Absyn.CREF_IDENT(name="extrapolateField", subscripts={}), functionArgs = Absyn.FUNCTIONARGS(args = {})) = rhs_exp;
8965+ // Absyn.CREF(fieldCr as Absyn.CREF_IDENT()) = lhs_exp;
89668966 fieldCr = matchExtrapAndField(lhs_exp, rhs_exp);
8967- domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8968- (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8969- then
8967+ domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8968+ (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8969+ then
89708970 {extrapolateFieldEq(false , fieldCr, domainCr1, N , comment, info, fieldLst)};
89718971
8972- // right boundary extrapolation
8973- case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8974- domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "right" )),
8975- comment = comment, info = info))
8976- equation
8977- // Absyn.CALL(function_ = Absyn.CREF_IDENT(name="extrapolateField", subscripts={}), functionArgs = Absyn.FUNCTIONARGS(args = {})) = rhs_exp;
8978- // Absyn.CREF(fieldCr as Absyn.CREF_IDENT()) = lhs_exp;
8972+ // right boundary extrapolation
8973+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8974+ domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "right" )),
8975+ comment = comment, info = info))
8976+ equation
8977+ // Absyn.CALL(function_ = Absyn.CREF_IDENT(name="extrapolateField", subscripts={}), functionArgs = Absyn.FUNCTIONARGS(args = {})) = rhs_exp;
8978+ // Absyn.CREF(fieldCr as Absyn.CREF_IDENT()) = lhs_exp;
89798979 fieldCr = matchExtrapAndField(lhs_exp, rhs_exp);
8980- domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8981- (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8982- then
8980+ domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8981+ (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8982+ then
89838983 {extrapolateFieldEq(true , fieldCr, domainCr1, N , comment, info, fieldLst)};
8984- // left boundary condition
8985- case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8986- domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "left" )),
8987- comment = comment, info = info))
8988- equation
8989- domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8990- (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8991- then
8992- {newEQFun(1 , lhs_exp, rhs_exp, domainCr1, comment, info, fieldLst)};
8984+ // left boundary condition
8985+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8986+ domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "left" )),
8987+ comment = comment, info = info))
8988+ equation
8989+ domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8990+ (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
8991+ then
8992+ {newEQFun(1 , lhs_exp, rhs_exp, domainCr1, comment, info, fieldLst)};
89938993 // right boundary condition
8994- case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8995- domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "right" )),
8996- comment = comment, info = info))
8997- equation
8998- domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8999- (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
9000- then
9001- {newEQFun(N , lhs_exp, rhs_exp, domainCr1, comment, info, fieldLst)};
9002-
9003- end matchcontinue;
8994+ case SCode . EQUATION (SCode . EQ_PDE (expLeft = lhs_exp, expRight = rhs_exp,
8995+ domain = domainCr as Absyn . CREF_QUAL (name, subscripts, Absyn . CREF_IDENT (name= "right" )),
8996+ comment = comment, info = info))
8997+ equation
8998+ domainCr1 = Absyn . CREF_IDENT (name, subscripts);
8999+ (N ,fieldLst) = getDomNFields(inDomFieldLst,domainCr1,info);
9000+ then
9001+ {newEQFun(N , lhs_exp, rhs_exp, domainCr1, comment, info, fieldLst)};
9002+
9003+ end matchcontinue;
90049004
90059005 outDiscretizedEQs := listAppend(inDiscretizedEQs, newDiscretizedEQs);
90069006end discretizePDE;
0 commit comments