Coder Social home page Coder Social logo

Comments (13)

MickaelGrechX avatar MickaelGrechX commented on August 25, 2024

from smilei.

usinhampik avatar usinhampik commented on August 25, 2024

Thanks a lot Michael for the response. This will be of great help.
When we apply the external field, then initially the field is present. As the window moves towards positive x, the new region entering the simulation domain do not have the field.

from smilei.

beck-llr avatar beck-llr commented on August 25, 2024

Hi
This is actually normal. In Smilei, the external field you define is an additional field in your initial simulation box. It can also be coupled with the corresponding boundary conditions, if necessary, so that the field is maintained in the simulation box. It was originally designed for magnetic reconnection simulations. It can also be used to initalize a laser pulse inside the simulation box at t=0 for instance.

But in the case of a moving window, you would have to define a field for all possible time and space where your window could potentially be during the whole course of the simulation. This is the source of many difficulties, confusion and physical misinterpretation so we decided not to implement it for the moment.

Our apologies. I have to admit the documentation is not very clear on this particular point.

from smilei.

MickaelGrech avatar MickaelGrech commented on August 25, 2024

Hi!
Just a quick comment following @beck-llr.
One actually consider that the 'new' plasma injected on the right side of the moving window is in a stationary state. Hence, one could also consider that the fields in there are as should have been defined at t=0.
As an exemple, imagine you want to simulation LWFA in the presence of a constant magnetic field (let say Bx). One should be able to add very easily this external field Bx = cst.
I've discussed this with @jderouillat and we agreed this could be done (with obviously the possible pitfalls you mentioned earlier). @beck-llr, don't you it's worth allowing this feature?

from smilei.

beck-llr avatar beck-llr commented on August 25, 2024

It would definitely be worth it yes. And it looks very easy to do in the way you put it @MickaelGrech . But it actually requires quite a lot of thinking and engineering because it modifies patch creation which is a fundamental function. It also raises some questions about boundary conditions.

from smilei.

usinhampik avatar usinhampik commented on August 25, 2024

I think this feature will be very helpful to study several phenomenas. In particular, in LWFA as well as beam driven Wakefield. I am not aware of the patch creation function but would like to know if it would be possible by just adding the external field in the equation of motion at every time step.

from smilei.

jderouillat avatar jderouillat commented on August 25, 2024

Hi Ujjwal,
Can you try to add in the moving window (src/MovWindow/SimWindow.cpp, line 269) the 3 lines indicated below to test this feature ?

$ git diff
diff --git a/src/MovWindow/SimWindow.cpp b/src/MovWindow/SimWindow.cpp
index 359a99b..1d2e031 100644
--- a/src/MovWindow/SimWindow.cpp
+++ b/src/MovWindow/SimWindow.cpp
@@ -266,6 +266,11 @@ void SimWindow::operate(VectorPatch& vecPatches, SmileiMPI* smpi, Params& params
                     for( unsigned int idiag=0; idiag<vecPatches.localDiags.size(); idiag++ )
                         if( DiagnosticTrack* track = dynamic_cast<DiagnosticTrack*>(vecPatches.localDiags[idiag]) )
                             track->setIDs( mypatch );
+                    
+                    mypatch->EMfields->applyExternalFields( mypatch );
+                    if (params.save_magnectic_fields_for_SM) 
+                        mypatch->EMfields->saveExternalFields( mypatch );
+                    
                 }
             }
         }

from smilei.

jderouillat avatar jderouillat commented on August 25, 2024

To be more explicit on what happen here :

  • The pragma omp clauses and the ithread loop are used to serialize over threads the usage of python profile which could be used to create particles (not compatible with OpenMP, Python is not thread safe).
  • The j loop browses patches newly created.
  • The test on patch_to_be_created[ithread][j] identifies patches created at Xmax and not those which are created between 2 MPI process.
  • mypatch is the current instance of a newly created patch
    #pragma omp master
    {
        for (int ithread=0; ithread < max_threads ; ithread++){
            for (unsigned int j=0; j< (patch_to_be_created[ithread]).size(); j++){
                //If new particles are required
                if (patch_to_be_created[ithread][j] != nPatches){
                    mypatch = ....
                }
            }
        }
    }
    #pragma omp barrier

from smilei.

usinhampik avatar usinhampik commented on August 25, 2024

Thanks @jderouillat . I will try this and comeback to you.

from smilei.

usinhampik avatar usinhampik commented on August 25, 2024

Hi @jderouillat ,

I tried what you suggested above. However, I got the following error message while compiling

src/MovWindow/SimWindow.cpp: In member function ‘void SimWindow::operate(VectorPatch&, SmileiMPI*, Params&, unsigned int, double)’:
src/MovWindow/SimWindow.cpp:270:18: error: ‘class Params’ has no member named ‘save_magnectic_fields_for_SM’
if (params.save_magnectic_fields_for_SM)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/MovWindow/SimWindow.cpp:271:27: error: ‘class ElectroMagn’ has no member named ‘saveExternalFields’; did you mean ‘applyExternalFields’?
mypatch->EMfields->saveExternalFields( mypatch );
^~~~~~~~~~~~~~~~~~
applyExternalFields
make: *** [build/src/MovWindow/SimWindow.o] Error 1

I tried looking into Params.h and Params.cpp, but was not sure what should be the datatype of the new variables introduced.

from smilei.

mccoys avatar mccoys commented on August 25, 2024

@usinhampik You likely have an old version of the code (before last april). I suggest you clone the repository on this GitHub to obtain a newer version.

from smilei.

usinhampik avatar usinhampik commented on August 25, 2024

Hello all,

I did some preliminary small scale tests and this seems to work. I am running a few large simulations now. I will update with the outcomes in a couple of days.
Thank you all a lot for the help.

from smilei.

usinhampik avatar usinhampik commented on August 25, 2024

Hello all,
I ran sufficient number of simulations after adding the lines suggested by @jderouillat and it works fine.
Once again, I thank you all for the prompt response and help.

from smilei.

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.