Mod: salome: multicore computation + export
This commit is contained in:
parent
fa04aece32
commit
c6d13d28c0
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
__pycache__
|
__pycache__
|
||||||
|
build/
|
||||||
|
logs/
|
||||||
|
0
doc/report.tex
Normal file
0
doc/report.tex
Normal file
0
doc/title.tex
Normal file
0
doc/title.tex
Normal file
@ -2,20 +2,44 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
path = os.getcwd()
|
src = os.getcwd()
|
||||||
cube = os.path.join(path, "cube/main.py")
|
build = os.path.join(src, "../build")
|
||||||
|
|
||||||
|
if not os.path.exists(build):
|
||||||
|
os.makedirs(build)
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
alpha = [0.1, 0.15, 0.2]
|
alpha = [0.1, 0.15, 0.2]
|
||||||
|
|
||||||
|
simpleCubic = os.path.join(src, "simple-cubic/main.py")
|
||||||
|
# Body-centered cubic
|
||||||
|
#bcCubic = os.path.join(path, "bc-cubic/main.py")
|
||||||
|
# Face-centered cubic
|
||||||
|
#fcCubic = os.path.join(path, "fc-cubic/main.py")
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
processes = []
|
processes = []
|
||||||
|
structure = ["simple-cubic"] #, "bc-cubic", "fc-cubic"]
|
||||||
|
|
||||||
def salome(exePath, arg):
|
def salome(src_path, build_path, arg):
|
||||||
subprocess.run(["salome", "start", "-t", exePath, "args:%s" % arg])
|
subprocess.run(["salome", "start", "-t", src_path, "args:{},{}".format(build_path, arg)])
|
||||||
|
|
||||||
for c in alpha:
|
for s in structure:
|
||||||
print("starting process")
|
s_path = os.path.join(build, s)
|
||||||
p = multiprocessing.Process(target = salome, args = (cube, c))
|
|
||||||
processes.append(p)
|
|
||||||
p.start()
|
|
||||||
|
|
||||||
for process in processes:
|
for c in alpha:
|
||||||
process.join()
|
src_path = os.path.join(src, "%s/main.py" % s)
|
||||||
|
build_path = os.path.join(s_path, str(c))
|
||||||
|
|
||||||
|
if not os.path.exists(build_path):
|
||||||
|
os.makedirs(build_path)
|
||||||
|
|
||||||
|
print("starting process")
|
||||||
|
p = multiprocessing.Process(target = salome, args = (src_path, build_path, c))
|
||||||
|
processes.append(p)
|
||||||
|
p.start()
|
||||||
|
|
||||||
|
for process in processes:
|
||||||
|
process.join()
|
||||||
|
@ -16,21 +16,25 @@ FoamFile
|
|||||||
|
|
||||||
dimensions [0 1 -1 0 0 0 0];
|
dimensions [0 1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform (0 0 0);
|
||||||
|
|
||||||
boundaryField
|
boundaryField
|
||||||
{
|
{
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type ;
|
type pressureInletVelocity;
|
||||||
|
valut uniform (0 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type ;
|
type zeroGradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
wall
|
wall
|
||||||
{
|
{
|
||||||
type ;
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,21 +16,25 @@ FoamFile
|
|||||||
|
|
||||||
dimensions [0 2 -2 0 0 0 0];
|
dimensions [0 2 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internaleField uniform 0;
|
||||||
|
|
||||||
boundaryField
|
boundaryField
|
||||||
{
|
{
|
||||||
inlet
|
inlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
|
value uniform 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
outlet
|
outlet
|
||||||
{
|
{
|
||||||
type fixedValue;
|
type fixedValue;
|
||||||
|
value uniform 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wall
|
wall
|
||||||
{
|
{
|
||||||
type ;
|
type zeroGradient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -17,8 +17,6 @@ FoamFile
|
|||||||
|
|
||||||
transportModel Newtonian;
|
transportModel Newtonian;
|
||||||
|
|
||||||
rho 1;
|
|
||||||
|
|
||||||
nu 1e-05;
|
nu 1e-05;
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
@ -1,6 +1,4 @@
|
|||||||
import os, sys
|
import os, sys
|
||||||
#print(os.getcwd())
|
|
||||||
#sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
@ -8,7 +6,8 @@ salome.salome_init()
|
|||||||
import geometry, mesh
|
import geometry, mesh
|
||||||
|
|
||||||
#alpha = [ 0.1, 0.15, 0.2 ]
|
#alpha = [ 0.1, 0.15, 0.2 ]
|
||||||
coef = float(sys.argv[1])
|
build_path = str(sys.argv[1])
|
||||||
|
coef = float(sys.argv[2])
|
||||||
|
|
||||||
#for coef in alpha:
|
#for coef in alpha:
|
||||||
print("alpha = {}".format(coef))
|
print("alpha = {}".format(coef))
|
||||||
@ -25,13 +24,12 @@ isDone = PoreMesh.Compute()
|
|||||||
status = "Succesfully" if isDone else "Mesh is not computed"
|
status = "Succesfully" if isDone else "Mesh is not computed"
|
||||||
print(status)
|
print(status)
|
||||||
|
|
||||||
#try:
|
try:
|
||||||
# dirname = os.path.dirname(__file__)
|
filename = os.path.join(build_path, "mesh.unv")
|
||||||
# filename = os.path.join(dirname, '../build/mesh.unv')
|
PoreMesh.ExportUNV(filename)
|
||||||
# PoreMesh.ExportUNV( filename )
|
pass
|
||||||
# pass
|
except:
|
||||||
#except:
|
print('ExportUNV() failed. Invalid file name?')
|
||||||
# print('ExportUNV() failed. Invalid file name?')
|
|
||||||
|
|
||||||
if salome.sg.hasDesktop():
|
if salome.sg.hasDesktop():
|
||||||
salome.sg.updateObjBrowser()
|
salome.sg.updateObjBrowser()
|
@ -47,23 +47,33 @@ runTimeModifiable true;
|
|||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
momErr
|
flowRatePatch(name=inlet)
|
||||||
{
|
{
|
||||||
type momentumError;
|
name inlet;
|
||||||
libs (fieldFunctionObjects);
|
type surfaceFieldValue;
|
||||||
executeControl writeTime;
|
libs ( "libfieldFunctionObjects.so" );
|
||||||
writeControl writeTime;
|
writeControl timeStep;
|
||||||
|
writeInterval 1;
|
||||||
|
writeFields false;
|
||||||
|
log false;
|
||||||
|
regionType patch;
|
||||||
|
fields ( phi );
|
||||||
|
operation sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
contErr
|
flowRatePatch(name=outlet)
|
||||||
{
|
{
|
||||||
type div;
|
name outlet;
|
||||||
libs (fieldFunctionObjects);
|
type surfaceFieldValue;
|
||||||
field phi;
|
libs ( "libfieldFunctionObjects.so" );
|
||||||
executeControl writeTime;
|
writeControl timeStep;
|
||||||
writeControl writeTime;
|
writeInterval 1;
|
||||||
|
writeFields false;
|
||||||
|
log false;
|
||||||
|
regionType patch;
|
||||||
|
fields ( phi );
|
||||||
|
operation sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10,20 +10,17 @@ FoamFile
|
|||||||
version 2.0;
|
version 2.0;
|
||||||
format ascii;
|
format ascii;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
location "constant";
|
object decomposeParDict;
|
||||||
object turbulenceProperties;
|
|
||||||
}
|
}
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
simulationType RAS;
|
numberOfSubdomains 4;
|
||||||
|
|
||||||
RAS
|
method simple;
|
||||||
|
|
||||||
|
coeffs
|
||||||
{
|
{
|
||||||
RASModel SpalartAllmaras;
|
n (2 2 1);
|
||||||
|
|
||||||
turbulence on;
|
|
||||||
|
|
||||||
printCoeffs on;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
@ -29,8 +29,6 @@ divSchemes
|
|||||||
{
|
{
|
||||||
default none;
|
default none;
|
||||||
div(phi,U) bounded Gauss linearUpwind grad(U);
|
div(phi,U) bounded Gauss linearUpwind grad(U);
|
||||||
// div(phi,nuTilda) bounded Gauss linearUpwind grad(nuTilda);
|
|
||||||
// div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
laplacianSchemes
|
laplacianSchemes
|
Loading…
Reference in New Issue
Block a user