4
4
import numpy as np
5
5
import csv
6
6
from mpi4py import MPI
7
+ from pathlib import Path
7
8
8
- outfolder = 'output'
9
+ outfolder = Path ( __file__ ). parent / 'output'
9
10
10
11
default_dt = 1.0 # time step size
11
12
@@ -26,7 +27,7 @@ def inside(self, x, on_boundary):
26
27
27
28
# Initialize preCICE
28
29
precice = fenicsprecice .Adapter (
29
- adapter_config_filename = "chemical-reaction-advection-diffusion.json" )
30
+ adapter_config_filename = Path ( __file__ ). parent / "chemical-reaction-advection-diffusion.json" )
30
31
precice .initialize (coupling_subdomain = CouplingDomain (), read_function_space = W )
31
32
precice_dt = precice .get_max_time_step_size ()
32
33
@@ -78,16 +79,16 @@ def inside(self, x, on_boundary):
78
79
79
80
80
81
t = 0
81
- vtkfileA = File (outfolder + '/ chemical_A.pvd' )
82
- vtkfileB = File (outfolder + '/ chemical_B.pvd' )
83
- vtkfileC = File (outfolder + '/ chemical_C.pvd' )
84
- vtkfileFlow = File (outfolder + '/ chemical_fluid_read.pvd' )
82
+ vtkfileA = File (str ( outfolder / ' chemical_A.pvd') )
83
+ vtkfileB = File (str ( outfolder / ' chemical_B.pvd') )
84
+ vtkfileC = File (str ( outfolder / ' chemical_C.pvd') )
85
+ vtkfileFlow = File (str ( outfolder / ' chemical_fluid_read.pvd') )
85
86
86
87
# CSV file to keep track of integrals (i.e. total amount of A, B, C)
87
- # with open(outfolder + '/ chemical_out.csv', 'w', newline='') as csvfile:
88
+ # with open(outfolder / ' chemical_out.csv', 'w', newline='') as csvfile:
88
89
89
90
if MPI .COMM_WORLD .rank == 0 :
90
- csvfile = open (outfolder + '/ chemical_out.csv' , 'w' , newline = '' )
91
+ csvfile = open (outfolder / ' chemical_out.csv' , 'w' , newline = '' )
91
92
writer = csv .writer (csvfile , delimiter = ' ' , quotechar = '|' ,
92
93
quoting = csv .QUOTE_MINIMAL )
93
94
0 commit comments