Esempio n. 1
0
    def do_plot(self, input_file, num_refinements, cli_args, figure, label, mpi=1):

        cli_args = " ".join(cli_args + self.function_args)

        df = mms.run_spatial(input_file,
                             num_refinements,
                             cli_args,
                             x_pp='h',
                             y_pp=['L2u', 'L2lambda'],
                             mpi=mpi)
        figure.plot(df,
                    label=['u_' + label, 'lm_' + label],
                    num_fitted_points=3,
                    slope_precision=1,
                    marker='o')
Esempio n. 2
0
    def test(self):
        df1 = mms.run_spatial('2d-rc.i', 6, y_pp=['L2u', 'L2v', 'L2p'], mpi=16)

        fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                                  ylabel='$L_2$ Error')
        fig.plot(df1,
                 label=['L2u', 'L2v', 'L2p'],
                 marker='o',
                 markersize=8,
                 num_fitted_points=3,
                 slope_precision=1)
        fig.save('rc-2d.png')
        for key, value in fig.label_to_slope.items():
            print("%s, %f" % (key, value))
            self.assertTrue(fuzzyAbsoluteEqual(value, 2., .15))
    def test(self):
        df1 = mms.run_spatial('steady-adapt.i', 8, "--error", mpi=8)

        fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                                  ylabel='$L_2$ Error')
        fig.plot(df1,
                 label='steady-adapt',
                 marker='o',
                 markersize=8,
                 num_fitted_points=3,
                 slope_precision=1)
        fig.save('steady-adapt.png')

        for key, value in fig.label_to_slope.items():
            print("%s slope, %f" % (key, value))
            self.assertTrue(fuzzyEqual(value, 1., .05))
Esempio n. 4
0
 def test(self):
     df1 = mms.run_spatial('advection-outflow.i', 7, y_pp=['L2u', 'L2v'])
     fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                               ylabel='$L_2$ Error')
     fig.plot(df1,
              label=['L2u', 'L2v'],
              marker='o',
              markersize=8,
              num_fitted_points=3,
              slope_precision=1)
     fig.save('outflow.png')
     for label, value in fig.label_to_slope.items():
         if label == 'L2u':
             self.assertTrue(fuzzyAbsoluteEqual(value, 1., .05))
         else:
             self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
Esempio n. 5
0
 def test(self):
     df1 = mms.run_spatial('limited-advection.i',
                           9,
                           "FVKernels/advection_u/limiter='vanLeer'",
                           y_pp=['L2u'])
     fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                               ylabel='$L_2$ Error')
     fig.plot(df1,
              label=['L2u'],
              marker='o',
              markersize=8,
              num_fitted_points=3,
              slope_precision=1)
     fig.save('vanLeer-limiter.png')
     for label, value in fig.label_to_slope.items():
         self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
Esempio n. 6
0
 def test(self):
     df1 = mms.run_spatial(
         'kt-limited-advection.i',
         11,
         "FVKernels/advection_u/limiter='central_difference'",
         y_pp=['L2u'])
     fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                               ylabel='$L_2$ Error')
     fig.plot(df1,
              label=['L2u'],
              marker='o',
              markersize=8,
              num_fitted_points=3,
              slope_precision=1)
     fig.save('kt-cd-limiter.png')
     for key, value in fig.label_to_slope.items():
         self.assertTrue(fuzzyAbsoluteEqual(value, 2., .05))
         print("%s slope, %f" % (key, value))
Esempio n. 7
0
    def test(self):
        df1 = mms.run_spatial('skewed.i',
                              5,
                              'Variables/v/face_interp_method=average',
                              mpi=1)

        fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                                  ylabel='$L_2$ Error')
        fig.plot(df1,
                 label='average',
                 marker='o',
                 markersize=8,
                 num_fitted_points=3,
                 slope_precision=1)
        fig.save('average.png')

        for _, value in fig.label_to_slope.items():
            self.assertTrue(fuzzyEqual(value, 1., .15))
Esempio n. 8
0
    def test(self):
        df1 = mms.run_spatial(
            'skewed.i',
            5,
            'Variables/v/face_interp_method=skewness-corrected FVKernels/advection/advected_interp_method=skewness-corrected',
            mpi=1)

        fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                                  ylabel='$L_2$ Error')
        fig.plot(df1,
                 label='corrected-advection',
                 marker='o',
                 markersize=8,
                 num_fitted_points=3,
                 slope_precision=1)
        fig.save('corrected-advection.png')

        for _, value in fig.label_to_slope.items():
            self.assertTrue(fuzzyEqual(value, 2.0, .1))
