georgestagg / 2D-GP

2D-GP is a FORTRAN project designed to numerically solve the Gross-Pitaevskii equation (GPE) in two dimensions (2D).
MIT License
0 stars 0 forks source link

Running 2D-GP #2

Closed Ispahan closed 9 years ago

Ispahan commented 9 years ago

Hello,

I cloned your project and tried to install it in order to run it properly. However there seems to be a problem when I try ./install. Somehow not all that is required to run the program seems to be installed. When I run make2dgp the makefile cannot be found and the makemovie.sh is not found. I think something went wrong during the installation but I can not figure out what. I am quite new to this, I am very interested to see how your project finds solutions to the GP equation.

georgestagg commented 9 years ago

The install process is quite delicate, I use this mainly for active research so I haven't tested it fully since I don't install it very often.

Do not worry about errors with makemovie.sh: that script was removed when I started using MATLAB for visualisation. I will remove it from the script soon.

Can you tell me what OS are you using? Can you try rebooting, perhaps that will help put the location of make2dgp into your path.

If you run: echo $2DGPSOURCELOC And if that returns an empty string try running export 2DGPSOURCELOC=/path/to/install/location/ Then try make2dgp again.

If that still doesn't work, running the full path to make2dgp instead:

/path/to/install/location/make2dgp

Hopefully one or all of these things will help. If not, I will look at the installation script again and clean up any issues tomorrow.

Ispahan commented 9 years ago

Thank you for your reply. I have tried what you suggested, however the problem still exists.

----:~$ echo $2DGPSOURCELOC DGPSOURCELOC

My OS is Ubuntu the latest version. Below you can see what my terminal tells me is going wrong.

----:~/2D-GP$ make2dgp ~ ~/2D-GP make: ** No targets specified and no makefile found. Stop. mv: cannot stat ‘gp’: No such file or directory mv: cannot stat ‘_.mod’: No such file or directory cp: cannot stat ‘makemovie.sh’: No such file or directory make: _* No rule to make target `clean'. Stop. ~/2D-GP

When I use ./install I don´t get an error, but nothing seems to happen either. My terminal returns to prompt without having done anything. I am also not sure what the output should be. Is the data visualized in a 2D grid? Thank you so much for looking at this problem.

2015-05-25 13:28 GMT+02:00 George Stagg notifications@github.com:

The install process is quite delicate, I use this mainly for active research so I haven't tested it fully since I don't install it very often.

Do not worry about errors with makemovie.sh: that script was removed when I started using MATLAB for visualisation. I will remove it from the script soon.

Can you tell me what OS are you using? Can you try rebooting, perhaps that will help put the location of make2dgp into your path.

If you run: echo $2DGPSOURCELOC And if that returns an empty string try running export 2DGPSOURCELOC=/path/to/install/location/ Then try make2dgp again.

If that still doesn't work, running the full path to make2dgp instead:

/path/to/install/location/make2dgp

Hopefully one or all of these things will help. If not, I will look at the installation script again and clean up any issues tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/extigy/2D-GP/issues/2#issuecomment-105214112.

georgestagg commented 9 years ago

I think I see what's happened. It seems to think your install directory, $GP2DSOURCELOC, is "~".

Can you edit ~/.bashrc and see if the following lines exist. If not add them: export PATH=$PATH:/home/------/2D-GP export GP2DSOURCELOC='/home/-------/2D-GP'

Make sure the lines are as above with the ------ replaced with your username. I think yours may be missing the /2D-GP on the end.

Then close and open your terminal to apply the changes (you may even need to reboot).

You should then be able to run make2dgp from outside the 2D-GP folder. That's what the PATH line allows you to do above. If not, run the two export lines above manually.

Make a new folder anywhere, e.g. ~/testgpdir/ cd into it, then run make2dgp then ./gp&


The output files should be labelled sequentially though time (example: 0000.dumpwf.0000) and are text files and the wavefunction files should look like the following

Column 1 Column 2 Column 3 Column 4 Column 5
x coordinate y coordinate Real part of wavefunction at (x,y) Imaginary part of wavefunction at (x,y) Potential at (x,y)

There are matlab scripts in the script folder that can be viewed to get an idea of how to read the files. If you have matlab you can run

[gridx,gridy,dens,phase,potential] = gpeget2dWF(dirarg,i,speed,nx,ny); imagesc(gridx,gridy,dens)

To view the output.

Ispahan commented 9 years ago

Hello,

Thank you for your reply, I am now able to run make2dgp in whichever directory I please. However when running it, it gets stuck on the makemovie.sh:

~/2D-GP ~ gfortran -O3 -c params.f95 gfortran -O3 -c bitmap.f95 gfortran -O3 -c utils.f95 gfortran -O3 -c rhs.f95 gfortran -O3 -c potential.f95 gfortran -O3 -c gp.f95 gfortran -O3 -o gp gp.o params.o bitmap.o utils.o rhs.o potential.o rm gp.o cp: cannot stat ‘makemovie.sh’: No such file or directory rm -f .o .mod .MOD .in ~

This part I cannot figure out. If makemovie.m allows to visualize the data then it would be nice if I could get it to work. Cheers

2015-05-25 15:56 GMT+02:00 George Stagg notifications@github.com:

I think I see what's happened. It seems to think your install directory, $GP2DSOURCELOC, is "~".

Can you edit ~/.bashrc and see if the following lines exist. If not add them: export PATH=$PATH:/home/------/2D-GP export GP2DSOURCELOC='/home/-------/2D-GP'

Make sure the lines are as above with the ------ replaced with your username. I think yours may be missing the /2D-GP on the end.

Then close and open your terminal to apply the changes (you may even need to reboot).

You should then be able to run make2dgp from outside the 2D-GP folder. Thats what the PATH line allows you to do above.

Make a new folder anywhere, e.g. ~/testgpdir/ cd into it, then run make2dgp

then ./gp&

The output files should be labelled sequentially though time (example: 0000.dumpwf.0000) and are text files and the wavefunction files should look like the following Column 1 Column 2 Column 3 Column 4 Column 5 x coordinate y coordinate Real part of wavefunction at (x,y) Imaginary part of wavefunction at (x,y) Potential at (x,y)

There are matlab scripts in the script folder that can be viewed to get an idea of how to read the files. If you have matlab you can run

[gridx,gridy,dens,phase,potential] = gpeget2dWF(dirarg,i,speed,nx,ny); imagesc(gridx,gridy,dens)

To view the output.

— Reply to this email directly or view it on GitHub https://github.com/extigy/2D-GP/issues/2#issuecomment-105238343.

georgestagg commented 9 years ago

After running make2dgp the code is ready to simulate. Run ./gp& to start it. The current status will be output into a STATUS after a little while.


If you want to change any parameters and rerun the simulation change the params.in file that has been placed into the folder you ran make2dgp from, then rerun make2dgp and ./gp& in the same folder.


In the 2D-GP folder type git pull to receive the latest version of the make2dgp script (I updated it yesterday to remove the reference to makemovie.sh). This will stop the error appearing.

makemovie.sh is an old method of visualizing that I no longer use. I now use gpe2dmakemovie.m from the scripts folder to visualize the data, but you will need MATLAB installed to use it.

To use the new method open MATLAB and browse to the scripts folder, then run: gpe2dmakemovie([directory you ran make2dgp in],0,1,[number of frames output by 2DGP],0,[NX],[NY]) NX and NY must match the numbers in params.in, I think they default to 128.

Ispahan commented 9 years ago

Thank you so much for all your help! Everything is working fine now. Cheers

2015-05-26 14:57 GMT+02:00 George Stagg notifications@github.com:

After running make2dgp the code is ready to simulate. Run ./gp& to start it. The current status will be output into the STATUS file after a little

while.

If you want to change any parameters and rerun the simulation change the params.in file that has been placed into the folder you ran make2dgp

from, then rerun make2dgp and ./gp& in the same folder.

In the 2D-GP folder type git pull to receive the latest version of the make2dgp script (I updated it yesterday to remove the reference to makemovie.sh). This will stop the error appearing.

makemovie.sh is an old method of visualizing that I no longer use. I now use gpe2dmakemovie.m from the scripts folder to visualize the data, but you will need MATLAB installed to use it.

To use the new method open MATLAB and browse to the scripts folder, then run: gpe2dmakemovie([directory you ran make2dgp in],0,1,[number of frames output by 2DGP],0,[NX],[NY]) NX and NY must match the numbers in params.in, I think they default to 128.

— Reply to this email directly or view it on GitHub https://github.com/extigy/2D-GP/issues/2#issuecomment-105517580.

georgestagg commented 9 years ago

You're welcome!

Ispahan commented 8 years ago

It has been a long time since I last looked at your nice 2D-GP code, due to circumstances I was never able to properly test the Matlab files.

Recently I picked it up again, I ran the make2dgp command successfully but the plotting of gpe2dmakemovie.m is not going smoothly. It seemed I was missing some Matlab packages, after fixing this problem Matlab plotted the data into 50 empty grey square plots. When I took a closer look at the data in the dump files I found out the density is always the same: 0.0244140624999986.

I used the following parameters when running gpe2dmakemovie.m:

function gpe2dmakemovie() dirarg = 'Directory in which I ran the program'; startno = 0; stride = 1; endno = 50; speed = 0; nx = 128; ny = 128;

Do you have any idea why the density does not change, and if that is the cause of the empty plots?

georgestagg commented 8 years ago

I am now at the writing up part of my PhD and so I have not kept this repo clean, and edited files for my own use fairly often without thought of others (my apologies!). However I may be still able to help. The problem is probably due to some parameters in your simulation so that the trap is very large compared to the box size.

Please try pulling the latest version of the code and rerunning the simulation (make2dgp and then ./gp) with the following parameters in params.in: NX = 256 NY = 256 VOBS = 0 VOBE = 0 VOBST = 1 NSTEPS=10000 VSTEPS=0 ISTEPS=100 DSPACE = 0.2d0 DTSIZE = 0.002d0 dumpd = 1000000 dumpwf = 100 dumputil = 100 RHSType = 1 ROM = 0.7d0 BCX = 1 BCY = 1 harm_osc_C = 2000.0d0 harm_osc_mu = 25.26698674d0 enablePot = .true. enableTrap = .true. TXSCALE = 0.97d0 GAMMAC = 0.1d0

Once done, try the following command in matlab: gpe2dmakemovie('directory which you ran ./gp',1,1,100,0,256,256);

The images should then show a condensate (in rotatation) filling with vortices over time. Ignore the numbers drawn with the images, they are only relevant to some research I was doing with a particular set of parameters, you can freely comment them out of the gpd2dmakemovie.m script.

Ispahan commented 8 years ago

Thank you for your quick reply! I tried what you suggested, but now when I run the command make2dgp I get an error related to the parameters:

~/2D-GP ~/2D gfortran -O3 -c params.f95 params.in:18.3: Included at params.f95:107:

ROM = 0.7d0 1 Error: Symbol 'rom' at (1) has no IMPLICIT type params.in:25.7: Included at params.f95:107:

TXSCALE = 0.97d0 1 Error: Symbol 'txscale' at (1) has no IMPLICIT type make: ** [params.o] Error 1 mv: cannot stat ‘gp’: No such file or directory mv: cannot stat ‘.mod’: No such file or directory cp: cannot stat ‘makemovie.sh’: No such file or directory rm -f .o .mod .MOD .in ~/2D chmod: cannot access ‘gp’: No such file or directory

I am not sure what this means, I looked it up but I found nothing similar.

georgestagg commented 8 years ago

It just means you have an older version of the code where those parameters did not exist! Run git pull in the original directory you installed 2D-GP (or download the latest files from the github as a zip and replace all)

You can check you have the latest version by viewing params.f95 in the original install directory. If it contains the line:

double precision :: ROM = 0.0d0

you should be good to go!

Ispahan commented 8 years ago

Thank you for your suggestion, I was able to fix the problem it took a little longer since I was missing some Fortran packages. I have made some plots with Matlab and you can find the last one attached to this comment. Could you please explain to me what is happening in these plots?

p0050

georgestagg commented 8 years ago

There is a trapped condensate in rotation in the center of the image. The grayscale colors show the condensate density. The condensate sits at the center of the trap and so has the highest density there. Further out the density goes to zero (black).

As the condensate is in rotation, angular momentum is injected into the fluid over time, creating vortices. As the condensate is at zero temperature, it is a superfluid and so due to quantum mechanics vorticity is constrained into small packets of quantized strength. In other words, any vortices in the system must be identically sized! These are the small black dots you see moving around in the condensate. You can think of them as mini-tornadoes viewed from above.

Finally, the matlab routine you are using can locate vortices and tell you whether they are rotating clockwise or anticlockwise (red or blue). Normally the small black dots should be covered in identically colored symbols (as they are all charged with the same polarity). However, once more due to my tinkering, the parameters in the routine are wrong!

Make sure you have the latest version of gpeget2dvort.m and edit it's lines to read: 10: th = 1; 48: densf = (densg(i,j)/maxdens); 50: presort(i,j)=liint*densf; 78: %h=figure(); 79: %imagesc(gridx,gridy+dspace/2,presort);

The result should look like the following, will all visible vortices labelled: p0099

Ispahan commented 8 years ago

It works great now, thank you! I have another question, what kind of random perturbation did you apply to the initial condition? Cheers

georgestagg commented 8 years ago

By default there is no random perturbation to the IC, here any noise comes from numerical integration errors.

You can add noise to the IC by editing the params.in file and adding the following

noiseamp = 0.1d0

and then running make2dgp and ./gp again.

This will add random numbers with maximum size 0.1 to every point in the wavefunction of the IC before the real-time simulation starts.

Ispahan commented 8 years ago

Then what form does the initial perturbation have that you used? You see I want to look how the situation changes if I take a Gaussian initial perturbation. Any suggestions? Cheers

georgestagg commented 8 years ago

Oh you mean the initial profile for the condensate density? It's a Thomas Fermi profile, with imaginary-time propagation used to smooth that out to become the true ground state solution before real-time simulation. With the smoothing all initial conditions will approach the ground state.

To remove the imaginary-time smoothing set ISTEPS=0, and the TF profile is set in file utils.f95 on line 126:

GRID(i,j) = (harm_osc_mu - OBJPOT(i,j))/harm_osc_C

so to use a Gaussian you could set this to something like (untested):

GRID(i,j) = Aexp((iDSPACE)(iDSPACE)+(jDSPACE)(j*DSPACE)/s)

where A is the gaussian height and s is a parameter controlling width.

Ispahan commented 8 years ago

Thank you I will give it a try! Cheers

Ispahan commented 8 years ago

Hello again, Do you think its possible to take out the rotation term? I would like to make a 2D density map which is non-rotational.

georgestagg commented 8 years ago

sure, set ROM = 0.0d0 in params.in

Be aware without the rotation vortices will not nucleate automatically. If you want them, you'll have to add them manually or through other nucleation mechanisms.

Ispahan commented 8 years ago

I am trying to make something similar to the image you can find attached to this comment. Do you think its possible to make such a 2D density map with your code?

widrow kaiser 1993
georgestagg commented 8 years ago

The code really is designed for simulating dilute gases rather than dark matter, so I really cannot be sure. I do not know anything about dark matter universe simulations I'm afraid.

At the very least, you would need to update the code so that that the equations match the ones used in that paper. Depending on the form of those equations, it may be easier to write your own code for performing dark matter simulations, rather than modifying mine.