Skip to content

Commit

Permalink
Additional function definition statement towards re-usability
Browse files Browse the repository at this point in the history
  • Loading branch information
amartinhuertas committed Sep 2, 2024
1 parent d9c8e35 commit f0389cb
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions bulk_ghost_penalty_canvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ bb_to_ref_bb_agg_cells=lazy_map(Reindex(bb_to_ref_bb),agg_cells_to_aggregate)
ref_agg_cell_to_ref_bb_map=
lazy_map(Broadcasting(),bb_to_ref_bb_agg_cells,ref_agg_cell_to_agg_cell_map)


# Compute LHS of L2 projection
degree=2*(order+1)
dΩagg_cells = Measure(Ωagg_cells,degree)
Expand All @@ -214,20 +213,6 @@ Ubb=TrialFESpace(Vbb)
ubb=get_trial_fe_basis(Ubb)
vbb=get_fe_basis(Vbb)

# Change domain of vbb (test) from Ωbb to Ωagg_cells
vbb_Ωagg_cells=change_domain_bb_to_agg_cells(vbb,
ref_agg_cell_to_ref_bb_map,
Ωagg_cells,
agg_cells_to_aggregate)
# Change domain of ubb (trial) from Ωbb to Ωagg_cells
ubb_Ωagg_cells=change_domain_bb_to_agg_cells(ubb,
ref_agg_cell_to_ref_bb_map,
Ωagg_cells,
agg_cells_to_aggregate)

# Compute contributions to LHS of L2 projection
agg_cells_to_lhs_contribs=get_array((vbb_Ωagg_cells*ubb_Ωagg_cells)dΩagg_cells)

aggregate_to_local_cells=copy(aggregate_to_cells)
current_local_cell=1
for (i,cells) in enumerate(aggregate_to_local_cells)
Expand All @@ -237,10 +222,40 @@ for (i,cells) in enumerate(aggregate_to_local_cells)
end
end

function set_up_bulk_ghost_penalty_lhs(aggregates_bounding_box_model,
agg_cells_to_aggregate,
ref_agg_cell_to_ref_bb_map,
dΩagg_cells,
ubb,
vbb)
Ωagg_cells=dΩagg_cells.quad.trian

# Change domain of vbb (test) from Ωbb to Ωagg_cells
vbb_Ωagg_cells=change_domain_bb_to_agg_cells(vbb,
ref_agg_cell_to_ref_bb_map,
Ωagg_cells,
agg_cells_to_aggregate)

# Change domain of ubb (trial) from Ωbb to Ωagg_cells
ubb_Ωagg_cells=change_domain_bb_to_agg_cells(ubb,
ref_agg_cell_to_ref_bb_map,
Ωagg_cells,
agg_cells_to_aggregate)

# Compute contributions to LHS of L2 projection
agg_cells_to_lhs_contribs=get_array((vbb_Ωagg_cells*ubb_Ωagg_cells)dΩagg_cells)

# Finally assemble LHS contributions
ass_lhs_map=BulkGhostPenaltyAssembleLhsMap(agg_cells_to_lhs_contribs)
lazy_map(ass_lhs_map,aggregate_to_local_cells)
end

# Finally assemble LHS contributions
ass_lhs_map=BulkGhostPenaltyAssembleLhsMap(agg_cells_to_lhs_contribs)
lhs=lazy_map(ass_lhs_map,aggregate_to_local_cells)
lhs=set_up_bulk_ghost_penalty_lhs(aggregates_bounding_box_model,
agg_cells_to_aggregate,
ref_agg_cell_to_ref_bb_map,
dΩagg_cells,
ubb,
vbb)

# Compute contributions to the RHS of the L2 projection
du = get_trial_fe_basis(Ustd)
Expand Down

0 comments on commit f0389cb

Please sign in to comment.