Hi Martin,
The old values don't appear to be being updated. Is that correct? Don't you
need
~~~~
...
while t < t_tot:
c_b.updateOld()
c_f.updateOld()
q_b.updateOld()
# Solve iteratively with sweep
while (residual > max_residual_nonlin) & (n_iter_nonlin <
n_max_allowed_iter):
...
~~~~
Also, you can use an adaptive time step that changes based on whether the
non-linear tolerance is achieved for the given step.
Cheers,
Daniel
On Fri, Aug 5, 2016 at 9:46 AM, Korevaar, Martin <
[email protected]> wrote:
> Dear mailinglist,
>
>
>
> I am trying to solve a convection problem where the convected substance is
> adsorbed (on active carbon in this case). It is modeled as follows: the
> fluid is divided in a bulk part and in a film layer part; that is the film
> layer surrounding the adsorbing medium (active carbon). To the
> concentration in the bulk applies a convective equation with a sink for the
> part of the solute that is diffusing into the film layer; the sink depends
> on the difference between film and bulk concentration. The film layer thus
> receives the solute from the bulk and loses it to the adsorbing medium and
> is therefore modeled as an equation with only a sink and a source; the
> source depends on the concentration difference between bulk and film, the
> sink depends on the ‘concentration’ difference between the surface and the
> center of active carbon grains. Finally, I also modeled the diffusion of
> the solute from the surface of the active carbon to its center; this source
> term depends on the difference between solution at the surface and center
> of the grain.
>
>
>
> c_b: bulk concentration
>
> c_f: film concentration
>
> q_s: concentration at the surface of the grain (this is not really a
> concentration, but the amount of adsorbed material per amount of adsorbing
> material (active carbon)
>
> q_b: the concentration in the center of the grain
>
>
>
> This then yields the following equations:
>
> dc_b/dt = v dc_b/dx – A1(c_b – c_f)
>
> dc_f/dt = A2 (c_b – c_f) – A3(q_s – q_b)
>
> dq_s/dt = A4(q_s – q_b)
>
>
>
> here A1, A2, A3 and A4 are some mass transfer constants. Furthermore, q_s
> relates to c_f by the Freundlich equation:
>
> q_s = K_Fr * c_f ^n_Fr
>
>
>
> where K_Fr and n_Fr are the (Freundlich) constants. Implementation is
> attached as minimal working example.
>
>
>
> My problem is that this only converges at very small timesteps, that is of
> order of seconds, while I need to simulate order of years. I need larger
> timesteps, but I do not know how to improve this further. The changes in
> time are not so large, so it should be possible. Apparently this is some
> tricky numerical issue. I tried all the different solvers in FiPy and it
> seemed that the most stable solution occurs using LinearLUSolver with zero
> gradient outlet boundary condition at the outlet. I linearized the
> non-linear isotherm which increased my allowed timestep from milliseconds
> to seconds. Can you help me improve my simulation speed? I hope you have
> sufficient information with the implementation and value of the constants
> as attached and given below. If not, please let me know.
>
>
>
> Value for the constants:
>
>
>
> A1 = 0.36
>
> A2 = 0.48
>
> A3 = 0.0148
>
> A4 = 1.e-8
>
> v = 1.6e-3 # m/s
>
> K_Fr = 386
>
> N_Fr = 0.33
>
> Best regards,
>
> M.W. (Martin) Korevaar, MSc
> Scientific researcher - Drinking Water Treatment *|* KWR Watercycle
> Research Institute *|* Groningenhaven 7, P.O. Box 1072, 3430 BB
> Nieuwegein, the Netherlands [image:
> http://www.kwrwater.nl/uploadedImages/mail/gmaps.png]
> <https://maps.google.nl/maps?q=Groningenhaven+7,+3433+PE+Nieuwegein&hl=nl&sll=52.212992,5.27937&sspn=4.678847,13.392334&t=m&hnear=Groningenhaven+7,+3433+PE+Nieuwegein,+Utrecht&z=16>
> *| T* +31 30 606 9515 *| M *+31 6 11648156 *| E*
> [email protected] *| W* www.kwrwater.nl* |* Follow KWR on [image:
> http://www.kwrwater.nl/uploadedImages/mail/twitter.png]
> <http://www.twitter.com/kwr_water>*| *Follow me on [image:
> http://www.kwrwater.nl/uploadedImages/mail/linkedin.png]
> <https://nl.linkedin.com/in/martinkorevaar> *|* Chamber of
> Commerce Utrecht e.o. 27279653.
>
> The KWR office building <http://www.kwrwater.nl/BNA_Gebouw_van_het_Jaar/>
> has won the 'Most Stimulating Environment' award of the Royal Institute of
> Dutch Architects.
>
>
>
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
--
Daniel Wheeler
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]