Skip to content

Commit

Permalink
Use DG1 for stress and use CG1 when reading back p
Browse files Browse the repository at this point in the history
  • Loading branch information
finsberg committed Feb 12, 2024
1 parent f469bf4 commit 939240a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
21 changes: 3 additions & 18 deletions code/create_paraview_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def main(filename, min_value, max_value, name, label, blocknr, figure_folder):
extractBlock.Selectors = [f"/Root/Block{blocknr}"]

# show data in view
extractBlockDisplay = Show(extractBlock, renderView1, "UnstructuredGridRepresentation")
extractBlockDisplay = Show(
extractBlock, renderView1, "UnstructuredGridRepresentation"
)

# get color transfer function/color map for 'sigma_xx'
sigma_xxLUT = GetColorTransferFunction(name)
Expand Down Expand Up @@ -360,20 +362,3 @@ def main(filename, min_value, max_value, name, label, blocknr, figure_folder):
blocknr=int(args.blocknr),
figure_folder=args.figure_folder,
)

# main(
# filename="/Users/finsberg/local/src/cardiac-cancer/code/results4/cylinder_fine_varying_incomp/spring3000.0/results.xdmf",
# min_value=0.0,
# max_value=3.0,
# name=name,
# label="$\\sigma_{xx}$",
# )

# main(
# filename="/Users/finsberg/local/src/cardiac-cancer/code/results4/cylinder_fine_incomp/spring3000.0/results.xdmf",
# min_value=0.0,
# max_value=3.0,
# name="sigma_r",
# label="$\\sigma_{xx}$",
# blocknr=1,
# )
2 changes: 1 addition & 1 deletion code/lv.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def main(output_folder, mesh_folder: Path = Path("meshes/lv")):

geo = get_lv_geometry(mesh_folder=mesh_folder)

V_DG2 = dolfin.FunctionSpace(geo.mesh, "DG", 2)
V_DG2 = dolfin.FunctionSpace(geo.mesh, "DG", 1)
proj = utils.Projector(V_DG2)
sigma_ff = dolfin.Function(V_DG2)
sigma_ss = dolfin.Function(V_DG2)
Expand Down
7 changes: 5 additions & 2 deletions code/postprocess_lv.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def value_shape(self):
def load_lv_arrs(data_path, output, gammas, pressures, mesh_folder: Path = Path("meshes/lv")):
print("Loading LV arrays")
geo = get_lv_geometry(mesh_folder=mesh_folder)
V_DG2 = dolfin.FunctionSpace(geo.mesh, "DG", 2)
V_DG2 = dolfin.FunctionSpace(geo.mesh, "DG", 1)
V_CG1 = dolfin.FunctionSpace(geo.mesh, "CG", 1)

f = dolfin.Function(V_DG2)
f_ = dolfin.Function(V_DG2)
p = dolfin.Function(V_CG1)

data = []
with dolfin.XDMFFile(output.as_posix()) as xdmf:
Expand All @@ -53,6 +55,7 @@ def load_lv_arrs(data_path, output, gammas, pressures, mesh_folder: Path = Path(
"E_nn",
"p",
]:
f = p if name == "p" else f_
xdmf.read_checkpoint(f, name, ti)
f_arr = f.vector().get_local()

Expand Down

0 comments on commit 939240a

Please sign in to comment.