Skip to content

Commit

Permalink
Getting it to the state I wanted it to be without all the rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
markriegler committed Sep 5, 2024
1 parent bc8acf1 commit 931f4db
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 107 deletions.
22 changes: 15 additions & 7 deletions examples/iga/galerkin_laplace_problem_field_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
-\Delta u = f
with source term f=1.
First, homogeneous Dirichlet boundary conditions are applied. Then, inhomogeneous ones
are applied.
First, homogeneous Dirichlet boundary conditions are applied. Then, homogeneous
and inhomogeneous Dirichlet boundary conditions are applied on 3 of 4 boundaries.
"""

import numpy as np

import splinepy as sp

# Test Case
# Number of refinements for the solution field
n_refine = 15


Expand Down Expand Up @@ -130,18 +130,26 @@ def show_solution(geometry, solution_field):
fi.assemble_vector(poisson_rhs)

# Homogeneous Dirichlet boundary conditions
fi.assign_homogeneous_dirichlet_boundary_conditions()
fi.apply_homogeneous_dirichlet_boundary_conditions()
fi.solve_linear_system()
# Plot geometry and field
show_solution(geometry, solution_field)

# Inhomogeneous Dirichlet boundary conditions
def dirichlet_function(points):
"""
On the boundary apply: g(x,y) = x/10
On the boundary apply: g(x,y) = x/4
"""
return points[:, 0] / 10
return points[:, 0] / 4

fi.apply_dirichlet_boundary_conditions(dirichlet_function)
# Assemble again to override previous boundary conditions
fi.assemble_matrix(poisson_lhs)
fi.assemble_vector(poisson_rhs)

# Apply boundary conditions on 3 boundaries
fi.apply_homogeneous_dirichlet_boundary_conditions(west=True)
fi.apply_dirichlet_boundary_conditions(
dirichlet_function, south=True, north=True
)
fi.solve_linear_system()
show_solution(geometry, solution_field)
Loading

0 comments on commit 931f4db

Please sign in to comment.