On Oct 28, 2009, at 10:48 AM, Ranjit Chacko wrote:


This is the method I use to update the field on each time step:
def step(self):
       self.t += self.dt
       self.phi.updateOld()
       residual=1
       while residual>1.0e-1:
           residual=self.equation.sweep(var=self.phi, dt=self.dt,
solver=self.solver)

Is this the right way to use sweep?

How did you pick "residual>1.0e-1" ? How do you know your solution is converged at that value? I suspect you're getting dramatically different answers because your solution is not converged.


       self.phi.setValue(self.phi +
self.xsi*GaussianNoiseVariable(mesh=self.mesh, mean=0.0, variance=1))

I don't think it's harmful, but this is not how I would implement Langevin noise.


I would do:

self.noise = self.xsi*GaussianNoiseVariable(mesh=self.mesh, mean=0.0, variance=1) self.equation = (TransientTerm() + ConvectionTerm() == DiffusionTerm() + ... + self.noise)
def step(self):
       self.t += self.dt
       self.phi.updateOld()
       self.noise.scramble()  # update the noise like this
       residual=1
       while residual>1.0e-1:
           residual=self.equation.sweep(var=self.phi, dt=self.dt,
solver=self.solver)

It's not critical at this juncture, but the variance of Langevin term should be correlated with both cell size and time step. This is illustrated in the GaussianNoiseVariable doc string.


Reply via email to