示例#1
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with code_aster.  If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------------------

import code_aster
from code_aster.Commands import *

code_aster.init("--test")

test = code_aster.TestCase()

rank = code_aster.getMPIRank()
print("Nb procs", code_aster.getMPINumberOfProcs())
print("Rank", code_aster.getMPIRank())

pMesh2 = code_aster.ParallelMesh()
pMesh2.readMedFile("xxParallelMesh001a/%d.med"%rank, True)
pMesh2=DEFI_GROUP(reuse =pMesh2,MAILLAGE=pMesh2,CREA_GROUP_NO=_F(TOUT_GROUP_MA='OUI'))
del pMesh2

pMesh = code_aster.ParallelMesh()
pMesh.readMedFile("xxParallelMesh001a/%d.med"%rank, True)
pMesh.debugPrint(rank+30)

model = code_aster.Model(pMesh)
test.assertEqual(model.getType(), "MODELE_SDASTER")
model.addModelingOnMesh(code_aster.Physics.Mechanics,
                           code_aster.Modelings.Tridimensional)
示例#2
0
import code_aster
from code_aster.Commands import *

code_aster.init("--test")

test = code_aster.TestCase()

pMesh = LIRE_MAILLAGE(UNITE=20, FORMAT="MED", PARTITIONNEUR="PTSCOTCH")

model = AFFE_MODELE(
    MAILLAGE=pMesh,
    AFFE=_F(MODELISATION='3D', PHENOMENE='MECANIQUE', TOUT='OUI'),
)

rank = code_aster.getMPIRank()
nbproc = code_aster.getMPINumberOfProcs()

if nbproc == 2:
    nbNodes = [84, 87]
    nbCells = [358, 381]
elif nbproc == 3:
    nbNodes = [64, 64, 85]
    nbCells = [257, 252, 330]
elif nbproc == 4:
    nbNodes = [60, 64, 66, 58]
    nbCells = [221, 232, 253, 220]

test.assertEqual(pMesh.getDimension(), 3)
test.assertEqual(pMesh.getNumberOfNodes(), nbNodes[rank])
test.assertEqual(pMesh.getNumberOfCells(), nbCells[rank])
test.assertTrue(pMesh.isParallel())