### How to manage discontinuous coefficients

342
views
0
10 months ago by
Dear all,
I am trying to solve this coupled nonlinear problem that simulates the drying of a porous structure.

I discretized in time by a forward difference. However I am in doubt of how to define A1, A2, A3 and A4 as these coefficients depend on the derivative of a state equation that depends both on P and T. This function is the sorption isotherm given by the graph on the right:

In the literature it is defined by a piecewise function depending on the value of P. I am in doubt because this work was initially manually made and these coefficients were approximated by finite differences and etc. So I think I could use some of FEniCS features to improve this. Maybe interpolating this function on a 2D functionspace and or even making use of automatic differentiation for these coefficients (which I think would require some tweaks on the sorption isotherm function as its derivative is probably discontinuous judging from this graph).
I am still new to numerical methods and any tip, idea or reference would be of great value!
Thank you very much!
If anyone needs/wants the code I can update the question. I did not put because it is a more conceptual question.

Update:
The sorption isotherm, the function W(T,P), is given by the following equation:

The problem for me is to put all this consitionals in a way that works properly.
I tried to differentiate W using simple forward differences.

Just to update I also was able to manually solve this using a predictor corrector scheme but I still wanted to use FEniCS to expand my 1D model to different 3D, and etc.

I will also try to work on a MWE if possible.

All the best, Murilo.

Community: FEniCS Project
Could you include the expression for A1, A2, A3 and A4? It is not clear to me whether they are explicit expressions of P and T or they need to be solved in a differential equation.
written 9 months ago by Miguel
This is a complicated thing you are describing.  Consider reducing the size of your problem to one that is easily digestible to the community.

I gather that your problem is that you do not know how to calculate the derivative of "W" --- whatever that is --- with respect to "T" and "P" because they are the unknowns of the system.

Is it possible that an expression for "W" exists that makes this relationship clear?  You have plotted the data on the right so obviously, $W = W(T, P)$ is known to you.  Once you have this piece, the derivatives you list below are easy to calculate directly, even if they are discontinuous.

Now, because you say that A1, ... , A4 are discontinuous, you can use the FEniCS "conditional" to define the discontinuities.

written 9 months ago by pf4d
written 9 months ago by pf4d
Dear pf4d, sorry for disappearing so abruptly.
I am a little bit short on time so I was not able to give full attention to this problem.
And yeah, W(T,P) is a known function, the interpretation is that W(T,P) is the sorption isotherm which depicts how much of the water molecules will be sorpted on the walls of the porosity and how much will be free as gas. I will update the question to add the definition of it.

written 9 months ago by Murilo Moreira
ok, i see that you have some coefficients that are highly non-linear and generally just a pain to work with.

all you have to do is:

1. compute the partial derivatives of $W$, like the math you posted informs us, for each range of values of $h$.

2. at each intermediate temporal solution of your pde, calculate each coefficient $A_i$ at each node using the partial derivatives you have computed in step one, then re-solve the equation at the current timestep until your solution converges.  this is called "fixed-point iteration".

3. iterate the timestep and continue again from step one.
written 9 months ago by pf4d

0
9 months ago by
or sure! Here are the coefficients

Just to render the equations I am "answering"

$\\ A_1 = \frac{\partial W}{\partial P} \\ \\ A_2 = -C_a \frac{\partial W}{\partial P} \\ \\ A_3 = \frac{\partial W}{\partial T} \\ \\ A_4 = \rho C_p - C_a \frac{\partial W}{\partial T}$

C_a is the evaporation heat of water, C_p is the heat capacity at constant pressure and rho is the density.

Thank you for your interest Miguel.

All the best, Murilo.

For anybody interested the paper I am trying to reproduce is the following one:

Development of Drying Schedules for One-Side-Heating Drying of Refractory Concrete Slabs Based on a Finite Element Model
you can put math in comments,
$f \left( see_{just_{like_{this}}} \right) = \int_{\varOmega} \exp\left( math^{42} \right) \mathrm{d}\varOmega \equiv \mathrm{TOTALLY_{RAD}, RIGHT?!}$
written 9 months ago by pf4d
Dear pf4d,
Thank you for the tip!
written 9 months ago by Murilo Moreira