Skip to content

tendl and fendl download scripts added - #1

Merged
paulromano merged 8 commits into
openmc-dev:masterfrom
shimwell:master
Feb 13, 2019
Merged

paulromano merged 8 commits into
openmc-dev:masterfrom
shimwell:master

Conversation

@shimwell

Copy link
Copy Markdown
Member

Hi all,

Here is a pull request for some scripts that ease the downloading of FENDL and TENDL nuclear data libraries for your consideration.

The scripts are based on the existing OpenMC scripts for downloading JEFF and NNDC data. These two evaluations are of particular interest for fusion simulations as the ITER reactor requests FENDL data is used and the transmutation we expect in fusion reactors requires a library like TENDL with lots of isotopes when simulating burn-up.

Eventually I would like to add options for different releases, file formats (ENDF or ACE) and further nuclear data libraries such as CENDL and JENDL.

Comment thread convert_fendl.py Resolved
Comment thread convert_fendl.py Resolved
Comment thread convert_fendl.py Resolved
Comment thread convert_tendl.py Resolved
@paulromano

Copy link
Copy Markdown
Contributor

@shimwell When I try to run the FENDL script, I'm getting an exception about certificate verification:

Traceback (most recent call last):
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/http/client.py", line 1392, in connect
    server_hostname=server_hostname)
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/ssl.py", line 412, in wrap_socket
    session=session
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/ssl.py", line 850, in _create
    self.do_handshake()
  File "/home/romano/.pyenv/versions/3.7.0/lib/python3.7/ssl.py", line 1108, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)

Did you not run into this?

@shimwell

Copy link
Copy Markdown
Member Author

screenshot from 2019-02-11 20-30-50

@shimwell

Copy link
Copy Markdown
Member Author

Yep I have run the scripts with the different options but I thought the ssl, user agent and headers fixed that error. Not sure what is happening there but it looks like different python 3 behave differently for different ssl installs

# The fendl website requires the web browser to be mocked
ssl._create_default_https_context = ssl._create_unverified_context
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
headers = {'User-Agent': user_agent, }

@paulromano

Copy link
Copy Markdown
Contributor

The following seems to work for me (without having to set headers):

urlopen(url, context=ssl._create_unverified_context())

@shimwell

Copy link
Copy Markdown
Member Author

Your suggestion worked for me as well :-)

@shimwell

Copy link
Copy Markdown
Member Author

I put in a tiny PR (#1163) for the openmc _utils script so that context can be specified when using the download function

@paulromano

Copy link
Copy Markdown
Contributor

With the change (and the PR to OpenMC), both scripts worked for me so I'll go ahead and merge. If you want to make further changes, feel free to send another PR!

@paulromano
paulromano merged commit c0b8797 into openmc-dev:master Feb 13, 2019
paulromano pushed a commit that referenced this pull request Feb 17, 2020
Standardise arguments in convert/generate scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants