Skip to content

Commit dd0e6ec

Browse files
committed
updating to python 12, petsc 3.21, chrono 9, and scorec 2.2.8
1 parent bff4dba commit dd0e6ec

20 files changed

+117
-116
lines changed

proteus/mprans/SW2D.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,14 +557,14 @@ def __init__(self,
557557
if 'penalty' in self.ebq_global:
558558
for ebN in range(self.mesh.nElementBoundaries_global):
559559
for k in range(self.nElementBoundaryQuadraturePoints_elementBoundary):
560-
self.ebq_global['penalty'][ebN, k] = self.numericalFlux.penalty_constant/\(self.mesh.elementBoundaryDiametersArray[ebN]**self.numericalFlux.penalty_power)
560+
self.ebq_global['penalty'][ebN, k] = self.numericalFlux.penalty_constant/(self.mesh.elementBoundaryDiametersArray[ebN]**self.numericalFlux.penalty_power)
561561
# penalty term
562562
# cek move to Numerical flux initialization
563563
if 'penalty' in self.ebqe:
564564
for ebNE in range(self.mesh.nExteriorElementBoundaries_global):
565565
ebN = self.mesh.exteriorElementBoundariesArray[ebNE]
566566
for k in range(self.nElementBoundaryQuadraturePoints_elementBoundary):
567-
self.ebqe['penalty'][ebNE, k] = self.numericalFlux.penalty_constant/\self.mesh.elementBoundaryDiametersArray[ebN]**self.numericalFlux.penalty_power
567+
self.ebqe['penalty'][ebNE, k] = self.numericalFlux.penalty_constant/self.mesh.elementBoundaryDiametersArray[ebN]**self.numericalFlux.penalty_power
568568
logEvent(memory("numericalFlux", "OneLevelTransport"), level=4)
569569
self.elementEffectiveDiametersArray = self.mesh.elementInnerDiametersArray
570570
# use post processing tools to get conservative fluxes, None by default
@@ -1215,4 +1215,4 @@ def getForce(self, cg, forceExtractionFaces, force, moment):
12151215
# #print moment
12161216
# ##comm.Barrier()
12171217
# #import time
1218-
# #time.sleep(1)
1218+
# #time.sleep(1)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:b59a6c69ce229c85262404631e0babfe4c25ff788a2163432ed89c68db44b6cb
3-
size 902
2+
oid sha256:3b822fad7de753455a0b5b9cf05ffdfa02bcacccb73df835e2d48d07e77f1098
3+
size 904
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ac9933c970cc8c743bfd3bb06033972c1e7ef20554f65feb81c183eba2922f25
3-
size 917
2+
oid sha256:eec575c6265c5930d49e19bc03c0fce3804d53b114739642020da30557ce92fe
3+
size 918

proteus/tests/AddedMass/addedmass2D.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from proteus import Domain
33
from proteus.mprans import SpatialTools as st
44
from proteus.mbd import CouplingFSI as fsi
5+
import pychrono as chrono
56
from proteus.TwoPhaseFlow import TwoPhaseFlowProblem as tpf
67
from proteus.TwoPhaseFlow.utils import Parameters
7-
import pychrono as chrono
88
import os
99

1010
rho_0 = 1000.
@@ -26,7 +26,6 @@
2626
rect.setHoles(holes=np.array([rect.coords]))
2727

2828
domain.MeshOptions.he = he
29-
3029
# BOUNDARY CONDITIONS
3130

3231
tank.BC['x+'].setNoSlip()
@@ -42,11 +41,11 @@
4241
# CHRONO
4342

4443
system = fsi.ProtChSystem()
45-
system.ChSystem.Set_G_acc(chrono.ChVectorD(g[0], g[1], 0.))
44+
system.ChSystem.SetGravitationalAcceleration(chrono.ChVector3d(g[0], g[1], 0.))
4645
body = fsi.ProtChBody(system=system)
4746
body.attachShape(rect)
4847
body.ChBody.SetMass(500.)
49-
body.ChBody.SetBodyFixed(True) # fixing body
48+
body.ChBody.SetFixed(True) # fixing body
5049

5150
# OTHER PARAMS
5251
st.assembleDomain(domain)
@@ -95,9 +94,7 @@ def uOfXT(self,x,t):
9594

9695
myTpFlowProblem.SystemNumerics.cfl = 0.4
9796
myTpFlowProblem.SystemNumerics.useSuperlu=False
98-
9997
myTpFlowProblem.SystemPhysics.movingDomain = False
100-
10198
params = myTpFlowProblem.SystemPhysics
10299

103100
# PHYSICAL PARAMETERS
@@ -117,8 +114,8 @@ def uOfXT(self,x,t):
117114
myTpFlowProblem.SystemPhysics.modelDict['flow'].p.initialConditions['v']=AtRest()
118115
myTpFlowProblem.SystemPhysics.modelDict['addedMass'].p.initialConditions['addedMass']=AtRest()
119116

120-
m['flow'].p.coefficients.NONCONSERVATIVE_FORM=0.0
121-
m['flow'].p.coefficients.useVF=1.0
117+
m['flow'].p.coefficients.useVF = 1.0
118+
m['flow'].p.coefficients.NONCONSERVATIVE_FORM = 0.0
122119

123120
# auxiliary variables
124121
m['flow'].auxiliaryVariables += [system]
@@ -135,6 +132,8 @@ def uOfXT(self,x,t):
135132
flags_rigidbody = np.zeros(max_flag+1, dtype='int32')
136133
for s in system.subcomponents:
137134
if type(s) is fsi.ProtChBody:
138-
for flag in body.boundaryFlags:
135+
for flag in s.boundaryFlags:
139136
flags_rigidbody[flag] = 1
140137
m['addedMass'].p.coefficients.flags_rigidbody = flags_rigidbody
138+
m['addedMass'].n.linTolFac=0.0
139+
m['addedMass'].n.l_atol_res=1.0e-10

proteus/tests/AddedMass/addedmass3D.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
# CHRONO
4848

4949
system = fsi.ProtChSystem()
50-
system.ChSystem.Set_G_acc(chrono.ChVectorD(g[0], g[1], 0.))
50+
system.ChSystem.SetGravitationalAcceleration(chrono.ChVector3d(g[0], g[1], g[2]))
5151
body = fsi.ProtChBody(system=system)
5252
body.attachShape(rect)
5353
body.ChBody.SetMass(500.)
54-
body.ChBody.SetBodyFixed(True) # fixing body
54+
body.ChBody.SetFixed(True) # fixing body
5555

5656
# OTHER PARAMS
5757
st.assembleDomain(domain)
@@ -83,7 +83,6 @@ def __init__(self):
8383
def uOfXT(self,x,t):
8484
return 0.0
8585

86-
8786
# _ _ _
8887
# | \ | |_ _ _ __ ___ ___ _ __(_) ___ ___
8988
# | \| | | | | '_ ` _ \ / _ \ '__| |/ __/ __|
@@ -102,7 +101,6 @@ def uOfXT(self,x,t):
102101
myTpFlowProblem.SystemPhysics.setDefaults()
103102

104103
myTpFlowProblem.SystemNumerics.cfl = 0.4
105-
106104
myTpFlowProblem.SystemNumerics.useSuperlu=False
107105
myTpFlowProblem.SystemPhysics.movingDomain = False
108106

@@ -147,4 +145,5 @@ def uOfXT(self,x,t):
147145
for flag in s.boundaryFlags:
148146
flags_rigidbody[flag] = 1
149147
m['addedMass'].p.coefficients.flags_rigidbody = flags_rigidbody
150-
148+
m['addedMass'].n.linTolFac=0.0
149+
m['addedMass'].n.l_atol_res=1.0e-10

proteus/tests/AddedMass/test_addedmass2D.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def test_AddedMass_2D(self):
8080
ns.calculateSolution('addedmass2D')
8181
Aij = am2D.body.Aij
8282

83-
#np.savetxt('Aij_sol2D.csv', Aij, delimiter=',')
83+
np.savetxt('Aij_sol2D.csv', Aij, delimiter=',')
8484
Aij_sol = np.genfromtxt(os.path.join(modulepath, 'Aij_sol2D.csv'), delimiter=',')
85-
npt.assert_almost_equal(Aij, Aij_sol, decimal=5)
85+
npt.assert_allclose(Aij, Aij_sol, atol=1.0e-8, rtol=0.0)
8686
self.teardown_method(self)
8787

8888
if __name__ == "__main__":

proteus/tests/AddedMass/test_addedmass3D.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ def teardown_method(self, method):
3131
'addedmass2D_so.log'
3232
'addedmass3D_so.log'
3333
]
34-
#for file in FileList:
35-
# if os.path.isfile(file):
36-
# os.remove(file)
37-
# else:
38-
# pass
34+
for file in FileList:
35+
if os.path.isfile(file):
36+
os.remove(file)
37+
else:
38+
pass
3939

