Replies: 1 comment 4 replies
-
Make these changes # offset the mesh so that it goes from zmin to zmax
# instead of 0 to (zmax - zmin)
m = Grid1D(nx=len(z), Lx=zmax-zmin) + [[zmin]]
# Declare a time variable
t = Variable(name="t", value=0.)
# Declare exact_rhs as a function of mesh coordinates and time
# It will automatically update when t changes
exact_rhs = u_exact(z=mesh.x, t=t)
# Solve
for step in range(nnt-1):
# no need to update exact_rhs; it happens automatically
c.updateOld()
...
iter = 0
res = 1.
while ( res > 1e-7 and iter < 50 ):
res = full_eq.sweep(dt=dt_soln)
iter = iter + 1
t.value = t.value + dt_soln
soln.c[step+1] = c
... |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
In the example below, I want to add an exact right-hand-side vector to my equations (exact_rhs). The exact right-hand-side does not depend on the variables solved for. It is given by say:
exact_rhs = u_exact(z)*u_exact(t)
The exact_rhs vector is time-dependent such that it needs to be updated at each time iteration
How would you go about adding that term to the equation below?
Thanks,
Anthony
Beta Was this translation helpful? Give feedback.
All reactions