Closed ghost closed 6 years ago
Time dependent = > TimeFunction
Sapce depedent only = > Function
Then for the derivatives, you can use the shortcuts for the object, or the general function generic_derivative
for the derivative of anything (e.g generic_derivative(phi * rho*S, order=1, dim=t, fd_order=1)
and so on for the rest.
Does this answer the question? Can we close this issue @L4student ?
Dear @FabioLuporini : The syntax shown by @mloubout are certainly helpful, but I still have questions related to this issue that I was going to follow-up once I tried something concrete. Specifically, I was searching for the syntax of divergence
and it seems like it used to be present, but it was removed later...in current version, I didn't see any syntax for divergence
. It would be helpful to have one example that extends the use of devito to solving conservation equation of fluids. Thanks.
@FabioLuporini @mloubout I may not be able to write down this equation correctly in devito's syntax, so if you wish to close this issue then you can. It will help if you can provide some example/documentation that explains how to write the above equation.
divergence
is only the sum of the first derivatives
div = sum([generic_derivative(expr, order=1, dim=d, fd_order=fd_order) for d in grid.dimensions])
There is nothing in this equation that should be a problem, we unfortunately cannot provide an example for all possible PDEs.
any updates @L4student ?
@FabioLuporini Thanks for your note. I didn't work on this further than I wanted to as I didn't have sufficient time to experiment. I assume you want to close this issue, so I would do that.
I am interested in using devito to solve PDEs for multiphase fluid flow, specifically mass, momentum, and energy. I started with conservation of mass, but I am having difficulty in understanding how to describe the first PDE, shown below, using devito's syntax if there are multiple variables varying with time and space.
I went through devito tutorials (CFD and seismic), which were helpful, but the conservation equations I am trying to solve (mass, momentum, energy) present a hurdle in terms of defining them symbolically. The PDE shown above is a conservation of mass for gas in presence of other fluids, and besides the main variable ($\rho_l$) that defines this PDE, there are other variables that are varying in space and time. In this equation, I know $u_lD$, $\phi$, $S_l$ that are varying in space and time, but I am not sure how to keep them as variables along with the main variable ($\rho_l$) that is obtained by this PDE. These other variables ($u_lD$, $\phi$, $S_l$) are not described by any PDE, but they are either known to vary randomly in space or have some analytical expression containing terms that vary in space and time. In short, I know their estimates through some other means.
I have been stuck on describing this equation symbolically for several hours, and I didn't find any help in tutorials or elsewhere.