Esempio n. 9
0
    def test(self):
        labels = ['L2u', 'L2v', 'L2p']
        df1 = mms.run_spatial('plane-poiseuille-flow.i',
                              7,
                              "velocity_interp_method='rc'",
                              y_pp=labels,
                              mpi=16)

        fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                                  ylabel='$L_2$ Error')
        fig.plot(df1,
                 label=labels,
                 marker='o',
                 markersize=8,
                 num_fitted_points=3,
                 slope_precision=1)
        fig.save('plane-poiseuille-rc.png')
        for key, value in fig.label_to_slope.items():
            print("%s, %f" % (key, value))
            self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
Esempio n. 10
0
    def test(self):
        labels = ['L2u', 'L2v', 'L2p']
        df1 = mms.run_spatial('plane-poiseuille-flow.i',
                              7,
                              "velocity_interp_method='average'",
                              'two_term_boundary_expansion=false',
                              y_pp=labels,
                              mpi=16)

        fig = mms.ConvergencePlot(xlabel='Element Size ($h$)',
                                  ylabel='$L_2$ Error')
        fig.plot(df1,
                 label=labels,
                 marker='o',
                 markersize=8,
                 num_fitted_points=3,
                 slope_precision=1)
        fig.save('plane-poiseuille-average-first.png')
        for key, value in fig.label_to_slope.items():
            if key == 'L2p':
                self.assertTrue(fuzzyAbsoluteEqual(value, 1., .1))
            else:
                self.assertTrue(fuzzyAbsoluteEqual(value, 2., .1))
Esempio n. 11
0
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html

import mms
df1 = mms.run_spatial('ex14.i', 4, executable='./ex14-opt')
df2 = mms.run_spatial('ex14.i',
                      4,
                      'Mesh/second_order=true',
                      'Variables/forced/order=SECOND',
                      executable='./ex14-opt')

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='1st Order', marker='o', markersize=8)
fig.plot(df2, label='2nd Order', marker='o', markersize=8)
fig.save('ex14_mms.png')
Esempio n. 12
0
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html

import mms
df1 = mms.run_spatial(
    '3d_mes.i',
    3,
    executable=
    '/home/alexander/Development/moose_projects/hammerhead/hammerhead-opt',
    file_base='3d_strip_out_{}')

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='1st Order', marker='o', markersize=8)
fig.save('bean_mms.png')
Esempio n. 13
0
#!/usr/bin/env python3
#* This file is part of MOOSETOOLS repository
#* https://www.github.com/idaholab/moosetools
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moosetools/blob/main/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html

import mms

df1 = mms.run_spatial('mms_spatial.i',
                      4,
                      console=False,
                      executable='../../../test')
df2 = mms.run_spatial('mms_spatial.i',
                      4,
                      'Mesh/second_order=true',
                      'Variables/u/order=SECOND',
                      console=False,
                      executable='../../../test')

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='1st Order', marker='o', markersize=8)
fig.plot(df2, label='2nd Order', marker='o', markersize=8)
fig.save('mms_spatial.png')

#TESTING (leave this comment, it is used in doco to remove the following from a demo)
df1.to_csv('mms_spatial_first.csv')
df2.to_csv('mms_spatial_second.csv')
Esempio n. 14
0
#!/usr/bin/env python3

import mms

df1 = mms.run_spatial('cartesian.i', 7)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
         label='cartesian',
         marker='o',
         markersize=8,
         num_fitted_points=3,
         slope_precision=1)
fig.save('cartesian.png')
Esempio n. 15
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('advection-diffusion.i', 7)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
         label='adv-diff',
         marker='o',
         markersize=8,
         num_fitted_points=3,
         slope_precision=1)
fig.save('advection-diffusion.png')
Esempio n. 16
0
#!/usr/bin/env python3

# MooseDocs:start:spatial
import mms

df = mms.run_spatial('1d_analytical.i', 6, 'Mesh/gen/nx=10', console=False)
fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df, label='1st Order', marker='o', markersize=8)
fig.save('1d_analytical_spatial.png')
# MooseDocs:end:spatial

# MooseDocs:start:temporal
import mms

