Problem with time variable Log Out | Topics | Search
Moderators | Register | Edit Profile

FlexPDE User's Forum » User Postings » Problem with time variable « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Federico Treo (pilitreo)
New member
Username: pilitreo

Post Number: 1
Registered: 08-2009
Posted on Monday, August 10, 2009 - 10:16 am:   

Hi!
I am trying to simulate a time depending model. I have a rectangular cell with four pin-type electrodes and a particular medium surrounding them. The upper view of the cell is drawn. The two outer electrodes are used to apply a sinusoidal voltage to the medium and two inner electrodes are used to sense the voltage difference.
Initially I described the sinusoidal voltage applied as V = sin (omega.t) and used the time t variable. The frequency of the signal is very low (1 Hz) and the problem is almost electrostatic. However I would like to use the complex conductivity formula (sigma + i*epsilon*omega) to test other frequencies than 1Hz. The voltage measured between the two inner electrodes should also be a sinusoidal wave.
However, when the problem is resolved it behaves unexpectedly. See below the first file named "Cell with time t.pde". The signal measured at the two inner electrodes is not a sine wave.
Thereafter, I used the stage function and sampled the time variable. In this second approach (“cell with parametrized time stages.pde”) the output of the two inner electrodes resembles a sub-sampled sine wave. Any suggestion about my problem?
Regards,
Ernesto

pd: I have copied the files code because I could not attach them, sorry!

#################################################
Code for the first file
#################################################

{ Biological cell, use of time T }
title
'Electrodynamic analysis'

select
painted

variables
V {Potential}

definitions
{Materials parameters}
eps {Relative permitivitty}
sigma {Conductivity}
eps0=8.85e-12 {Vacuum permitivitty}

{ alternating potential parameters}
f=1 {Frequency}
A=1 {peak amplitude of the applied voltage}
j= sqrt(-1) {imaginary element}
omega=2*pi*f {Angluar frequency}
V_elec(t)= A * sin(f*omega*t) {Voltage applied to the electrodes: it is a sinus wave}


equations
V: div((-sigma +j*omega*eps*eps0)*grad (V))=0 { Electrostatic equation which also involves the imaginary part and the frequency }


boundaries

{region "cell" not used in this simulation

eps=2
sigma = 0.00000001 { Acrylic body }

start (-0.001,-0.001)
line to (0.016,-0.001)
line to (0.016,0.011)
line to (-0.001,0.011)
line to finish}

region 'Saline solution'

eps=300
sigma = 0.0065
start (0,0)
natural (V) = 0
line to (0.015,0)
line to (0.015,0.010)
line to (0,0.010)
line to finish

region 'Metal electrode #1'

eps = 1
sigma=10^7

START (0.00325,0.005)
VALUE(V) = V_elec(t) { Voltage applied to one of the electrodes' }
ARC(CENTER=0.00375,0.005) ANGLE=360

region 'Metal electrode #2'
eps = 1
sigma=10^7
START(0.00575,0.005)
natural (V)=0
ARC(CENTER=0.00625,0.005) ANGLE=360

region 'Metal electrode #3'
eps = 1
sigma=10^7
START(0.00825,0.005)
natural (V)=0
ARC(CENTER=0.00875,0.005) ANGLE=360

region 'Metal electrode #4'
eps = 1
sigma=10^7

START (0.01075,0.005)
VALUE(V) = -V_elec(t) { Voltage applied to one of the electrodes' }
ARC(CENTER=0.01125,0.005) ANGLE=360


TIME 0 TO 10

monitors

FOR T = 0 BY 0.05 TO 10
HISTORY(V) AT (0.00375,0.005) (0.01125,0.005)
HISTORY(V) AT (0.00625,0.005)(0.00875,0.005)

plots
grid(x,y)
contour(V)
END

###############################################
CODE FOR THE SECOND FILE
###############################################

{ Biological cell - Use of parametrized t with stages }
title
'Electrodynamic analysis'

select
stages=100

variables
V {Potential}

definitions
{Materials parameters}
eps {Relative permitivitty}
sigma {Conductivity}
eps0=8.85e-12 {Vacuum permitivitty}

{ alternating potential parameters}
f=1 {Frequency}
A=1 {peak amplitude of the applied voltage}
i= sqrt(-1) {imaginary element}
omega=2*pi*f {Angluar frequency}
V_elec= A * sin(omega*stage/100) {Voltage applied to the electrodes: it is a sinus wave}

equations
V: div((-sigma +i*omega*eps*eps0)*grad (V))=0 { Electrostatic equation which also involves the imaginary part and the frequency }

boundaries

region 'Saline solution'

eps=300
sigma = 0.0065
start (0,0)
natural (V) = 0
line to (0.015,0)
line to (0.015,0.010)
line to (0,0.010)
line to finish

region 'Metal electrode #1'

eps = 1
sigma=10^7

START (0.00325,0.005)
VALUE(V) = V_elec { Voltage applied to one of the electrodes' }
ARC(CENTER=0.00375,0.005) ANGLE=360

region 'Metal electrode #2'
eps = 1
sigma=10^7
START(0.00575,0.005)
natural (V)=0
ARC(CENTER=0.00625,0.005) ANGLE=360

region 'Metal electrode #3'
eps = 1
sigma=10^7
START(0.00825,0.005)
natural (V)=0
ARC(CENTER=0.00875,0.005) ANGLE=360

region 'Metal electrode #4'
eps = 1
sigma=10^7
START (0.01075,0.005)
VALUE(V) = -V_elec { Voltage applied to one of the electrodes' }
ARC(CENTER=0.01125,0.005) ANGLE=360

plots

HISTORY(V) AT (0.00375,0.005) versus stage/100
HISTORY (V) AT (0.01125,0.005) versus stage/100
HISTORY(V) AT (0.00625,0.005) versus stage/100
HISTORY (V) AT (0.00875,0.005) versus stage/100
grid(x,y)
contour(V)
end
Top of pagePrevious messageNext messageBottom of page Link to this message

Robert G. Nelson (rgnelson)
Moderator
Username: rgnelson

Post Number: 1284
Registered: 06-2003
Posted on Monday, August 10, 2009 - 01:39 pm:   

FlexPDE 5 does not understand complex numbers. You must declare separate variables for the real and imaginary parts of your complex variable and write two equations, one for each component.

The sqrt(-1) is illegal, but is not diagnosed because we did not want to abort user jobs that merely dipped below zero because of roundoff errors. The sqrt(-1) is returning sqrt(+1).

See "Backstrom_Books | Fields_of_Physics | d_heat | wave1.pde" for an example of this kind of application.

FlexPDE version 6 understands complex numbers. The version 6 download will run in student mode. But you must declare V to be Complex, and define j=complex(0,1).

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action:

Topics | Last Day | Last Week | Tree View | Search | Help/Instructions | Program Credits Administration