sum_fluid_mass = 0 theor_fluid_mass = 0 sum_disp = 0 domain_area = 1.0 # # phi = params.p['Parameter']["phi"] rho = params.p['Parameter']["rho"] qi = params.p['Parameter']["qi"] dt = params.p['Parameter']["dt"] tf = params.p['Parameter']["tf"] # #p_sol = Darcy(mesh) for Mf, Uf, p, f, t, sig in fprob.step(): [poro.write_file(f1[i], Uf[i], 'uf{}'.format(i), t) for i in range(N)] poro.write_file(f2, Mf, 'mf', t) poro.write_file(f3, p[0], 'p', t) #[poro.write_file(f3[i], p[i], 'p{}'.format(i), t) for i in range(N)] poro.write_file(f4, f, 'Psi', t) poro.write_file(f5, sig, 'sig', t) #sig = project(sig,FS) #return sig #psi = project(psi, FS_M) #File("psi.pvd") << psi sum_fluid_mass += df.assemble(Mf * dx) # No calculation of theor fluid with qi since qi=0 since only using source term #theor_fluid_mass += qi*rho*dt #sig = project(sig, FS_M) #return sig
# In this instance the key 'parameter' is looked up. # phi = params.p['Parameter']["phi"] rho = params.p['Parameter']["rho"] qi = params.p['Parameter']["qi"] dt = params.p['Parameter']["dt"] tf = params.p['Parameter']["tf"] # # Calculating the solution for the Hyperelastic_Cube using the exact same mesh(object) # as used in the simulation. u = Hyperelastic_Cube(mesh) for Mf, Uf, p, Us, t in pprob.solve(): dU, L = Us.split(True) [poro.write_file(f1[i], Uf[i], 'uf{}'.format(i), t) for i in range(N)] poro.write_file(f2, Mf, 'mf', t) [poro.write_file(f3[i], p[i], 'p{}'.format(i), t) for i in range(N)] poro.write_file(f4, dU, 'du', t) # Commented out below is the option for creating a ParaView readable file to visualize the difference # between the solution of the two approaches over the surface of the cube. # The error values over the elememts of the mesh is expected to vary and cause error in the magnitude # of up to 3e-3. This observation is due to the difference in the calculation of the solution for the solid. # In addition to the constitutive law, the PoroelasticProblem applies the Lagrange multiplier # subjecting the constitutive law to the constraint evoked by the influence of the fluid mass divergence, # density of the fluid and in sum the difference of the fluid influence in each compartment # changing the determinante J. # This difference in calculation leads to the error observed.
def set_xdmf_parameters(f): f.parameters['flush_output'] = True f.parameters['functions_share_mesh'] = True f.parameters['rewrite_function_mesh'] = False # Files for output f1 = df.XDMFFile(comm, '../data/demo_unitcube/uf.xdmf') f2 = df.XDMFFile(comm, '../data/demo_unitcube/mf.xdmf') f3 = df.XDMFFile(comm, '../data/demo_unitcube/p.xdmf') f4 = df.XDMFFile(comm, '../data/demo_unitcube/du.xdmf') set_xdmf_parameters(f1) set_xdmf_parameters(f2) set_xdmf_parameters(f3) set_xdmf_parameters(f4) for Mf, Uf, p, Us, t in pprob.solve(): dU, L = Us.split() poro.write_file(f1, Uf, 'uf', t) poro.write_file(f2, Mf, 'mf', t) poro.write_file(f3, p, 'p', t) poro.write_file(f4, dU, 'du', t) f1.close() f2.close() f3.close() f4.close()