cherab / core

The core source repository for the Cherab project.
https://www.cherab.info
Other
45 stars 24 forks source link

Generomak - edge plasma specification #211

Closed mattngc closed 2 years ago

mattngc commented 4 years ago

Following issue #209, we need an importable edge plasma specification. The example data could come from a representative 2D fluid code such as SOLPS-ITER or it could be completely hypothetical. The edge plasma profile should be consistent with the example equilibrium and core plasma developed in #210. It should also be anonymised (i.e. no particular Tokamak or source code). It should include:

vsnever commented 4 years ago

Just as an option. I asked one of my colleagues, Andrey Pshenov, who is an experienced SOLPS user, whether SOLPS has test tokamak configuration as a part of its SDK, and it appears that SOLPS-ITER has some test simulation for the configuration similar to ASDEX. These data are used to test whether the program works correctly or not after compilation. I think that if the SOLPS-ITER team agree to share these test cases, you can get what you want in a simple way, namely without asking someone to create a custom SOL grid and perform the simulation specially for Cherab. In case you decide to ask the SOLPS-ITER team about this, I think it’s Xavier Bonnin whom you should contact.

Mateasek commented 4 years ago

Being consistent with SOLPS examples is not a bad idea @vsnever , since it is far more difficult to setup and run.If I'm not mistaken, the mesh is defined not only by plasma facing components, but also by the equilibrium. We would have to adopt the equilibrium as the generomak case, wouldn't we?

vsnever commented 4 years ago

If I'm not mistaken, the mesh is defined not only by plasma facing components, but also by the equilibrium. We would have to adopt the equilibrium as the generomak case, wouldn't we?

Yes, but they may have equilibrium data for their test cases as well. As for the plasma facing components, the exact ASDEX first wall cannot be made public but any wall model that fits the 2D wall outline used in SOLPS simulations should be fine.

Mateasek commented 4 years ago

I think this would be a good solution, taking what is there for one of the more difficult parts. It should be decided soon, because it has direct consequences for the other parts as PFCs and core plasma. Also the PFCs don't have to copy the simulation domain exactly I guess.

mattngc commented 4 years ago

Hmm... yeah I agree this sounds like a good idea. As long as a suitable equilibrium and wall outline can be constructed, it should all be fine. It does mean some adjustments are needed for any demos made with the previous example equilibrium. Can @jacklovell comment on this? Is the work load for your bolometry examples a problem if we change the equilibrium to be an AUG like machine?

Alternatively, we could just refactor the version number of the other equilibrium (e.g. v1). Make this new one v2 and then base all the new Generomak features around this. But agree with @Mateasek we should get agreement quickly as they are all interlinked. Getting a realistic SOLPS solution with consistent-ish core solution would be really nice :)

jacklovell commented 4 years ago

It won't be much work to modify the IRVB demos for the new equilibrium. If I remember rightly the old one is relatively similar to an AUG equilibrium anyway, so I don't imagine the LCFS would be dramatically different, and the detector would probably not need to be moved. I don't think the resistive bolometer demos use the example equilibrium at all.

I'm in favour of having just one example equilibrium for simplicity. Even if that does require changes to some of the examples, in the long term it would be worth it.

mattngc commented 4 years ago

Ok, sounds like everyone agrees this is the right path. Does anyone in this group know Xavier particularly well and want to take up the approach?

vsnever commented 4 years ago

Ok, sounds like everyone agrees this is the right path. Does anyone in this group know Xavier particularly well and want to take up the approach?

I don't know him well, but he should be aware of the Cherab project. Also, I misspelled his last name, it's Bonnin, sorry.

mattngc commented 4 years ago

Ok, I've met him a few times before so i can email him. But if anyone knows him better I'm happy for them to take the lead on this one. I just don't want this one to hold up the others.

vsnever commented 4 years ago

In case if SOLPS-ITER team will not grant a permission to use their test simulation results in Cherab SDK, there is still an option to use the data from Andrey Pshenov's PhD thesis. The data (both the SOLPS results and the equilibrium) is for a made up tokamak and Andrey does not mind sharing it.

mattngc commented 4 years ago

Oh, thanks Vlad. That sounds like a good option actually. Can you share a link to his PhD so I can have a look?

vsnever commented 4 years ago

Oh, thanks Vlad. That sounds like a good option actually. Can you share a link to his PhD so I can have a look?

The PhD thesis is in Russian, but all major results are published in English-language journals. The thesis is about plasma detachment. I sent you a couple of his papers by email. The simulations are carried out in SOLPS 4.3 for a DIII-D-like configuration with simplified first wall and divertor geometry.

vsnever commented 4 years ago

Here is the data from Andrey Pshenov: cherab_generomak.zip. This simulation was not a part os his PhD. The plasma configuration here is close to the old (and abandoned) variant of the T-15MD. If you find this configuration too exotic, I think I can ask him for a DIII-D-like variant.

I added the Cherab License to all files as well as the info on the data provider. The archive also includes a simple script to plot the data (currently it does not read the mesh properly and uses the cell centres only). In the archive you can find a file with Psi(r, z), unfortunately this is the only equilibrium data available at the moment.

