Burgers1d

17 views
Skip to first unread message

Kadir Çar

unread,
Mar 29, 2024, 10:27:52 AMMar 29
to claw-users
Hello I have 2 things to deal with 1 of them is I want to implement the rarefaction wave to inviscid burgers equation thats why I was trying to run the python code by just changing 

 xc = state.grid.x.centers
    state.q[0,:] = np.where(xc < 0.5, 0.0, 1.0)
as like this but it doesnt work. And the second one is for the output I couldnt see the output so I have written a test.py which includes from clawpack.pyclaw import examples
claw = examples.burgers_1d.setup()
claw.run()
#claw.plot()

import matplotlib.pyplot as plt
# Assuming you want to plot the first solution frame
frame = claw.frames[0]. Can you at least give me some ideas to implement my example by usig clawpack. What if I dont want to use test.py file to view. I couldnt figure out in which file should I check for visual outputs or graphs. 

# Create your plot
for index, frame in enumerate(claw.frames):

    plt.figure()
    plt.plot(frame.grid.dimensions[0].centers, frame.state.q[0,:])

    # Save the plot to a file
    plt.savefig(f"plot_{index}.png")

Kyle Mandli

unread,
Mar 29, 2024, 10:40:39 AMMar 29
to claw-...@googlegroups.com
> state.q[0,:] = np.where(xc < 0.5, 0.0, 1.0)

That should work, can you describe what is going wrong?

The documentation describes how to view the results at http://www.clawpack.org/pyclaw/examples.html.  If this is not working let us know what exactly is going wrong.

Kyle
    plt.savefig(f"plot_{index}.png")  --
You received this message because you are subscribed to the Google Groups "claw-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to claw-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/claw-users/5ed8fac7-02c5-4c4c-a867-367d44986455n%40googlegroups.com.

Kadir Çar

unread,
Mar 30, 2024, 2:34:17 AMMar 30
to claw-...@googlegroups.com
Okay thanks a lot 

29 Mar 2024 Cum, saat 17:40 tarihinde Kyle Mandli <kyle....@gmail.com> şunu yazdı:

Kadir Çar

unread,
Apr 1, 2024, 11:21:50 PMApr 1
to claw-...@googlegroups.com
Hi again what I have implemented is 
Ekran görüntüsü 2024-04-01 140108.png
but when I implement this correction the output at first time step is correct as like this
 Ekran görüntüsü 2024-04-01 140336.png
but for the following timesteps the problem is the function at x=0 automatically defined as 1 and gives
Ekran görüntüsü 2024-04-01 140342.png
Ekran görüntüsü 2024-04-01 140352.png
and it follows like that the problem that I want to correct is i want state.q[0,0] to be value 1 at every time step so I would get a graph as like a stair which is translated.

29 Mar 2024 Cum, saat 17:40 tarihinde Kyle Mandli <kyle....@gmail.com> şunu yazdı:
> state.q[0,:] = np.where(xc < 0.5, 0.0, 1.0)

Kyle

David Ketcheson

unread,
Apr 1, 2024, 11:23:14 PMApr 1
to claw-users
It looks like you're using periodic boundary conditions. I think that's all you need to change. 

Kadir Çar

unread,
Apr 2, 2024, 6:36:05 AMApr 2
to claw-...@googlegroups.com
Thanks a lot its fixed now

David Ketcheson <dke...@gmail.com>, 2 Nis 2024 Sal, 06:23 tarihinde şunu yazdı:
Reply all
Reply to author
Forward
0 new messages