How to use the discretize.utils function in discretize

To help you get started, we’ve selected a few discretize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simpeg / simpeg / tests / em / tdem / test_TDEM_inductive_permeable.py View on Github external
prob_late_ontime.mu = mu_dict[key]
            fields_dict[key] = prob_late_ontime.fields(sigma)

            print(" ... done. Elapsed time {}".format(time.time() - t))
            print('\n')

            b_magnetostatic = {}
            b_late_ontime = {}

        for key in model_names:
            prob.mu = mu_dict[key]
            prob.sigma = sigma
            b_magnetostatic[key] = src_magnetostatic.bInitial(prob)

            prob_late_ontime.mu = mu_dict[key]
            b_late_ontime[key] = utils.mkvc(
                fields_dict[key][:, 'b', -1]
            )

        if plotIt:
            fig, ax = plt.subplots(
                len(model_names), 2, figsize=(3*len(model_names), 5)
            )

            for i, key in enumerate(model_names):
                ax[i][0].semilogy(
                    np.absolute(b_magnetostatic[key]),
                    label='magnetostatic'
                )
                ax[i][0].semilogy(
                    np.absolute(b_late_ontime[key]), label='late on-time'
                )
github simpeg / simpeg / tests / em / tdem / test_TDEM_inductive_permeable.py View on Github external
print("\n{}".format(key))
            print(
                "||magnetostatic||: {:1.2e}, "
                "||late on-time||: {:1.2e}, "
                "||difference||: {:1.2e} passed?: {}".format(
                    norm_magneotstatic, norm_late_ontime, norm_diff,
                    passed_test
                )
            )

            passed += [passed_test]

        assert all(passed)

        prob.sigma = 1e-4*np.ones(mesh.nC)
        v = utils.mkvc(np.random.rand(mesh.nE))
        w = utils.mkvc(np.random.rand(mesh.nF))
        assert(
            np.all(
                mesh.getEdgeInnerProduct(1e-4*np.ones(mesh.nC))*v ==
                prob.MeSigma*v
            )
        )

        assert(
            np.all(
                mesh.getEdgeInnerProduct(
                    1e-4*np.ones(mesh.nC), invMat=True
                )*v ==
                prob.MeSigmaI*v
            )
        )
github simpeg / simpeg / examples / 09-tdem / plot_inductive_src_permeable_target.py View on Github external
###############################################################################
# Run the long on-time simulation
# -------------------------------

t = time.time()
print('--- Running Long On-Time Simulation ---')

prob_ramp_on.mu = mu_model
fields = prob_ramp_on.fields(sigma)

print(" ... done. Elapsed time {}".format(time.time() - t))
print('\n')

# grab the last time-step in the simulation
b_ramp_on = utils.mkvc(fields[:, 'b', -1])

###############################################################################
# Compute Magnetostatic Fields from the step-off source
# -----------------------------------------------------

prob_magnetostatic.mu = mu_model
prob_magnetostatic.model = sigma
b_magnetostatic = src_magnetostatic.bInitial(prob_magnetostatic)


###############################################################################
# Plot the results
# -----------------------------------------------------

def plotBFieldResults(
    ax=None, clim_min=None, clim_max=None,