Note that Andrey advises against using data from boundary cells as they act like a guard cell and exist only for boundary conditions.

Here are some plots:

mattngc commented 4 years ago

Hi Vlad, just getting back to this sorry, been distracted by everything that's been going on...

Thanks to you and Andrey for contributing this data. The equilibrium and simulation data looks nice. The only problem I can see is that the equilibrium information available might not be sufficient to generate an EFITEquilibrium() object. I can probably get most of the needed values from the PSI map .dat file (or fit the parameters). But the f and q profiles are missing. Any ideas on how to get them easily from post-processing?

Also, @jacklovell and @Mateasek, can you comment on the suitability of this equilibrium and edge scenario for your planned tutorial cases?

vsnever commented 4 years ago

Hi Matthew, For this simulation we also have a file with the output of DINA equilibrium evolution code, which, I believe, contains both the poloidal current and safety factor profiles. The problem is that I have no experience working with DINA output, neither has Andrey. But I'll see what we can do.

jacklovell commented 4 years ago

This looks good to me. As Matt says, we'll need an EFITEquilibrium object for it, as some of the bolometry examples use radiation functions which are a function of normalised flux. But otherwise I'd be very happy to use it.

Once this is committed, we'll use the limiting surface as a basis for making a simple first wall mesh. So then the equilibrium and the machine will be consistent.

vsnever commented 4 years ago

It appears that the problem with the equilibrium solution is not in the data format but in the data consistency. Andrey told me this some time ago, but I forgot about it. The equilibrium solution is in G EQDSK format, here is the file, generomak_equilibrium.zip. The problem is that this file does not pass Bout++ check, namely Bout++ does not recognize this as a solution of Grad–Shafranov equation. A possible explanation is that for this simulation, DINA may not have written the complete output, for example, filling some parameters with zeros. So, please carefully check the data before use.

jacklovell commented 4 years ago

@vsnever Andrey's simulation would be great for a self-contained demo in the cherab-solps repository too. For that we'd need the raw b2fgmtry, b2fstate and fort.44 output files, rather than data in a custom format as is provided here. Do you have access to those files too?

vsnever commented 4 years ago

@jacklovell Unfortunately, Andrey's simulations were carried out in SOLPS 4.3, and the output to b2fgmtry and b2fstate was implemented only in SOLPS 5. SOLPS 4.3 saves the B2 output in a custom poorly documented binary file, not compatible with cherab-solps routines. However, there is a fortran program which can extract the data from that binary file. So, using this program it is technically possible to update cherab-solps with support for the SOLPS 4.3 output, but I'm not sure if anyone will ever use this feature, except for this specific data.

vsnever commented 4 years ago

Just wrote a script that reads the SOLPS4.3 mesh properly. This script can also be used to interpolate data to a regular grid. I suggest grinding the mesh in poloidal direction before triangulating for better smoothing of interpolated data.

generomak_solps4_mesh

generomak_H0_density_interpolation

Mateasek commented 2 years ago

What about adding a class for triangular mesh interpolators into the cherab core package? The evaluate method would be then implemented by children, which would apply their own specific mapping. It could be the base also for SOLPSFunction2D and SOLPSVectorFunction2D.

I think 2D triangular meshes are quite general and used in a wide range of applications, not only in SOLPS so it could go to the core.

We could then only save the vertices, triangles and triangle values for the Generomak case, which could be a little bit more efficient.

What do you think @vsnever and @jacklovell?

vsnever commented 2 years ago

For scalar data, we can use Discrete2DMesh interpolator from Raysect. However, this interpolator does not have a Vector3D version. The Vector3D version is easy to write, but it must be added to Raysect, so it will not be ready for the upcoming Cherab release. Then we just need to remap the profiles from SOLPSSimulation to triangular mesh and pickle them along with the mesh. In Cherab/core, we only need a function that creates plasma from these pickled profiles.

Mateasek commented 2 years ago

Great, thanks for linking the interpolator @vsnever . Do we actually need the vectors for any demonstration now? I think we can start with zero bulk velocities and when the interpolator is ready, we can add it. What do you think? If you agree I would resample the SOLPS data and prepare the edge plasma dataset in a form of a json file. Then I would move to the core profiles. I would like to complete the Generomak plasma , because I'm about to make examples for the coming laser and TS model and I would like to do it already as a Generomak "diagnostic".

vsnever commented 2 years ago

Do we actually need the vectors for any demonstration now? I think we can start with zero bulk velocities and when the interpolator is ready, we can add it. What do you think?

I agree, let's start with zero bulk velocities. I also have a couple of demos ready that are currently dependent on Cherab/solps because we don't have the edge plasma profiles in Cherab/core. I created a draft PR #336 to fix this issue. Didn't have time to test it yet. I'll continue to work on it tomorrow.

Mateasek commented 2 years ago

I think this can be closed after PR #337 was accepted

jacklovell commented 2 years ago

Agreed. From what I can tell, #337 implements all the original requirements of this issue.