Skip to content
Snippets Groups Projects
Commit 0ceeb469 authored by David Seus's avatar David Seus
Browse files

write out sources even when no exact solution is present. Run one patch injection example

parent 2c5b9bef
No related branches found
No related tags found
No related merge requests found
......@@ -315,8 +315,8 @@ class LDDsimulation(object):
self._init_exact_solution_expression()
self._init_DirichletBC_dictionary()
self._init_simulation_output()
if self.exact_solution and self.write2file['solutions']:
df.info(colored("writing exact solution for all time steps to xdmf files ...", "yellow"))
if self.write2file['solutions']:
df.info(colored("writing exact solutions and/or source terms for all time steps to xdmf files ...", "yellow"))
self.write_exact_solution_to_xdmf()
self._initialised = True
......@@ -903,27 +903,31 @@ class LDDsimulation(object):
for subdom_ind, subdomain in self.subdomain.items():
file = self.solution_file[subdom_ind]
for timestep in self.timesteps_to_plot:
source = dict()
if self.exact_solution:
exact_pressure = dict()
S = self.saturation[subdom_ind]
saturation_w = df.Function(subdomain.function_space["pressure"]['wetting'])
saturation_nw = df.Function(subdomain.function_space["pressure"]['wetting'])
source = dict()
for phase in subdomain.has_phases:
f_expr = subdomain.source[phase]
pa_exact = subdomain.pressure_exact[phase]
pa_exact.t = timestep
f_expr.t = timestep
exact_pressure.update(
{phase: df.project(pa_exact, subdomain.function_space["pressure"][phase])}
)
source.update(
{phase: df.project(f_expr, subdomain.function_space["pressure"][phase])}
)
exact_pressure[phase].rename("exact_pressure_"+"{}".format(phase), "exact_pressure_"+"{}".format(phase))
file.write(exact_pressure[phase], timestep)
source[phase].rename("source_"+"{}".format(phase), "source_"+"{}".format(phase))
file.write(source[phase], timestep)
if self.exact_solution:
pa_exact = subdomain.pressure_exact[phase]
pa_exact.t = timestep
exact_pressure.update(
{phase: df.project(pa_exact, subdomain.function_space["pressure"][phase])}
)
exact_pressure[phase].rename("exact_pressure_"+"{}".format(phase), "exact_pressure_"+"{}".format(phase))
file.write(exact_pressure[phase], timestep)
if self.exact_solution:
exact_capillary_pressure = df.Function(subdomain.function_space["pressure"]['wetting'])
if subdomain.isRichards:
exact_capillary_pressure.assign(-exact_pressure['wetting'])
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment