Git Product home page Git Product logo

Comments (10)

mikaem avatar mikaem commented on July 23, 2024

There are not tests for all demos, so perhaps Ginzburg Landau is broken. Should hopefully be easy to fix😀

Try biharmonic with 36 instead of 24😀

I think I installed mayavi from conda-forge.

from shenfun.

francispoulin avatar francispoulin commented on July 23, 2024

I suspect that Ginzburg Landau isn't too broken as it worked a few months ago and I suspect it's not a big deal.

Thanks for the suggestion on biharmonic and see that it does work. The problem was not with the code running, but the error wasn't small enough. Clearly I was being too quick. Sorry.

I uninstalled mayavi from pip and try and instead used conda-forge. It did not complain but gave Generic Warnings and then a seg fault. This isn't a shenfun library so I suppose I should contact the developers to see why it doesn't work.

from shenfun.

francispoulin avatar francispoulin commented on July 23, 2024

Question on diagnostics:

In my simulations I want to measure things like energy at each time step, and a few other scalar fields.

I am trying to write those into a file using HDF5, which is maybe overkill but thought it should work. Unfortuantely, it does no seem to like to write scalars.

What would you recommend I use in that library to write a scalar?

from shenfun.

mikaem avatar mikaem commented on July 23, 2024

I think I would store the energy as a 1D dataset and keep the energy in python in a 1D numpy array.

from shenfun.

francispoulin avatar francispoulin commented on July 23, 2024

Thanks for the advice. I'm trying to do this but having some difficulties with the syntax.

Below I do 2 things. First I write a 2D array and that works out very well. Second, I have a 1D array that has 2 elements, energy plus two other scalarys, and I want to write that into a different file and that fails, with an error copied below.

I've tried a bunch of different things but have not been able to figure it out. Might you be able to tell me the correct syntax?

    file = HDF5File("QG_1Layer_{}.h5".format(N[0]),
                     mode='w',
                     domain=((0,1),(0,1)) )
    file.write(tstep,  {'q': [ q ] } )

    norms = np.zeros(3)
    file_d = HDF5File("QG_1Layer_{}_diag.h5".format(N[0]),
                     mode='w',
                     domain=((0,1)) )
    file_d.write(tstep, {'norms': [ norms ]} )

Traceback (most recent call last):
  File "qg_1L_pert_shenfun.py", line 191, in <module>
    q_hat = integrator.solve(q, q_hat, dt, t_domain)
  File "/home/fpoulin/software/anaconda3/envs/shenfun/lib/python3.8/site-packages/shenfun/utilities/integrators.py", line 321, in solve
    self.update(u, u_hat, t, tstep, **self.params)
  File "qg_1L_pert_shenfun.py", line 152, in update
    file_d.write(tstep, {'norms': [ norms ]} )
  File "/home/fpoulin/software/anaconda3/envs/shenfun/lib/python3.8/site-packages/mpi4py_fft/io/h5py_file.py", line 118, in write
    FileBase.write(self, step, fields, **kw)
  File "/home/fpoulin/software/anaconda3/envs/shenfun/lib/python3.8/site-packages/mpi4py_fft/io/file_base.py", line 65, in write
    self._check_domain(group, u)
  File "/home/fpoulin/software/anaconda3/envs/shenfun/lib/python3.8/site-packages/mpi4py_fft/io/h5py_file.py", line 39, in _check_domain
    assert len(self.domain) == field.dimensions
AttributeError: 'numpy.ndarray' object has no attribute 'dimensions'

from shenfun.

mikaem avatar mikaem commented on July 23, 2024

You cannot use the write method to do this. That is for storing distributed arrays with a mesh. Open the hdf5 file, create dataset and store your 1d array as I'm sure you can find out how in the h5py documentation😀

from shenfun.

francispoulin avatar francispoulin commented on July 23, 2024

Ah, so I've basically been trying to fit a square peg in a round hole. I guess I should be glad it didn't work out in the end.

Thanks for clarifying and will use a simple hdf5 file for the diagnostics, as that will be possible.

from shenfun.

francispoulin avatar francispoulin commented on July 23, 2024

this is closed but I have a question on diagnostics so I thought why not post it here?

I am basing my code on Ginzburg_Landau.py and having a problem with the update function.

In the update function I am writing diagnostics, energy and the like. The variable u is part of the arguments so I thought it would be have the current value but it only seems to update it every plot or write step. It still writes the energy but it's the same energy at every plot or write step. Is this expected to happen?

Unfortuantely, this function doesn't run yet so I can't modify it easily to demosntrate what I'm trying to say. Sorry.

from shenfun.

mikaem avatar mikaem commented on July 23, 2024

The variable u is part of the arguments so I thought it would be have the current value but it only seems to update it every plot or write step.

U is not part of the solver, because we solve in spectral space for U_hat and not U. So either compute the energy from U_hat or transform backward to U, like in every write step or plot step.

from shenfun.

francispoulin avatar francispoulin commented on July 23, 2024

Ah, yes, that would explain it. Thanks for explaining that and it now makes sense.

from shenfun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.