Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Please Help - How to use calculated value of a function F at time step 1, for calculation at time step 2 and so on

Please login with a confirmed email address before reporting spam

I want to calculate the value of a function F(T,t)=A(T)*F(T,t).
It means for calculating the F in a time step 2, I need the value of F from previous steps (step1). Can anyone help me to do such calculation in the heat transfer module of COMSOL.

For example : my variable : E_PC (step i) = E_PC (step i-1) - 0.01

For exemple : A = A + 1.5
( circular variable the new A = the previous A + 1.5)

Please what i can do it with comsol 4.3

thank's

6 Replies Last Post 20.05.2014, 02:59 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 16.05.2014, 03:46 GMT-4
I am not sure how to program per time step, because I think in general COMSOL chooses it's own time steps. What is your variable T? I can immagine that A(T) would have to depend on the size of your time step, so is T the size of your time step? I would linearize A(T), so it would be approximately equal to A(0)+T*(dA/dT)_0, which always holds if your time step is sufficiently small ((dA/dT)_0 is dA/dT calculated at T=0). Then you would have

(F(t+T)-F(t))=A(T)=A(0)+T*(dA/dT)_0

dividing both sides by T you get

(F(t+T)-F(t))/T=A(0)/T+(dA/dT)_0

The left hand side is the definition of the differential, so you would get

dF/dt=A(0)/T+(dA/dT)_0

Which shows that A should approach 0 when your time step approaches 0, otherwise A(0)/T will be infinite. So A(0)=0 so

dF/dt=(dA/dT)_0

I would say that such a differential equation can be implemented somewhere in your model.

I am not sure how to program per time step, because I think in general COMSOL chooses it's own time steps. What is your variable T? I can immagine that A(T) would have to depend on the size of your time step, so is T the size of your time step? I would linearize A(T), so it would be approximately equal to A(0)+T*(dA/dT)_0, which always holds if your time step is sufficiently small ((dA/dT)_0 is dA/dT calculated at T=0). Then you would have (F(t+T)-F(t))=A(T)=A(0)+T*(dA/dT)_0 dividing both sides by T you get (F(t+T)-F(t))/T=A(0)/T+(dA/dT)_0 The left hand side is the definition of the differential, so you would get dF/dt=A(0)/T+(dA/dT)_0 Which shows that A should approach 0 when your time step approaches 0, otherwise A(0)/T will be infinite. So A(0)=0 so dF/dt=(dA/dT)_0 I would say that such a differential equation can be implemented somewhere in your model.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 16.05.2014, 15:45 GMT-4
thank you Pieter

My variable is not T, is the potential applied to a pipeline (potential cathodic protection E_CP).

I testing the potential of the electrolyte Eoff for each time step.

And if Eoff> -0.85 V, I must impose a new E_CP (potential protection) = previous E_PC - 0.01 to pipeline intel Eoff becomes <-0.85 V.

My problem that I can not put E_PC = E_PC - 0.01 because Comsel not accept it !!

Is there a solution?
thank you Pieter My variable is not T, is the potential applied to a pipeline (potential cathodic protection E_CP). I testing the potential of the electrolyte Eoff for each time step. And if Eoff> -0.85 V, I must impose a new E_CP (potential protection) = previous E_PC - 0.01 to pipeline intel Eoff becomes

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19.05.2014, 03:27 GMT-4
Hi Babaghayou,

So what you want is that the potential of your pipeline is lowered when the potential of your electrolyte becomes too high? So what in your model controls the potential of your pipeline? If you would not have this check, would it be constant?
Hi Babaghayou, So what you want is that the potential of your pipeline is lowered when the potential of your electrolyte becomes too high? So what in your model controls the potential of your pipeline? If you would not have this check, would it be constant?

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19.05.2014, 13:29 GMT-4
Hi pieter

In my model, the potential of pipeline (Eoff) is controled by "Domain Prob" and at each step of time give me the value of pipeline potential.

The potential Eoff depend to the potential of cathodic protection that I must increase or reduce if Eoff increase or reduce.

Hi pieter In my model, the potential of pipeline (Eoff) is controled by "Domain Prob" and at each step of time give me the value of pipeline potential. The potential Eoff depend to the potential of cathodic protection that I must increase or reduce if Eoff increase or reduce.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19.05.2014, 13:48 GMT-4
The Eoff must remain in value between Vmin and Vmax and if Eoff>Vmax or Eoff<Vmax , i increase or reduce the potential of protection for maintain Eoff between these two values.

The Eoff must remain in value between Vmin and Vmax and if Eoff>Vmax or Eoff

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 20.05.2014, 02:59 GMT-4
And how is this potential protection changed? Can you maybe upload your model?
And how is this potential protection changed? Can you maybe upload your model?

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.