Esempio n. 1
0
 def setUp(self):
     self.obj = mcnp_n2p.ModMCNPforPhotons(testfile, dagmc=False)
     self.obj.read()
     #self.obj.change_block_1()
     #self.obj.change_block_2()
     #self.obj.change_block_3()
     self.obj.convert()
Esempio n. 2
0
    def test_dag_consistent(self):
        """Tests that resulting file is identical to expected resulting file.
        """

        self.obj = mcnp_n2p.ModMCNPforPhotons(dag_testfile)
        self.obj.read()
        self.obj.convert()
        self.obj.write_deck(auto_testfile_out)
        fw1 = open(auto_testfile_out, 'r')
        fw2 = open(dag_testfile_compare, 'r')

        for result, reference in itertools.izip_longest(fw1, fw2):
            self.assertEqual(result, reference)

        fw1.close()
        fw2.close()
Esempio n. 3
0
def gen_mcnp_p(mesh, mcnp_p_problem, mcnp_n_problem, opt_phtnfmesh):
    """Create photon MCNP input file from neutron input if it doesn't exist
    already

    Parameters
    ----------
    mesh : ScdMesh object or iMesh.Mesh object
        Structured mesh object
    mcnp_p_problem : string
        Path to MCNP input for photon transport
    mcnp_n_problem : string
        Path to MCNP input for neutron transport
    opt_phtnfmesh : boolean
        If true, append an FMESH card for photons that matches the mesh layout
        of the structured mesh object being used
    """
    if mcnp_p_problem:

        if os.path.exists(mcnp_p_problem):
            print "MCNP photon transport input file '{0}' already exists " \
                    "and will not be recreated.".format(mcnp_p_problem)

        else:
            print "Modifying MCNP input file '{0}'".format(mcnp_n_problem)

            mod = mcnp_n2p.ModMCNPforPhotons(mcnp_n_problem)
            mod.read()
            mod.convert()

            # If phtnfmesh is True, we generate an fmesh card with same 
            #  layout as found on the scdmesh.
            if opt_phtnfmesh and isinstance(mesh, ScdMesh):
                mod.add_fmesh_from_scdmesh(mesh)

            mod.write_deck(mcnp_p_problem)

    return
Esempio n. 4
0
 def setUp(self):
     self.obj = mcnp_n2p.ModMCNPforPhotons(dag_testfile, dagmc=True)
     self.obj.read()
     # change only block 3
     self.obj.convert()
Esempio n. 5
0
 def test_dag_input_run(self):
     self.obj = mcnp_n2p.ModMCNPforPhotons(dag_testfile)
     self.obj.read()
     self.obj.convert()
Esempio n. 6
0
 def test_is_dag(self):
     """Tests _is_dagmc()"""
     self.obj = mcnp_n2p.ModMCNPforPhotons(dag_testfile)
     self.assertEqual(self.obj.dagmc, True)