Awesome. Thanks a lot!
Daniel Wheeler schrieb am Freitag, 19. April 2024 um 16:41:35 UTC+2: > Here's an example. It's trivial, but it just demonstrates solving a > variable on one grid and then using that variable to set the value of > the diffusion coefficient for an equation on a different grid. > Obviously, if the domains don't overlap then you need to take care of > the mapping and interpolation between the grids. > > ~~~ > from fipy import CellVariable, Grid1D, DiffusionTerm, Viewer, TransientTerm > > nx = 100 > dt = 1e-3 > Lx = 1.0 > steps = 1000 > > mesh0 = Grid1D(nx=nx, Lx=Lx) > mesh1 = Grid1D(nx=nx, Lx=Lx) > > v0 = CellVariable(mesh=mesh0, value=0., hasOld=True) > v0.constrain(1e-1, where=mesh0.facesLeft) > v0.constrain(10., where=mesh0.facesRight) > > v1 = CellVariable(mesh=mesh1, value=0., hasOld=True) > v1.constrain(0., where=mesh1.facesLeft) > diff_coeff = CellVariable(mesh=mesh1, value=0.) > > eqn0 = TransientTerm() == DiffusionTerm() > eqn1 = TransientTerm() == DiffusionTerm(diff_coeff) + 1. > > viewer = Viewer(v1) > > for i in range(steps): > v0.updateOld() > v1.updateOld() > eqn0.solve(v0, dt=dt) > diff_coeff[:] = v0 > eqn1.solve(v1, dt=dt) > viewer.plot() > > input("stopped") > > > On Thu, Apr 18, 2024 at 3:31 AM Nils Winkler <winkle...@gmail.com> wrote: > > > > Oh great. Do you happen to have example code? I am not sure how to > properly do that. > > > > Daniel Wheeler schrieb am Mittwoch, 17. April 2024 um 16:19:16 UTC+2: > >> > >> On Wed, Apr 17, 2024 at 9:33 AM Nils Winkler <winkle...@gmail.com> > wrote: > >> > > >> > Hi, > >> > > >> > I am using fipy to deal with a system of three coupled nonlinear > partial differential equations. Two dependent parameters have Naumann BCs > and one periodic BCs. Is it possible to implement these at the same time? > >> > > >> > Using only a periodic mesh with internal BCs for the Naumann BC does > not work because the respective two dependent parameters are not continuous > at the boundary. > >> > Can one somehow combine a periodic with a normal mesh? Or is it > possible to use a normal mesh and impose periodic boundary conditions > internally? > >> > >> Yes, you can do that. You'll have to define the dependent variables > >> across both the domains and map the variable values over at each sweep > >> / timestep so there will be some overhead. > >> > >> -- > >> Daniel Wheeler > > > > -- > Daniel Wheeler > -- To unsubscribe from this group, send email to fipy+unsubscr...@list.nist.gov View this message at https://list.nist.gov/fipy To unsubscribe from this group and stop receiving emails from it, send an email to fipy+unsubscr...@list.nist.gov.