Skip to content

Commit 931f4db

Browse files
committed
Getting it to the state I wanted it to be without all the rebase issues
1 parent bc8acf1 commit 931f4db

File tree

3 files changed

+229
-107
lines changed

3 files changed

+229
-107
lines changed

examples/iga/galerkin_laplace_problem_field_integrator.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
-\Delta u = f
66
with source term f=1.
77
8-
First, homogeneous Dirichlet boundary conditions are applied. Then, inhomogeneous ones
9-
are applied.
8+
First, homogeneous Dirichlet boundary conditions are applied. Then, homogeneous
9+
and inhomogeneous Dirichlet boundary conditions are applied on 3 of 4 boundaries.
1010
"""
1111

1212
import numpy as np
1313

1414
import splinepy as sp
1515

16-
# Test Case
16+
# Number of refinements for the solution field
1717
n_refine = 15
1818

1919

@@ -130,18 +130,26 @@ def show_solution(geometry, solution_field):
130130
fi.assemble_vector(poisson_rhs)
131131

132132
# Homogeneous Dirichlet boundary conditions
133-
fi.assign_homogeneous_dirichlet_boundary_conditions()
133+
fi.apply_homogeneous_dirichlet_boundary_conditions()
134134
fi.solve_linear_system()
135135
# Plot geometry and field
136136
show_solution(geometry, solution_field)
137137

138138
# Inhomogeneous Dirichlet boundary conditions
139139
def dirichlet_function(points):
140140
"""
141-
On the boundary apply: g(x,y) = x/10
141+
On the boundary apply: g(x,y) = x/4
142142
"""
143-
return points[:, 0] / 10
143+
return points[:, 0] / 4
144144

145-
fi.apply_dirichlet_boundary_conditions(dirichlet_function)
145+
# Assemble again to override previous boundary conditions
146+
fi.assemble_matrix(poisson_lhs)
147+
fi.assemble_vector(poisson_rhs)
148+
149+
# Apply boundary conditions on 3 boundaries
150+
fi.apply_homogeneous_dirichlet_boundary_conditions(west=True)
151+
fi.apply_dirichlet_boundary_conditions(
152+
dirichlet_function, south=True, north=True
153+
)
146154
fi.solve_linear_system()
147155
show_solution(geometry, solution_field)

0 commit comments

Comments
 (0)