Dear FiPy developers,

I am trying to solve a diffusion PDE with a non-linear diffusion term in a 
domain that contains 2 subdomains. Those subdomains are not specified in the 
mesh, i.e., the mesh treats everything as a single domain. I want to achieve 
diffusivity = 0 between the faces of one of the subdomains. In other words, I 
am trying to mask the diffusivity FaceVariable so that some faces (given, for 
instance, by the values of a fp.FaceVariable) are identically 0.

My approach so far is the following:

eq = fp.TransientTerm() == fp.DiffusionTerm(coeff=compute_diffusivity(phi))

And compute_diffusivity is given by:

def compute_diffusivity(phi):
    diff = fp.numerix.sqrt(2.0*phi) / fp.numerix.exp(4.0*phi**2)
    diff_face = fp.FaceVariable(mesh=mesh, value=diff.arithmeticFaceValue.value)

    # Create mask of subdomain, all ones except zeros where needed
    mask_face = fp.FaceVariable(...)

    # Apply mask to diffusivity and return.
    # Multiplication works because the target value at the mask is zero.
    return fp.FaceVariable(mesh=mesh, value=diff_face.value * mask_face.value)

FiPy does solve the problem, but I am worried that it does not understand that 
the diffusion variable is non-linear. I suspect that the problem is that the 
.value method used to construct the FaceVariable is determining its value 
directly, without the lazy evaluation of phi.

How can I solve this problem? What is the best way to set such a mask in FiPy?

Another approach might be to define the subdomains within the mesh (using Gmsh 
'physical groups', perhaps?) and then reading and using it in FiPy. However, I 
don't know how to do either of those things. (Extra info: I need my code to be 
useful both with meshes created within FiPy and  by Gmsh).

I would really appreciate your help. Thank you in advance!

IƱaki

-- 
To unsubscribe from this group, send email to [email protected]

View this message at https://list.nist.gov/fipy
--- 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

Reply via email to