Skip to content

Commit

Permalink
Merge pull request #60 from ORNL-Fusion/variables
Browse files Browse the repository at this point in the history
Variables
  • Loading branch information
cianciosa authored Nov 21, 2024
2 parents 8c2ba8c + 00ebac8 commit 3b06790
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci_doxygen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build Documentation
on:
workflow_dispatch:
push:
branches:
- 'master'
jobs:
ci_doxygen:
if: ${{github.ref_name}} == 'master'
runs-on: ubuntu-latest
steps:
- name: Clone Repo
shell: bash
working-directory: ${{runner.workspace}}
run: |
git clone https://github.com/ORNL-Fusion/Stellarator-Tools.git ${{runner.workspace}}/Stellarator-Tools
git clone https://token:${{secrets.AUTH_TOKEN}}@github.com/ORNL-Fusion/Stellarator-Tools-Docs.git
- name: Create build directory.
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools
run: cmake -E make_directory build
- name: Install Libraries Linux
shell: bash
run: |
sudo apt update
sudo apt-get install libnetcdf-dev
sudo apt-get install libnetcdff-dev
sudo apt-get install libopenmpi-dev
sudo apt-get install libscalapack-openmpi-dev
sudo apt-get install doxygen
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: cmake -DBUILD_BOOZ_XFORM=ON -DBUILD_V3FIT=ON -DBUILD_V3RFUN=ON -DBUILD_SIESTA=ON -DBUILD_LGRID=ON -DBUILD_SURFACE=ON -DBUILD_BMW=ON -DBUILD_PARVMEC=ON -DBUILD_DESCUR=ON -DDOXYGEN_OUTPUT_DIRECTORY=${{runner.workspace}}/Stellarator-Tools-Docs -DDOXYGEN_HTML_OUTPUT=docs ../
- name: Build
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools/build
run: make doc
- name: Push changes.
shell: bash
working-directory: ${{runner.workspace}}/Stellarator-Tools-Docs/docs
env:
GITHUB_TOKEN: ${{secrets.AUTH_TOKEN}}
run: |
git config user.name ${{secrets.AUTH_USER}}
git config user.email ${{secrets.AUTH_EMAIL}}
git add *
git commit . -m "Update Doxygen docs."
git push origin main
32 changes: 32 additions & 0 deletions Sources/General/bcovar.f
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
!-------------------------------------------------------------------------------
!> @brief Compute the covariant magnetic field.
!>
!> The contravariant magnetic field are defined as.
!>
!> B^u = 1/sqrt(g)(χ' - φ'/dv) (1)
!>
!> B^v = 1/sqrt(g)(φ' + φ'/du) (2)
!>
!> This can be converted to covariant components using the metric tensors.
!>
!> g_uu = dr/du*dr/du + dz/du*dz/du (3)
!>
!> g_uv = dr/du*dr/dv + dz/du*dz/dv (4)
!>
!> g_uu = dr/dv*dr/dv + R^2 + dz/dv*dz/dv (5)
!>
!> The covariant magnetic field are
!>
!> B_u = guu*B^u + guv*B^v (6)
!>
!> B_v = guv*B^u + gvv*B^v (7)
!>
!> On exit the parameter lu contains the quantity.
!>
!> P = R(p + |B^2|/(2μ0))
!>
!> @param[inout] lu Poloidal derivative of lambda.
!> @param[inout] lv Toroidal derivative of lambda.
!> @param[in] tpxc
!> @param[inout] ier_flag Error status.
!-------------------------------------------------------------------------------
SUBROUTINE bcovar_par(lu, lv, tpxc, ier_flag)
USE vmec_main, fpsi => bvco, p5 => cp5
USE vmec_params, ONLY: ns4, signgs, pdamp, lamscale, ntmax,
Expand Down
9 changes: 8 additions & 1 deletion Sources/General/forces.f
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
!-------------------------------------------------------------------------------
!> @brief Compute variation in the forces.
!>
!> The variation in the forces is defined as:
!>
!> d/ds(dZ/du)
!-------------------------------------------------------------------------------
SUBROUTINE forces_par
USE vmec_main, p5 => cp5
USE realspace
Expand Down Expand Up @@ -40,7 +47,7 @@ SUBROUTINE forces_par
DO l = nsmin, nsmax
guus(:,l) = pguu(:,l)*pshalf(:,l)
guvs(:,l) = pguv(:,l)*pshalf(:,l)
gvvs(:,l) = pgvv(:,l)* pshalf(:,l)
gvvs(:,l) = pgvv(:,l)*pshalf(:,l)

