# Discussion Forum

## Logarithmic transform in a time dependent diffusion equation

RSS feed   |   Turn on email notifications   |   3 Replies   Last post: March 31, 2011 2:02pm UTC

Melissa Rice

January 24, 2011 4:21am UTC

Logarithmic transform in a time dependent diffusion equation

Hi all

I have been trying to avoid negative concentration by incorporating logarithmic transform of concentration. The knowledge base tells us how to do this in a stationary problem ( www.comsol.com/support/knowledgebase/952/ ). However when there is a time dependent equation, the term dc/dt in the log transformed state becomes exp(C) dC/dt, where C=log(c) . How do i incorporate exp(C) as the coefficient to dc/dt. I tried using general form pde and input the coefficient of dC/dt as exp(C), but it says failed to find consistent initial values. Is there a way around this or a better way to incorporate log transform?

Thanks

Melissa Rice

January 24, 2011 4:35am UTC in response to Melissa Rice

Re: Logarithmic transform in a time dependent diffusion equation

I realized the problem is more specific. When I have a zero initial condition, because in the log coordinate log(0) would be infinite i define the initial condition as C=log(eps). When i give a non zero value say log(10) it works fine.

Ivar Kjelberg

January 24, 2011 6:21am UTC in response to Melissa Rice

Re: Logarithmic transform in a time dependent diffusion equation

Hi

indeed such limits are delicate to handle, if you look at the equations in COMSOL, there are often booleans or if() statements. The trick is to set these such that the "formula analyzer" or "discretization" part of the solver (this is my understanding, needs COMSOL developers confirmation though) catches these and sort them out to avoid tests during the number crunching section.

playing with eps or a few times eps is one way, another is definitively to avoid the "0" default initial conditions (these are often OK, but for certain physics it's not the case) by using some better guesses

--
Good luck
Ivar

Roberta Ciavarelli

March 31, 2011 2:02pm UTC in response to Ivar Kjelberg

Re: Logarithmic transform in a time dependent diffusion equation

Dear all,
I'm working with a Convection and Diffusion problem, for a 1-D geometry in transient conditions. I have also negative concentration problems, probably due to the pulsing schedule that I use as boundary condition.

In order to verify the applicability of the logarithmic transform of concentration, I implemented this solution (as reported in the example www.comsol.com/support/knowledgebase/952/ ) to a simple problem, which didn't have these negative concentration problems. However I obtained different results...how is this possible?

Thanks a lot for your help

Rules and guidelines