Skip to content

Commit 86acc1f

Browse files
authored
Add ability to set user controls in eos/kap inlists (#513)
Fixes #282
1 parent 777d43d commit 86acc1f

File tree

6 files changed

+89
-4
lines changed

6 files changed

+89
-4
lines changed

eos/defaults/eos.defaults

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,18 @@
315315
use_other_eos_results = .false.
316316

317317

318+
! User controls
319+
! -------------
320+
! ::
321+
322+
323+
! These are arrays of size(10) that can be used to pass in custom information to the eos
324+
eos_ctrl(:) = 0d0
325+
eos_integer_ctrl(:) = 0
326+
eos_logical_ctrl(:) = .false.
327+
eos_character_ctrl(:) = ''
328+
329+
318330
! Debugging controls
319331
! ------------------
320332
! ::

eos/private/eos_ctrls_io.f90

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ module eos_ctrls_io
137137
logical, dimension(max_extra_inlists) :: read_extra_eos_inlist
138138
character (len=strlen), dimension(max_extra_inlists) :: extra_eos_inlist_name
139139

140+
! User supplied inputs
141+
real(dp) :: eos_ctrl(10)
142+
integer :: eos_integer_ctrl(10)
143+
logical :: eos_logical_ctrl(10)
144+
character(len=strlen) :: eos_character_ctrl(10)
145+
140146

141147
namelist /eos/ &
142148
use_FreeEOS, &
@@ -252,7 +258,13 @@ module eos_ctrls_io
252258
X_lo, X_hi, &
253259
Z_lo, Z_hi, &
254260

255-
read_extra_eos_inlist, extra_eos_inlist_name
261+
read_extra_eos_inlist, extra_eos_inlist_name,&
262+
263+
! User supplied inputs
264+
eos_ctrl, &
265+
eos_integer_ctrl, &
266+
eos_logical_ctrl, &
267+
eos_character_ctrl
256268

257269

258270
contains
@@ -459,6 +471,12 @@ subroutine store_controls(rq)
459471
rq% use_other_eos_component = use_other_eos_component
460472
rq% use_other_eos_results = use_other_eos_results
461473

474+
! user inputs
475+
rq% eos_ctrl = eos_ctrl
476+
rq% eos_integer_ctrl = eos_integer_ctrl
477+
rq% eos_logical_ctrl = eos_logical_ctrl
478+
rq% eos_character_ctrl = eos_character_ctrl
479+
462480
! debugging
463481
rq% dbg = dbg
464482
rq% logT_lo = logT_lo
@@ -596,6 +614,12 @@ subroutine set_controls_for_writing(rq)
596614
use_other_eos_component = rq% use_other_eos_component
597615
use_other_eos_results = rq% use_other_eos_results
598616

617+
! user inputs
618+
eos_ctrl = rq% eos_ctrl
619+
eos_integer_ctrl = rq% eos_integer_ctrl
620+
eos_logical_ctrl = rq% eos_logical_ctrl
621+
eos_character_ctrl = rq% eos_character_ctrl
622+
599623
! debugging
600624
dbg = rq% dbg
601625
logT_lo = rq% logT_lo

eos/public/eos_def.f90

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
module eos_def
2828

29-
use const_def, only: dp, use_mesa_temp_cache
29+
use const_def, only: dp, use_mesa_temp_cache, strlen
3030
use chem_def, only: max_el_z
3131

3232
implicit none
@@ -333,6 +333,13 @@ end subroutine other_eos_interface
333333
integer :: handle
334334
logical :: in_use
335335

336+
337+
! User supplied inputs
338+
real(dp) :: eos_ctrl(10)
339+
integer :: eos_integer_ctrl(10)
340+
logical :: eos_logical_ctrl(10)
341+
character(len=strlen) :: eos_character_ctrl(10)
342+
336343
end type EoS_General_Info
337344

338345

kap/defaults/kap.defaults

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,19 @@
446446

447447
use_other_radiative_opacity = .false.
448448

449+
450+
! User controls
451+
! -------------
452+
! ::
453+
454+
455+
! These are arrays of size(10) that can be used to pass in custom information to kap
456+
kap_ctrl(:) = 0d0
457+
kap_integer_ctrl(:) = 0
458+
kap_logical_ctrl(:) = .false.
459+
kap_character_ctrl(:) = ''
460+
461+
449462
! Extra inlist controls
450463
! ---------------------
451464

kap/private/kap_ctrls_io.f90

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ module kap_ctrls_io
8888

8989
logical, dimension(max_extra_inlists) :: read_extra_kap_inlist
9090
character (len=strlen), dimension(max_extra_inlists) :: extra_kap_inlist_name
91-
91+
92+
! User supplied inputs
93+
real(dp) :: kap_ctrl(10)
94+
integer :: kap_integer_ctrl(10)
95+
logical :: kap_logical_ctrl(10)
96+
character(len=strlen) :: kap_character_ctrl(10)
9297

9398
namelist /kap/ &
9499

@@ -122,6 +127,12 @@ module kap_ctrls_io
122127
use_other_compton_opacity, &
123128
use_other_radiative_opacity, &
124129

130+
! User supplied inputs
131+
kap_ctrl, &
132+
kap_integer_ctrl, &
133+
kap_logical_ctrl, &
134+
kap_character_ctrl,&
135+
125136
read_extra_kap_inlist, extra_kap_inlist_name
126137

127138
contains
@@ -380,6 +391,12 @@ subroutine store_controls(rq, ierr)
380391
rq% use_other_compton_opacity = use_other_compton_opacity
381392
rq% use_other_radiative_opacity = use_other_radiative_opacity
382393

394+
! user inputs
395+
rq% kap_ctrl = kap_ctrl
396+
rq% kap_integer_ctrl = kap_integer_ctrl
397+
rq% kap_logical_ctrl = kap_logical_ctrl
398+
rq% kap_character_ctrl = kap_character_ctrl
399+
383400
end subroutine store_controls
384401

385402

@@ -434,6 +451,12 @@ subroutine set_controls_for_writing(rq)
434451
use_other_compton_opacity = rq% use_other_compton_opacity
435452
use_other_radiative_opacity = rq% use_other_radiative_opacity
436453

454+
! user inputs
455+
kap_ctrl = rq% kap_ctrl
456+
kap_integer_ctrl = rq% kap_integer_ctrl
457+
kap_logical_ctrl = rq% kap_logical_ctrl
458+
kap_character_ctrl = rq% kap_character_ctrl
459+
437460

438461
end subroutine set_controls_for_writing
439462

kap/public/kap_def.f90

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
! ***********************************************************************
2525

2626
module kap_def
27-
use const_def, only: dp
27+
use const_def, only: dp, strlen
2828

2929
implicit none
3030

@@ -254,6 +254,12 @@ end subroutine other_radiative_opacity_interface
254254
integer :: handle
255255
logical :: in_use
256256

257+
! User supplied inputs
258+
real(dp) :: kap_ctrl(10)
259+
integer :: kap_integer_ctrl(10)
260+
logical :: kap_logical_ctrl(10)
261+
character(len=strlen) :: kap_character_ctrl(10)
262+
257263
! other hooks
258264

259265
logical :: use_other_elect_cond_opacity

0 commit comments

Comments
 (0)