Skip to content

KPEC - #15

Merged
logan-nc merged 48 commits into
developfrom
kpec
Mar 15, 2016
Merged

KPEC#15
logan-nc merged 48 commits into
developfrom
kpec

Conversation

@logan-nc

Copy link
Copy Markdown
Contributor

This will be the big merge of the kinetic developments (actually going from IPEC to GPEC) and the continued IPEC developments such as the reluctance and other mode filtering.

Jong-Kyu Park and others added 30 commits June 12, 2015 18:36
… in addition to weighted normal field spectrum.
Added phi key word argument to enable toroidal cutouts when converting complex (r,z) data to (x,y,z) surfaces.
This subroutine forms 12 complex splines representing the kinetic contribution sto the ABCDEH euler-lagrange matrices from the torque (atmm, btmm, etc) and from the kinetic energy (awmm, bwmm, etc.) resonant operators.

Three methods are currently available:
1) Explicit loop over psi, should be identical to current use of pentrc tpsi function.
2) PENTRC's built in spline integration that (nominally) does the same thing.
3) PENTRC's built in dynamic integration, which forms equivilant splines on the dynamic grid.

The two operator results are kept seperate because the dynamic method may find different grids appropriate for the different resonances.
All are now in draw dir. The only conflict was drawline, for which the original draw directoy file was kept and the input one removed.
kingridtype=-1 now reproduces the hybrid kinetic-MHD fourfit_make_matrix
calculation, while 0,1,2 call fourfit_kinetic_matrix and use those splines
in make_matrix.

..note:: All methods still use the hybrid matrices on eqgrid in sing.f!
…e resonant operator for complementing the existing *kmm use of the imaginary part.

Debugging and compacting of Euler-Lagrange matrix splices.

Compacting of main program calls for each flag.

Added to_upper function to utilities.
Debuging and addition of methods in fourfit_kinetic_matrix.
 - All methods now officialy run and confirmed to work as expected
*** List of changes ***

*** Note there are still issues in passing kinetic matrices

Conflicts:
	dcon/fourfit.f
Clean, standardized calls for each method embedded into single do loop.

Read iputs before distributing local variables to modules.
Uses cspline_copy to distribute splines from PENTRC to DCON that get
formed multiple times in multiple calls of PENTRC.
1) EL matrices were being cumaltively summed in all integration methods. They are now allocated and zeroed in the integrand function called by all methods.
2) The lsode method had an indexing bug that did not properly distribute the matrices to the splines. Simple typo fix.
(1) passing_flag: turn on/off passing partice effects.
(2) ktanh_flag: turn on/off kinetic effects in the core.
…The method has been used in the previous testing version of gpec (gpec_0.95) and shown the most reliable and feasible answers.

It takes place through fkg_kmats_flag, when kingridtype=0. The difference occurs by adding fluid and kinetic ABCDEH matrices and casting FKG matrices into splines, whereas the individual fluid and kinetic ABCDEH matrices are casted into splines if this flag is off.

See fourfit.f and sing.f for main changes.

The goal is to compare and understand the small differences in the results for kingridtype=0 when this flag is on and off, and ultimately to go for adaptive kinetic grids.
…s with fkg_kmats_flag, kingridtype=0 and kingridtype=3 methods.

 - It was found that kinetic matrices were all almost identical except very minor differences for g matrix.
 - There is no simplification in g matrix.
 - There is no singularity in g matrix, but it was found g matrix has very steep variations at the core and edge, due to fluid h matrix.
 - The critical element is to spline fluid h matrix by mitigating the steep behavior, using hmats%xpower(2,:)=-1 with hmats%x0(2)=1.

Finally an oscillation in the very edge, possibly due to spurious singularity, could be eliminated without fkg_kmats_flag.

This is a draft version. In the next version, diagnostic routines will be added to provide more details, and fkg_kmats_flag will be promoted to kingridtype=0 and other methods to kingridtype=1-4.
Jong-Kyu Park and others added 18 commits October 9, 2015 20:24
…=0 (default), and other advanced methods by kingridtype=1-4.

- With kin_flag, kin_sing subroutines will search kinetic singular surfaces and kin_cross will jump across them continuously when con_flag is on. The new singular surface finder works perfectly for ideal cases as well.
- It writes  kwmats.out and ktmats.out (rather than kss and ksa) and also imats.out for ideal matrices for comparison.
- Next this kinetic dcon will be integrated into gpec to provide systematic scans and diagnostics.
… that dcon stores xi derivative and xss through ode_output.f, which allows IPEC and PENTRC to calculate dB and torque without recalculating kinetic matrices.

