Skip to content

Commit

Permalink
apply interpolation only over upper_cells if upper_cells is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
eyoung55 committed Feb 17, 2024
1 parent f6c8ff7 commit 04c1915
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 5 additions & 2 deletions pvade/fluid/FlowManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def build_boundary_conditions(self, domain, params):
"""

self.bcu, self.inflow_profile, self.inflow_velocity = (
self.bcu, self.inflow_profile, self.inflow_velocity, self.upper_cells = (
build_velocity_boundary_conditions(domain, params, self.V, current_time=0.0)
)

Expand Down Expand Up @@ -517,7 +517,10 @@ def solve(self, domain, params, current_time):

if params.fluid.time_varying_inflow_bc:
self.inflow_velocity.current_time = current_time
self.inflow_profile.interpolate(self.inflow_velocity)
if self.upper_cells is not None:
self.inflow_profile.interpolate(self.inflow_velocity, self.upper_cells)
else:
self.inflow_profile.interpolate(self.inflow_velocity)

if self.first_call_to_solver:
if self.rank == 0:
Expand Down
8 changes: 5 additions & 3 deletions pvade/fluid/boundary_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def get_inflow_profile_function(domain, params, functionspace, current_time):

inflow_velocity = InflowVelocity(geom_dim, params, current_time)

upper_cells = None

if params.general.geometry_module in ["cylinder3d", "cylinder2d", "flag2d"]:
inflow_function.interpolate(inflow_velocity)

Expand Down Expand Up @@ -241,7 +243,7 @@ def get_inflow_profile_function(domain, params, functionspace, current_time):

inflow_function.interpolate(inflow_velocity, upper_cells)

return inflow_function, inflow_velocity
return inflow_function, inflow_velocity, upper_cells


def build_velocity_boundary_conditions(domain, params, functionspace, current_time):
Expand Down Expand Up @@ -280,7 +282,7 @@ def build_velocity_boundary_conditions(domain, params, functionspace, current_ti
bcu.append(bc)

# Set the inflow boundary condition
inflow_function, inflow_velocity = get_inflow_profile_function(
inflow_function, inflow_velocity, upper_cells = get_inflow_profile_function(
domain, params, functionspace, current_time
)
dofs = get_facet_dofs_by_gmsh_tag(domain, functionspace, "x_min")
Expand Down Expand Up @@ -322,7 +324,7 @@ def build_velocity_boundary_conditions(domain, params, functionspace, current_ti
bc = build_vel_bc_by_type("noslip", domain, functionspace, location)
bcu.append(bc)

return bcu, inflow_function, inflow_velocity
return bcu, inflow_function, inflow_velocity, upper_cells


def build_pressure_boundary_conditions(domain, params, functionspace):
Expand Down

0 comments on commit 04c1915

Please # to comment.