I was tired of going to input to see the calculation of reference parameters

This commit is contained in:
Jorge Gonzalez 2026-04-14 11:42:48 +02:00
commit 43592f420c
2 changed files with 34 additions and 22 deletions

View file

@ -5,5 +5,34 @@ MODULE moduleRefParam
!Reference parameters for non-dimensional problem !Reference parameters for non-dimensional problem
REAL(8):: L_ref, v_ref, ti_ref, Vol_ref, EF_ref, Volt_ref, B_ref REAL(8):: L_ref, v_ref, ti_ref, Vol_ref, EF_ref, Volt_ref, B_ref
contains
subroutine calculateDerivedRef()
use moduleConstParam, only: pi, qe, eps_0, kb
implicit none
!Derived parameters
L_ref = DSQRT(kb*T_ref*eps_0/n_ref)/qe !reference length
v_ref = DSQRT(kb*T_ref/m_ref) !reference velocity
ti_ref = L_ref/v_ref !reference time
Vol_ref = L_ref**3 !reference volume
EF_ref = qe*n_ref*L_ref/eps_0 !reference electric field
Volt_ref = EF_ref*L_ref !reference voltage
B_ref = m_ref / (ti_ref * qe) !reference magnetic field
if (sigmaVrel_ref == 0.0d0) then
! No reference cross section provided, check radius
if (r_ref == 0.0d0) then
! No reference radius provided, use reference length
sigmaVrel_ref = L_ref**2 * v_ref
else
sigmaVrel_ref = pi*(r_ref+r_ref)**2*v_ref !reference cross section times velocity
end if
end if
end subroutine calculateDerivedRef
END MODULE moduleRefParam END MODULE moduleRefParam

View file

@ -111,7 +111,6 @@ MODULE moduleInput
!Reads the reference parameters !Reads the reference parameters
SUBROUTINE readReference(config) SUBROUTINE readReference(config)
USE moduleRefParam USE moduleRefParam
USE moduleConstParam
USE moduleErrors USE moduleErrors
USE json_module USE json_module
IMPLICIT NONE IMPLICIT NONE
@ -131,30 +130,14 @@ MODULE moduleInput
CALL config%get(object // '.temperature', T_ref, found) CALL config%get(object // '.temperature', T_ref, found)
IF (.NOT. found) CALL criticalError('Reference temperature not found','readReference') IF (.NOT. found) CALL criticalError('Reference temperature not found','readReference')
!Derived parameters ! initialize values for cross sections
L_ref = DSQRT(kb*T_ref*eps_0/n_ref)/qe !reference length sigmaVrel_ref = 0.0d0
v_ref = DSQRT(kb*T_ref/m_ref) !reference velocity r_ref = 0.0d0
ti_ref = L_ref/v_ref !reference time
Vol_ref = L_ref**3 !reference volume
EF_ref = qe*n_ref*L_ref/eps_0 !reference electric field
Volt_ref = EF_ref*L_ref !reference voltage
B_ref = m_ref / (ti_ref * qe) !reference magnetic field
!If a reference cross section is given, it is used
CALL config%get(object // '.sigmaVrel', sigmavRel_ref, found) CALL config%get(object // '.sigmaVrel', sigmavRel_ref, found)
!If not, the reference radius is searched
IF (.NOT. found) THEN
CALL config%get(object // '.radius', r_ref, found) CALL config%get(object // '.radius', r_ref, found)
IF (found) THEN
sigmaVrel_ref = PI*(r_ref+r_ref)**2*v_ref !reference cross section times velocity
ELSE call calculateDerivedRef()
sigmaVrel_ref = L_ref**2 * v_ref
END IF
END IF
END SUBROUTINE readReference END SUBROUTINE readReference