Developer Guide#
These pages contain development guidelines and useful resources for developing GVEC.
Contact#
GVEC is mainly being developed in the department of Numerical Methods in Plasma Physics (NMPP) led by Prof. Eric Sonnendruecker at the Max Planck Institute for Plasma Physics in Garching, Germany. Outside contributions are of course very welcome!
Development Workflow#
main repository on MPCDF-GitLab: Issues, Merge Requests, CI-Pipelines
requires a MPCDF account, contact the maintainers to obtain a guest account
mirror repository on GitHub for visibility and public contributions
prefer merging over rebasing
automatic testing of all pushes to GitLab, add tests for new features
use feature branches, merge to
developearly and often (at least in theory)use GitLab merge requests to document the changes and code review
mainpoints to the latest release / tagreleases (with corresponding tags) are created within GitLab
associate milestones with the releases to document progress
tags/releases (mostly) follow semantic versioning
use pre-commit hooks (python formatting, notebook cleaning, etc.)
pip install pre-commit&pre-commit install
Repository structure#
src/- the main fortran sourcespyproject.toml- configuration for thegvecpython packagepython/gvec/- thegvecpython package (pyGVEC) with bindings to fortranpython/examples/- example notebooks and configurationspython/kind_map.py&python/class_names.py- auxiliary files for the python bindings with f90wrapCMakeLists.txt,CMakePresets.json,cmake/- configuration of CMakeCI_setup/- scripts to load modules for different clusters & CI runnerstest-CI/- testcases and test logic usingpytest.gitlab-ci.yml&CI_templates- configuration of the GitLab CI Pipelines (see <dev/pipeline>)docs/&.readthedocs.yaml- configuration and static content for the documentation, built with sphinx and ford.gitignore- file patterns to be ignored by git.mailmap- cleaning git authors forgit blametemplate/- a structural template for fortran sourcestools/
Object-Oriented Programming in FORTRAN#
Here is a recommendation for a tutorial on how to program in an object-oriented way with polymorphism in fortran.
Useful VSCode extensions#
Modern Fortran
CMake Tools
Git Graph
GitLab Workflow
GitLens (Premium/Students)
GitHub Copilot (AI, Premium/Students)
Codeium (AI)
Jupyter
MyST-Markdown
Python
Pylance
Ruff (Python Linter & Formatter)
Todo Tree
Vim
YAML
netCDF Preview
Contents#
Developer Guide
API
- gvec.core.state
StateState.bind()State.compute()State.evaluate()State.evaluate_base_list_rtz_all()State.evaluate_base_list_tz()State.evaluate_base_list_tz_all()State.evaluate_base_tens()State.evaluate_base_tens_all()State.evaluate_boozer_list_tz_all()State.evaluate_hmap()State.evaluate_hmap_only()State.evaluate_jac_h_derivs()State.evaluate_metric_derivs()State.evaluate_profile()State.evaluate_rho2_profile()State.evaluate_sfl()State.get_boozer()State.get_boozer_angles()State.get_integration_points()State.get_mn_max()State.new()State.nfpState.rundirState.stdoutState.unbind()
find_state()find_states()load_state()
- gvec.core.run
- gvec.core.compute
- gvec.quantities
B()B_contra_t_B()B_contra_z_B()B_theta_avg()B_zeta_avg()F()F_r_avg()I_pol()I_tor()J()Jac()Jac_B()Jac_P()Jac_derivs()Jac_h()Jac_h_derivs()LA()N_FP()Phi()Phi_edge()V()W_MHD()X1()X2()chi()dB()dNU_B_dt()dNU_B_dz()dPhi_dr()dPhi_drr()dV_dPhi_n()dV_dPhi_n2()dchi_dr()dchi_drr()diota_dr()diota_drr()dp_dr()dp_drr()e_rho()e_theta()e_theta_B()e_zeta()e_zeta_B()g_rr()g_rt()g_rz()g_tt()g_tz()g_zz()gamma()grad_rho()grad_theta()grad_theta_P()grad_zeta()hmap()iota()iota_0()iota_avg()iota_curr()iota_curr_0()metric()minor_major_radius()mu0()p()shear()theta_P()xyz()
- gvec.fourier
- gvec.surface
- gvec.util
CaseInsensitiveDictadapt_parameter_file()axis_from_boundary()bspl2gvec()chdir()flatten_parameters()flip_parameters_theta()flip_parameters_zeta()logging_setup()parameters_from_vmec()read_parameter_file_ini()read_parameters()stack_parameters()stringify_mn_parameters()unstringify_mn_parameters()write_parameter_file_ini()write_parameters()
- gvec.vtk
- gvec.scripts.main
- gvec.scripts.run
- gvec.scripts.cas3d
- gvec.scripts.quasr
check_args()convert_quasr()cut_surf()eval_curve()eval_distance_to_curve()eval_distance_to_plane()find_zeta_cuts()get_B()get_X0_N_B()get_json_from_quasr()get_surface_from_json_file()get_xyz_cut()get_xyz_from_surface()load_xyz()main()minimal_modes()real_dft_mat()save_xyz()write_Gframe_ncfile()
- gvec.lib
Modgvec_Py_BindingModgvec_Py_RunModgvec_Py_StateModgvec_Py_State.evaluate_base_list_stz_all()Modgvec_Py_State.evaluate_base_list_tz()Modgvec_Py_State.evaluate_base_list_tz_all()Modgvec_Py_State.evaluate_base_tens()Modgvec_Py_State.evaluate_base_tens_all()Modgvec_Py_State.evaluate_boozer_list_tz_all()Modgvec_Py_State.evaluate_hmap()Modgvec_Py_State.evaluate_hmap_only()Modgvec_Py_State.evaluate_hmap_only_pw()Modgvec_Py_State.evaluate_hmap_pw()Modgvec_Py_State.evaluate_jac_h_derivs()Modgvec_Py_State.evaluate_jac_h_derivs_pw()Modgvec_Py_State.evaluate_metric_derivs()Modgvec_Py_State.evaluate_profile()Modgvec_Py_State.evaluate_rho2_profile()Modgvec_Py_State.finalize()Modgvec_Py_State.get_boozer()Modgvec_Py_State.get_integration_points()Modgvec_Py_State.get_integration_points_num()Modgvec_Py_State.get_mn_ip()Modgvec_Py_State.get_mn_max()Modgvec_Py_State.get_modes()Modgvec_Py_State.get_s_ip()Modgvec_Py_State.get_s_nbase()Modgvec_Py_State.init()Modgvec_Py_State.init_boozer()Modgvec_Py_State.initializedModgvec_Py_State.initsolution()Modgvec_Py_State.nfpModgvec_Py_State.readstate()
Modgvec_Sfl_BoozerModgvec_Sfl_Boozer.t_sfl_boozerModgvec_Sfl_Boozer.t_sfl_boozer.find_angles()Modgvec_Sfl_Boozer.t_sfl_boozer.find_angles_irho()Modgvec_Sfl_Boozer.t_sfl_boozer.free()Modgvec_Sfl_Boozer.t_sfl_boozer.initializedModgvec_Sfl_Boozer.t_sfl_boozer.iotaModgvec_Sfl_Boozer.t_sfl_boozer.lambda_Modgvec_Sfl_Boozer.t_sfl_boozer.nrhoModgvec_Sfl_Boozer.t_sfl_boozer.nuModgvec_Sfl_Boozer.t_sfl_boozer.phiprimeModgvec_Sfl_Boozer.t_sfl_boozer.relambdaModgvec_Sfl_Boozer.t_sfl_boozer.rho_pos