Commit 7cd3f9a8 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts

hydro-quebec : vtk output

parent b309e23e
......@@ -40,10 +40,9 @@ def genInitialPosition(p, N, rmin, rmax, L, H, rhop) :
p.addParticle((x[i], y[i]), R[i], R[i]**2 * np.pi * rhop)
return p
r = 0.013
dr = 0.003
meshBoundary = True
N = 8000
r = 0.013*2
dr = 0.003*2
N = 2000
genInitialPosition(p, N = N, rmin = r -dr, rmax = r + dr , L = 2, H = 1.5, rhop=2)
p.useJacobi(False)
loadMeshBoundary(p, "mesh.msh", ["Box"])
......
......@@ -72,7 +72,7 @@ while t < tEnd :
if ii %outf == 0 :
ioutput = int(ii/outf)
writep(p, outputdir, ioutput)
hydro.writeMsh(outputdir, ioutput)
hydro.writeSolution(outputdir, ioutput, t, filetype="msh")
ii += 1
print("%.2g/%.2g" % (t, tEnd))
......
......@@ -78,12 +78,20 @@ class hydro :
#add hydrostatic pressure
forces[:,:] = -(gradp + self.g * self.rho) * volume
def writeMsh(self, odir, oiter) :
self.groups.exportFunctionMsh(self.law.pressure, "%s/f_%05i" % (odir, oiter), 0., oiter, "pressure", self.sol)
self.groups.exportFunctionMsh(self.law.velocity, "%s/f_%05i" % (odir, oiter), 0., oiter, "velocity", self.sol)
self.groups.exportFunctionMsh(self.porosity.getFunction(), "%s/f_%05i" % (odir, oiter), 0., oiter, "porosity", self.sol)
self.groups.exportFunctionMsh(function.getCoordinates(), "%s/f_%05i" % (odir, oiter), 0., oiter, "xmesh")
self.groups.exportFunctionMsh(self.totalVelocityF, "%s/f_%05i" % (odir, oiter), 0., oiter, "totalVelocity")
self.groups.exportFunctionMsh(self.totalVelocityF, "%s/f_%05i" % (odir, oiter), 0., oiter, "totalVelocity")
self.groups.exportFunctionMsh(self.vmeshf, "%s/f_%05i" % (odir, oiter), 0., oiter, "meshVelocity")
def writeSolution(self, odir, oiter, time, filetype="msh") :
print(oiter, time)
if filetype == "msh" :
basename = "%s/f_%05i" % (odir, oiter)
exportfun = self.groups.exportFunctionMsh
elif filetype == "vtk" :
exportfun = self.groups.exportFunctionVtk
basename = odir+"/f"
else :
print("unknown export format : \"%s\"." % filetype)
return
exportfun(self.law.pressure, basename, time, oiter, "pressure", self.sol)
exportfun(self.law.velocity, basename, time, oiter, "velocity", self.sol)
exportfun(self.porosity.getFunction(), basename, time, oiter, "porosity", self.sol)
exportfun(function.getCoordinates(), basename, time, oiter, "xmesh")
exportfun(self.totalVelocityF, basename, time, oiter, "totalVelocity")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment