Skip to content

Commit

Permalink
Adding is_interactive and updating bc definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
julesghub committed Jul 16, 2024
1 parent 26e821b commit d274505
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@
# os.environ["SYMPY_USE_CACHE"]="no"

# options.getAll()
# +
import meshio

# -
meshball = uw.meshing.Annulus(
radiusOuter=1.0, radiusInner=0.5, cellSize=0.2, refinement=1, qdegree=3
)
x, y = meshball.X
# -


v_soln = uw.discretisation.MeshVariable("U", meshball, meshball.dim, degree=2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.15.2
# jupytext_version: 1.16.2
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
Expand All @@ -20,10 +20,6 @@
# ## Generic scalar solver class


# to fix trame issue
import nest_asyncio
nest_asyncio.apply()

# +
from petsc4py import PETSc

Expand All @@ -37,8 +33,6 @@
import numpy as np
import sympy

from IPython.display import display


# +
mesh1 = uw.meshing.UnstructuredSimplexBox(
Expand Down Expand Up @@ -127,8 +121,10 @@

# Validate

if uw.mpi.size == 1:

if uw.is_interactive_vis:
# to fix trame issue
import nest_asyncio
nest_asyncio.apply()
import pyvista as pv
import underworld3.visualisation as vis

Expand Down Expand Up @@ -189,8 +185,11 @@

# Visual validation

if uw.mpi.size == 1:

if uw.is_interactive_vis:
# to fix trame issue
import nest_asyncio
nest_asyncio.apply()

import pyvista as pv
import underworld3.visualisation as vis

Expand Down Expand Up @@ -227,12 +226,12 @@

abs_r2 = x**2 + y**2
poisson.f = -16 * abs_r2
poisson.add_dirichlet_bc(abs_r2, "Bottom", components=0)
poisson.add_dirichlet_bc(abs_r2, "Top", components=0)
poisson.add_dirichlet_bc(abs_r2, "Right", components=0)
poisson.add_dirichlet_bc(abs_r2, "Left", components=0)
poisson.add_dirichlet_bc([abs_r2], "Bottom")
poisson.add_dirichlet_bc([abs_r2], "Top")
poisson.add_dirichlet_bc([abs_r2], "Right")
poisson.add_dirichlet_bc([abs_r2], "Left")

display(poisson.f)
poisson.f

# Constitutive law (diffusivity)
# Linear solver first
Expand Down Expand Up @@ -262,7 +261,10 @@

# Validate

if uw.mpi.size == 1:
if uw.is_interactive_vis:
# to fix trame issue
import nest_asyncio
nest_asyncio.apply()

import pyvista as pv
import underworld3.visualisation as vis
Expand All @@ -276,7 +278,7 @@
pvmesh2,
cmap="coolwarm",
edge_color="Black",
show_edges=True,
show_edges=False,
scalars="T",
use_transparency=False,
opacity=0.5,
Expand Down Expand Up @@ -314,7 +316,10 @@

# Validate

if uw.mpi.size == 1:
if uw.is_interactive_vis:
# to fix trame issue
import nest_asyncio
nest_asyncio.apply()

import pyvista as pv
import underworld3.visualisation as vis
Expand Down

0 comments on commit d274505

Please sign in to comment.