Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d8d762e9 authored by PETIT Manuel's avatar PETIT Manuel
Browse files

Merge remote-tracking branch 'origin/hotfix/gbvp-write-solution' into develop

parents e6d2e3e3 58190b82
No related branches found
No related tags found
No related merge requests found
Pipeline #1104604 passed with warnings
...@@ -114,9 +114,12 @@ class GBVP(BVP): ...@@ -114,9 +114,12 @@ class GBVP(BVP):
self.set_time(tmin) self.set_time(tmin)
self.growth_scheme.dt = dt self.growth_scheme.dt = dt
current_solution = self.solution.copy(deepcopy=True)
current_growth = self.growth_scheme.get_growth().copy(deepcopy=True)
if store_steps: if store_steps:
self.solution_steps[self.time.current] = self.solution.copy(deepcopy=True) self.solution_steps[self.time.current] = current_solution
self.growth_steps[self.time.current] = self.growth_scheme.get_growth() self.growth_steps[self.time.current] = current_growth
if filename is not None: if filename is not None:
with fe.HDF5File(MPI_COMM_WORLD, filename, 'w') as file: with fe.HDF5File(MPI_COMM_WORLD, filename, 'w') as file:
...@@ -124,8 +127,8 @@ class GBVP(BVP): ...@@ -124,8 +127,8 @@ class GBVP(BVP):
#file.write(self.domain.cdata, "cell_labels") #file.write(self.domain.cdata, "cell_labels")
#file.write(self.domain.bdata, "boundary_labels") #file.write(self.domain.bdata, "boundary_labels")
file.write(self.solution, f'solution_t{self.time.current}') file.write(current_solution, f'solution_t{self.time.current}')
file.write(self.growth_steps[self.time.current], f'growth_t{self.time.current}') file.write(current_growth, f'growth_t{self.time.current}')
# Add parameters related to the domain : sub_domain / sub_boundary # Add parameters related to the domain : sub_domain / sub_boundary
# if MPI_COMM_WORLD.rank == 0: # h5py does not support parallal mode, use only the main process # if MPI_COMM_WORLD.rank == 0: # h5py does not support parallal mode, use only the main process
...@@ -146,14 +149,17 @@ class GBVP(BVP): ...@@ -146,14 +149,17 @@ class GBVP(BVP):
while tmax - self.time.current >= dt: while tmax - self.time.current >= dt:
self.step(dt, **kwargs) self.step(dt, **kwargs)
current_solution = self.solution.copy(deepcopy=True)
current_growth = self.growth_scheme.get_growth().copy(deepcopy=True)
if store_steps: if store_steps:
self.solution_steps[self.time.current] = self.solution.copy(deepcopy=True) self.solution_steps[self.time.current] = current_solution
self.growth_steps[self.time.current] = self.growth_scheme.get_growth().copy(deepcopy=True) self.growth_steps[self.time.current] = current_growth
if filename is not None: if filename is not None:
with fe.HDF5File(MPI_COMM_WORLD, filename, 'a') as file: with fe.HDF5File(MPI_COMM_WORLD, filename, 'a') as file:
file.write(self.solution, f'solution_t{self.time.current}') file.write(current_solution, f'solution_t{self.time.current}')
file.write(self.growth_steps[self.time.current], f'growth_t{self.time.current}') file.write(current_growth, f'growth_t{self.time.current}')
self._progressbar.update(self.time.current) self._progressbar.update(self.time.current)
self._progressbar.show() self._progressbar.show()
......
...@@ -35,7 +35,7 @@ class TestGBVP(unittest.TestCase): ...@@ -35,7 +35,7 @@ class TestGBVP(unittest.TestCase):
def test_run_with_file(self): def test_run_with_file(self):
gbvp = GBVP(self.domain, self.vform, self.bc, growth_scheme=self.growth_scheme) gbvp = GBVP(self.domain, self.vform, self.bc, growth_scheme=self.growth_scheme)
gbvp.info() gbvp.info()
gbvp.run(0, 0.4, 0.2, filename=self.dir.name+'/solution.xdmf', linear_solver='mumps') gbvp.run(0, 0.4, 0.2, filename=self.dir.name+'/solution.h5', linear_solver='mumps')
def test_run_without_file(self): def test_run_without_file(self):
ibvp = GBVP(self.domain, self.vform, self.bc, growth_scheme=self.growth_scheme) ibvp = GBVP(self.domain, self.vform, self.bc, growth_scheme=self.growth_scheme)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment