Okay, it seems that the constants section is not passed to the negdivconf kernel. In other pointwise kernels the approach would work as it is.

Now you need to add the following line to baseadvec/elements.py to pass the constants to the template:

@@ -45,6 +45,8 @@ class BaseAdvectionElements(BaseElements):
             'srcex': self._src_exprs
         }

+ srctplargs = {**srctplargs, **dict(c=self.cfg.items_as('constants', float))}
+
         # Interpolation from elemental points

You could also bind another dictionary for ints:

srctplargs = {**srctplargs, **dict(c=self.cfg.items_as('constants', float)), **dict(d=self.cfg.items_as('intconstants', int))}

where the integer constants are read from an .ini file section intconstants.

Niki


On 01/12/17 09:54, Will wrote:
Dear Niki,

I am actually a rookie of mako python language. I tried add ${c['nu']} to the baseadvec kernel to test whether constant variables in .ini file can be quoted. It looks like:

% for i, ex in enumerate(srcex):
    tdivtconf[${i}] = -rcpdjac*tdivtconf[${i}] + ${ex};
% endfor
tdivtconf[1] = tdivtconf[1] - 4.0*${c['nu']};

When to run, the error showed again "'Undefined' object is not subscriptable". It seems that the kernel file cannot quote variables in 'constants' dict. There is "c=self.cfg.items_as(' constants', float)" in base folder and I tried to import base folder to baseadvec, but nothing helped.

I dont understand why the constants cannot be quoted by baseadvec kernel. Is there anyway to solve it?

Best regards,
Will
--
You received this message because you are subscribed to the Google Groups "PyFR Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/pyfrmailinglist.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PyFR 
Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
Visit this group at https://groups.google.com/group/pyfrmailinglist.
For more options, visit https://groups.google.com/d/optout.

Reply via email to