4040
def test_AddedMass_3D(self):
4141
from proteus import defaults
@@ -82,9 +82,9 @@ def test_AddedMass_3D(self):
8282
ns.calculateSolution('addedmass3D')
8383
Aij = am3D.body.Aij
8484

85-
#np.savetxt('Aij_sol3D.csv', Aij, delimiter=',')
85+
np.savetxt('Aij_sol3D.csv', Aij, delimiter=',')
8686
Aij_sol = np.genfromtxt(os.path.join(modulepath, 'Aij_sol3D.csv'), delimiter=',')
87-
npt.assert_almost_equal(Aij, Aij_sol, decimal=5)
87+
npt.assert_allclose(Aij, Aij_sol, atol=1.0e-8, rtol=0.0)
8888
self.teardown_method(self)
8989

9090
if __name__ == "__main__":

proteus/tests/FSI/floatingCube.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def uOfXT(self, x, t):
123123
# System
124124
g = np.array([0., 0., -9.81])
125125
system = fsi.ProtChSystem()
126-
system.ChSystem.Set_G_acc(pychrono.ChVectorD(g[0], g[1], g[2]))
126+
system.ChSystem.SetGravitationalAcceleration(pychrono.ChVector3d(g[0], g[1], g[2]))
127127
system.setTimeStep(1e-5)
128128
#system.setCouplingScheme("CSS", prediction="backwardEuler")
129129
# Body
@@ -132,9 +132,9 @@ def uOfXT(self, x, t):
132132
#body.Aij_factor = 1/width
133133
chbod = body.ChBody
134134
x, y, z = caisson.barycenter
135-
pos = pychrono.ChVectorD(x, y, z)
135+
pos = pychrono.ChVector3d(x, y, z)
136136
mass = (2.*radius)**3*rho_0*rhor
137-
inertia = pychrono.ChVectorD(1., 1., 1.)
137+
inertia = pychrono.ChVector3d(1., 1., 1.)
138138
chbod.SetPos(pos)
139139
chbod.SetMass(mass)
140140
chbod.SetInertiaXX(inertia)

