Skip to content

Several questions on defining (anisotropic, non-linear, ...) Coefficients #1090

Answered by guyer
cgadal asked this question in Q&A
Discussion options

You must be logged in to vote

This leads to excellent results.

Yay!

However, defining the entire first ConvectionTerm coefficient outside as:

segcoeff = CellVariable(name="F", mesh=mesh, rank=1)
segcoeff[0, :] = 0
segcoeff[1, :] = F* (1 - phi)  # <------------- Here

# ###### define equation
eq = TransientTerm(var=phi) + VanLeerConvectionTerm(coeff=segcoeff , var=phi) + VanLeerConvectionTerm(
    coeff=velocity, var=phi
) == DiffusionTerm(coeff=diffcoeff, var=phi)

induces completely different (and wrong) results.

  1. Why is that?

When you write

segcoeff[1, :] = F* (1 - phi)

you are assigning the instantaneous value of that expression to segcoeff[1, :]; it won't update as phi changes.

  1. I am moving towards complex no…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@guyer
Comment options

Answer selected by cgadal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants