Comments (10)
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.
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.
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.
I think I would store the energy as a 1D dataset and keep the energy in python in a 1D numpy array.
from shenfun.
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.
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.
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.
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.
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.
Ah, yes, that would explain it. Thanks for explaining that and it now makes sense.
from shenfun.
Related Issues (20)
- Dx not working with 1D mixed function space HOT 4
- Issue on Stokes equations with doubly periodic boundary conditions. HOT 2
- Error when evaluating derivatives for nonstandard domain HOT 7
- Installation problem: error in "cimport fastgl_wrap" HOT 2
- Old shenfun script for 2D Poisson equation dosn't work with new version HOT 2
- 1d poisson HOT 1
- Bug in FunctionSpace with bc as dictionary HOT 4
- Solve DGL with non-constant (discrete) variable? HOT 5
- AttributeError: 'tuple' object has no attribute 'copy' HOT 1
- Install problem HOT 1
- problems in solving 2D Allen Cahn equation HOT 2
- Two questions in the demo MixedPoisson.py HOT 7
- How to compute the numerical solution on the general points HOT 4
- 1. Solver for multidimensional problem 2. Product with variable coefficients HOT 4
- Two questions about the Legendre-Galerkin method for the Cahn-Hilliard equation HOT 2
- How to compute the integral about the nonlinear term in the Navier-Stokes equation? HOT 2
- How to assemble the right-hand side vector? HOT 3
- Understanding the chebyshev solver in poisson2ND.py HOT 3
- Time dependent boundary conditions in segments for Rayleigh-Benard 2D HOT 2
- Implementing the one-dimensional Kuramoto-Sivashinsky system HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shenfun.