示例#1
0
def _replace_dict_time_dependent_expression(time_dep_expressions, time, dt, c):
    assert (isinstance(c, float))
    replace_dict = {}
    if c == 0.0 or not time_dep_expressions:
        return replace_dict
    new_time = Expression("time+c*dt", time=time, c=c, dt=dt)
    for expr, c_names in time_dep_expressions.items():
        assert (isinstance(expr, Expression))
        kwargs = dict(name=expr.name(), label=expr.label(), \
                      element=expr.ufl_element(), **expr.user_parameters)
        for c_name in c_names:
            kwargs[c_name] = new_time
        replace_dict[expr] = Expression(expr.cppcode, **kwargs)

    return replace_dict
for n in range(geo._nDim):
    for s in psiString:
        vecS = []

        for i in range(n):
            vecS.append("0.0")
        #print(vecS)

        vecS.append(s)
        #print(vecS)

        for i in range(geo._nDim - n - 1):
            vecS.append("0.0")

        print(vecS)
        psiBasis.append(Expression(vecS, degree=2))
        #Expression(vecS, degree=2)

# psiBasis = (
# 	Expression(("1.","0.","0."), degree=2),
# 	Expression(("0.","1.","0."), degree=2),
# 	Expression(("0.","0.","1."), degree=2),
# 	Expression(("-x[1]","x[0]","0."), degree=2),
# 	Expression(("-x[2]","0.","x[0]"), degree=2),
# 	Expression(("0.","-x[2]","x[1]"), degree=2)
# )

###
### Variational scheme
###