df = mms.run_temporal('1d_analytical.i', 6, dt=0.5, console=False)
fig = mms.ConvergencePlot(xlabel='$\Delta t$', ylabel='$L_2$ Error')
fig.plot(df, label='2nd Order (Backward Difference)', marker='o', markersize=8)
fig.save('1d_analytical_temporal.png')
# MooseDocs:end:temporal
Esempio n. 17
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('advection-diffusion-flux-bcs.i', 7)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
         label='adv-diff-flux-bcs',
         marker='o',
         markersize=8,
         num_fitted_points=3,
         slope_precision=1)
fig.save('advection-diffusion-flux-bcs.png')
Esempio n. 18
0
#!/usr/bin/env python
import mms
df1 = mms.run_spatial('mms_spatial.i', 4, console=False)
df2 = mms.run_spatial('mms_spatial.i', 4, 'Mesh/second_order=true', 'Variables/u/order=SECOND', console=False)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='1st Order', marker='o', markersize=8)
fig.plot(df2, label='2nd Order', marker='o', markersize=8)
fig.save('mms_spatial.png')

#TESTING (leave this comment, it is used in doco to remove the following from a demo)
df1.to_csv('mms_spatial_first.csv')
df2.to_csv('mms_spatial_second.csv')
Esempio n. 19
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('diffusion.i', 7)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
         label='diff',
         marker='o',
         markersize=8,
         num_fitted_points=3,
         slope_precision=1)
fig.save('diffusion.png')
Esempio n. 20
0
#!/usr/bin/env python3

# MooseDocs:start:spatial
import mms

df1 = mms.run_spatial(['2d_main.i', '2d_mms_spatial.i'], 4, console=False)
df2 = mms.run_spatial(['2d_main.i', '2d_mms_spatial.i'],
                      4,
                      'Mesh/second_order=true',
                      'Variables/T/order=SECOND',
                      console=False)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='1st Order', marker='o', markersize=8)
fig.plot(df2, label='2nd Order', marker='o', markersize=8)
fig.save('2d_mms_spatial.png')
# MooseDocs:end:spatial

# MooseDocs:start:temporal
import mms

df1 = mms.run_temporal(['2d_main.i', '2d_mms_temporal.i'],
                       4,
                       dt=1200,
                       mpi=4,
                       console=False)
df2 = mms.run_temporal(['2d_main.i', '2d_mms_temporal.i'],
                       4,
                       'Executioner/scheme=bdf2',
                       dt=1200,
                       mpi=4,
Esempio n. 21
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('rz.i', 7)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='rz', marker='o', markersize=8, num_fitted_points=3, slope_precision=1)
fig.save('rz.png')
Esempio n. 22
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('advection.i', 7)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
         label='adv',
         marker='o',
         markersize=8,
         num_fitted_points=3,
         slope_precision=1)
fig.save('advection.png')
Esempio n. 23
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('extended-cartesian.i', 7, mpi=2)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='extended-cartesian', marker='o', markersize=8, num_fitted_points=3, slope_precision=1)
fig.save('extended-cartesian.png')
Esempio n. 24
0
#!/usr/bin/env python
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html

import mms
df1 = mms.run_spatial('mms_spatial.i', 4, console=False)
df2 = mms.run_spatial('mms_spatial.i', 4, 'Mesh/second_order=true', 'Variables/u/order=SECOND', console=False)

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label='1st Order', marker='o', markersize=8)
fig.plot(df2, label='2nd Order', marker='o', markersize=8)
fig.save('mms_spatial.png')

#TESTING (leave this comment, it is used in doco to remove the following from a demo)
df1.to_csv('mms_spatial_first.csv')
df2.to_csv('mms_spatial_second.csv')
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('advection-diffusion.i', 7,
                      "GlobalParams/advected_interp_method='upwind'")

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1,
         label='upwind-adv-diff',
         marker='o',
         markersize=8,
         num_fitted_points=3,
         slope_precision=1)
fig.save('upwind-advection-diffusion.png')
Esempio n. 26
0
#!/usr/bin/env python3

import mms
df1 = mms.run_spatial('input.i', 7, y_pp=['l2_rho', 'l2_vel'])

fig = mms.ConvergencePlot(xlabel='Element Size ($h$)', ylabel='$L_2$ Error')
fig.plot(df1, label=['rho', 'vel'], marker='o', markersize=8, num_fitted_points=3, slope_precision=1)
fig.save('mass-mom-mat-advection-diffusion.png')