proteus/tests/FSI/floatingCylinder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def uOfXT(self, x, t):
128128
# System
129129
g = np.array([0., -9.81, 0.])
130130
system = fsi.ProtChSystem()
131-
system.ChSystem.Set_G_acc(pychrono.ChVectorD(g[0], g[1], g[2]))
131+
system.ChSystem.SetGravitationalAcceleration(pychrono.ChVector3d(g[0], g[1], g[2]))
132132
system.setTimeStep(1e-5)
133133
#system.setCouplingScheme("CSS", prediction="backwardEuler")
134134
# Body
@@ -137,9 +137,9 @@ def uOfXT(self, x, t):
137137
#body.Aij_factor = 1/width
138138
chbod = body.ChBody
139139
x, y, z = caisson.barycenter
140-
pos = pychrono.ChVectorD(x, y, z)
140+
pos = pychrono.ChVector3d(x, y, z)
141141
mass = (2.*radius)**2*rho_0*rhor
142-
inertia = pychrono.ChVectorD(1., 1., 1.)
142+
inertia = pychrono.ChVector3d(1., 1., 1.)
143143
chbod.SetPos(pos)
144144
chbod.SetMass(mass)
145145
chbod.SetInertiaXX(inertia)
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
-rans2p_ksp_type preonly -rans2p_pc_type lu -rans2p_pc_factor_mat_solver_package superlu_dist
2-
-ncls_ksp_type preonly -ncls_pc_type lu -ncls_pc_factor_mat_solver_package superlu_dist
3-
-vof_ksp_type preonly -vof_pc_type lu -vof_pc_factor_mat_solver_package superlu_dist
4-
-rdls_ksp_type preonly -rdls_pc_type lu -rdls_pc_factor_mat_solver_package superlu_dist
5-
-mcorr_ksp_type preonly -mcorr_pc_type lu -mcorr_pc_factor_mat_solver_package superlu_dist
6-
-kappa_ksp_type preonly -kappa_pc_type lu -kappa_pc_factor_mat_solver_package superlu_dist
7-
-dissipation_ksp_type preonly -dissipation_pc_type lu -dissipation_pc_factor_mat_solver_package superlu_dist
8-
-mesh_ksp_type preonly -mesh_pc_type lu -mesh_pc_factor_mat_solver_package superlu_dist
1+
-rans2p_ksp_type preonly -rans2p_pc_type lu -rans2p_pc_factor_mat_solver_package superlu
2+
-ncls_ksp_type preonly -ncls_pc_type lu -ncls_pc_factor_mat_solver_package superlu
3+
-vof_ksp_type preonly -vof_pc_type lu -vof_pc_factor_mat_solver_package superlu
4+
-rdls_ksp_type preonly -rdls_pc_type lu -rdls_pc_factor_mat_solver_package superlu
5+
-mcorr_ksp_type preonly -mcorr_pc_type lu -mcorr_pc_factor_mat_solver_package superlu
6+
-kappa_ksp_type preonly -kappa_pc_type lu -kappa_pc_factor_mat_solver_package superlu
7+
-dissipation_ksp_type preonly -dissipation_pc_type lu -dissipation_pc_factor_mat_solver_package superlu
8+
-mesh_ksp_type preonly -mesh_pc_type lu -mesh_pc_factor_mat_solver_package superlu
99
-am_ksp_type cg -am_pc_type gamg -am_mg_coarse_ksp_type preonly -am_mg_coarse_pc_type svd

0 commit comments

Comments
 (0)