parmn_e(:,l) = ohs*zu12(:,l)*lu_e(:,l)
pazmn_e(:,l) =-ohs*ru12(:,l)*lu_e(:,l)
Expand Down
18 changes: 15 additions & 3 deletions Sources/General/jacobian.f
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
!-------------------------------------------------------------------------------
!> @brief Compute quantities need to compute the jacobian.
!>
!> The jacobian is defined by:
!>
!> sqrt(g) = R(dZ/ds*dR/du - dR/ds*dZ/du)
!>
!> Radial derivatives naturally fall on the half mesh so these quantities
!> become half mesh values.
!-------------------------------------------------------------------------------
SUBROUTINE jacobian_par
USE vmec_input, ONLY: nzeta
USE vmec_main, ONLY: ohs, nrzt, irst, nznt, iter2
Expand Down Expand Up @@ -31,9 +41,11 @@ SUBROUTINE jacobian_par
irst = 1

DO i = nsmin, nsmax
! drdu on the half mesh.
pru12(:,i) = p5*(pru(:,i,meven) + pru(:,i-1,meven) +
& pshalf(:,i)*(pru(:,i,modd) +
& pru(:,i-1,modd)))
! dzds on the half mesh.
pzs(:,i) = ohs*(pz1(:,i,meven) - pz1(:,i-1,meven) +
& pshalf(:,i)*(pz1(:,i,modd) -
& pz1(:,i-1,modd)))
Expand All @@ -43,15 +55,15 @@ SUBROUTINE jacobian_par
& (pru(:,i,meven)*pz1(:,i,modd) +
& pru(:,i-1,meven)*pz1(:,i-1,modd)) /
& pshalf(:,i))
END DO

DO i = nsmin, nsmax
! dzdu on the half mesh.
pzu12(:,i) = p5*(pzu(:,i,meven) + pzu(:,i-1,meven) +
& pshalf(:,i)*(pzu(:,i,modd) +
& pzu(:,i-1,modd)))
! drds on the half mesh.
prs(:,i) = ohs*(pr1(:,i,meven) - pr1(:,i-1,meven) +
& pshalf(:,i)*(pr1(:,i,modd) -
& pr1(:,i-1,modd)))
! R on the half mesh.
pr12(:,i) = p5*(pr1(:,i,meven) + pr1(:,i-1,meven) +
& pshalf(:,i)*(pr1(:,i,modd) +
& pr1(:,i-1,modd)))
Expand Down
8 changes: 4 additions & 4 deletions Sources/General/totzsp_mod.f
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ MODULE totzsp_mod
!> @param[out] zv1 Real space dZ/dv.
!> @param[out] lu1 Real space dlambda/du.
!> @param[out] lv1 Real space dlambda/dv.
!> @param[out] rcn1 Unknown R quantity.
!> @param[out] zcn1 Unknown Z quantity.
!> @param[out] rcn1 Constraint on R.
!> @param[out] zcn1 Constraint on Z.
!> @param[out] ier_flag Status of the transform. Takes the value of
!> @ref r01_bad_value_flag if rmnc(0,1) is zero.
!>
Expand Down Expand Up @@ -277,8 +277,8 @@ END SUBROUTINE totzsps_par
!> @param[out] zv1 Real space dZ/dv.
!> @param[out] lu1 Real space dlambda/du.
!> @param[out] lv1 Real space dlambda/dv.
!> @param[out] rcn1 Unknown R quantity.
!> @param[out] zcn1 Unknown Z quantity.
!> @param[out] rcn1 Constraint on R.
!> @param[out] zcn1 Constraint on Z.
!> @param[out] ier_flag Status of the transform. Takes the value of
!> @ref r01_bad_value_flag if rmnc(0,1) is zero.
!>
Expand Down

0 comments on commit 3b06790

Please sign in to comment.