Initialize problem

Asked by Diego Gonzalez on 2013-09-23

Hi again,

A need to initialize a problem with two velocities. My mesh is [-1, 1] in 'y' direction and i need to set a velocity = 1 from 0 to 1 and a velocity = 0.5 from 0 to -1. I don't know how to set this in the q0 dictionary of My problem. Any help will be appreciated.
Thanks in advance.

Question information

Language:
English Edit question
Status:
Solved
For:
CBC.PDESys Edit question
Assignee:
No assignee Edit question
Solved by:
Diego Gonzalez
Solved:
Last query:
Last reply:

Try using an error function. Something like

from scipy.special import erf

class Finit(Expression):
    def __init__(self, sigma=0.01, **kwargs):
        self.sigma = sigma

    def eval(self, values, x):
        values[0] = 0.5*(1+0.5*(1+erf(x[0]/0.01)))

q0 = {'u': Finit()}

Diego Gonzalez (drweiberlen) said : #2

I use q0 = Initdict(u=(("0.5*(1+0.5*(1+erf(x[1]/0.001)))", "0")), p=("0")) and work fine.

Thanks Mikael Mortensen!