Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added nza again #141

Merged
merged 4 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/acer.f90
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ subroutine acer
! matd material to be processed
! tempd temperature desired (kelvin) (default=300)
! tname thermal zaid name ( 6 char max, def=za)
! nza number of moderator component za values (default=3, max=16)
! card 8a
! iza moderator component za values (up to a maximum of 16 values,
! must be terminated by /)
Expand Down Expand Up @@ -358,14 +359,22 @@ subroutine acer
else if (iopt.eq.2) then
tempd=300
tscr=' '
nza=16
read(nsysi,*) matd,tempd,tscr
nza=3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't like the default to be 3. While there wasn't an nza parameter previously, it was effectively defaulted to 1 as only 1 was required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to keep backwards compatible behaviour. If a user has an input like this:

    4025 296 'zrzrh' /
    40090 0 0 /

and we use nza=1 by default, then the last two zeros may be read as the next input (the mt numbers, number of bins, etc.). Setting nza by default equal to 3 solves this potential issue for old input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To provide a counter argument what if the old input is this:

4025 296 'lwtr' /
1001 /

I think providing a single ZA is more common (which is why it was the default).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we argue about this? It's a detail.

Anyway, in the case you bring up, the code will read it properly and reset nza to 1. Test 25 covers this behaviour and it passes with the current implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't realize that it would read correctly (i.e., adding two extra zeros.) If that works, then we are good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to mimic the old implementation, in which these values were stored in three different variables and in which the second and third one were defaulted to zero (and that allows a user to add two zeros on the line). It's annoying but that's what it was before.

read(nsysi,*) matd,tempd,tscr,nza
nch=0
do i=1,6
if (tscr(i:i).ne.' ') nch=i
enddo
tname=' '
if (nch.gt.0) tname(7-nch:6)=tscr(1:nch)
write(nsyso,'(&
&'' mat to be processed .................. '',i10/&
&'' temperature .......................... '',1p,e10.3/&
&'' thermal name ......................... '',4x,a6)')&
matd,tempd,tname
if (nza.lt.1.or.nza.gt.16) then
call error('acer','between 1 and 16 za value must be given.',' ')
endif
do i=1,nza
izn(i)=0
enddo
Expand All @@ -377,17 +386,9 @@ subroutine acer
endif
enddo
write(nsyso,'(&
&'' mat to be processed .................. '',i10/&
&'' temperature .......................... '',1p,e10.3/&
&'' thermal name ......................... '',4x,a6/&
&'' number moderator component za values . '',i10)')&
matd,tempd,tname,nza
write(nsyso,'(&
&'' number moderator component za values . '',i10/&
&'' iza ................................ '',i10/&
&(40x,i10))') (izn(i),i=1,nza)
if (nza.eq.zero) then
call error('acer','at least one za value must be given.',' ')
endif
&(40x,i10))') nza,(izn(i),i=1,nza)
do i=1,nza
if (izn(i).le.zero) then
call error('acer','found invalid za numbers in izn.',' ')
Expand Down
3 changes: 1 addition & 2 deletions src/vers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module version
! These values are updated during the NJOY revision-control process.
implicit none
private
character(8),public::vers='2016.52'
character(8),public::vers='2016.53'
character(8),public::vday='02Nov19'
end module version

2 changes: 1 addition & 1 deletion tests/49/input
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ acer
-31 -25 0 71 61
2 0 1 .80/
'Zr in ZrH at 296k ' /
4025 296 'zrzrh' /
4025 296 'zrzrh' 6 /
40090 40091 40092 40094 40096 /
227 80 228 0 1 1.00022 2/
stop