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.

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:
 Mikael Mortensen (mikael-mortensen) said on 2013-09-25: #1

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 on 2013-09-27: #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!