This is still a tentative version. Next eigen-decomposition will be replaced by SVD-decomposition, in order to have orthonormal basis for non-Hermitian response matrix.
…pec and pentrc programs rather than reading them from inputs.
…d by IPEC run using energy and torque response matrices.

- Use dw_flag and look for ipec_dw_n#.out file. It can be directly compared with pentrc_fgar_n#.out file.
- They are consistent with each other, but ipec_dw_n# profiles is not as smooth as pentrc_fgar_n#.out profiles yet. This must be corrected for the next version.
- Also the full energy and torque response matrices as a function of psi will be calculated for the next.
 - ipec_dw_ratio_eigen_n#.out is an example, giving the maximum possible torque within psi when total torque is fixed to unity.
 - This version is testing various optimization and not yet standardized.
…automatically optimized or set for an input parameter in the future.
(1) mast coils are added.
(2) equilibrium tolerance can be controlled by etol parameter in equil.in
(3) electron contributions can be included by electron_flag in dcon.in
…an KSTAR example.

- Routines for torque and coil response are still under testing through ipec_dw and ipec_dw_matrix subroutines.
- See ipec_dw_matrix for coil coupling example.
- Note also the changes in coil.f for coil coupling calculations.
…into kpec_develop

# Conflicts:
#	dcon/dcon.f
#	dcon/free.f
#	dcon/makefile_LinuxLahey
#	dcon/ode_output.f
#	input/dcon.in
#	input/ipec.in
#	input/pentrc.in
#	ipec/idcon.f
#	ipec/ipec.f
#	ipec/ipeq.f
#	ipec/ipglobal.f
#	ipec/ipout.f
#	ipec/ipresp.f
#	makefile
#	pentrc/dcon_interface.f
#	pentrc/inputs.f90
#	pentrc/pentrc.f90
#	pentrc/torque.f90
#	pypec/data.py
$ module load lff95 lapack-blas netcdf
$ module load gcc4 lapack-blas netcdf
Still having problems with portal_intel, which doesn't like writting internal variables using the namelist format... which seems weird.
Note this does not have the same detailed options aas idcon... why?
…er.bin. Various cleaning of inversions and eigenvalue decompositions of non-hermitian response matrices.
Conflicts:
	dcon/free.f
@logan-nc logan-nc self-assigned this Mar 15, 2016
@logan-nc

Copy link
Copy Markdown
Contributor Author

I just made this pull request to document the progress in merging these branches.

First, I made a kpec_develop branch from kpec and merged in develop. I did all the actual de-bugging in a protected environment of that devoted branch. After a few attempts, I have what I believe is good agreement between the basic code outputs.

The DCON energies agree well,

image

As does the first eigenmode,

image

Note, that the merged result agrees with the KPEC result where there are slight differences with the development brnach. This is because the merged result contains the changes to the equilibrium matrix splitting and splining made in KPEC. See, for example, the same eigenmode on a log scale,

image

@logan-nc

Copy link
Copy Markdown
Contributor Author

After some debugging, IPEC results also compare nicely between KPEC and the merged branch. The control surface fields agree,

image

As to the fundamental matrices like the permeability,

image

@logan-nc

Copy link
Copy Markdown
Contributor Author

Note, all these figures were produced using the docs/examples/DIIID_example case. Runs are at /p/gpec/users/nlogan/validation/201602_kpec_merge on portal.

@parkjk

parkjk commented Mar 15, 2016

Copy link
Copy Markdown
Contributor

Hi Nik,

Very nice! I am stuck in core science group meeting now..I would like to
try to pull it over to my area and test it soon.

Jong-Kyu

On Tue, Mar 15, 2016 at 1:46 PM, Nikolas Logan notifications@github.com
wrote:

Note, all these figures were produced using the
docs/examples/DIIID_example case. Runs are at
/p/gpec/users/nlogan/validation/201602_kpec_merge on portal.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#15 (comment)

@logan-nc

Copy link
Copy Markdown
Contributor Author

Glad you like it @parkjk ! I am just about to merge it into develop. Then I think we will be back down to the one main branch.

I will give it another day or two so we can both check it out before making an official 0.4.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants