Générer un maillage du triangle stéréographique standard et y tracer un champ scalaire

neper -T -n 1 -domain "stdtriangle(10)" -dim 2 -o stdtri neper -M stdtri.tess -cl 0.04 -mesh2dalgo fron -statnode x,y awk '{print $2}' stdtri.stnode > data neper -V stdtri.msh -showelt1d all -dataelt1drad 0.001 \ -dataelt2dedgerad 0.0005 -cameraangle 3.4 -print stdtri \ -datanodecol scal:data -dataeltcol from_nodes \ -datanodescale 0.0:0.1:0.2:0.3:0.4 \ -print stdtri-col

Convertir un maillage périodique pour Zebulon

neper -T -n 10 -dim 3 -per 1 -oriformat geof -o polyper neper -M polyper.tess -for geof
from collections import defaultdict def do_mpc(per_filename): pairs = np.loadtxt('per_filename', usecols=[0,1]) pairs_dir = np.loadtxt('per_filename', usecols=[2,3,4]) pair_counter = 0 cells = "" bc_u = [] mpc = defaultdict(list) for idx, n in enumerate(pairs): mpc[n[1]].append(n[0]) for slave, master in mpc.iteritems(): cells += "**nset cell{:0d}\n".format(pair_counter) if len(master)==1: n = [slave, master[0]] cells += "{:.0f} {:.0f}\n".format(n[0], n[1]) bc_u.append('**mpc2 {:.0f} U1 {:.0f} U1\n**mpc2 {:.0f} U2 {:.0f} U2\n**mpc2 {:.0f} U3 {:.0f} U3'.format(n[0], n[1], n[0], n[1], n[0], n[1])) else: cells += " ".join(["{:.0f}".format(i) for i in master]) + " {:.0f}\n".format(slave) bc_u.append('**mpc1 cell{:0d} U1\n**mpc1 cell{:0d} U2\n**mpc1 cell{:0d} U3'.format(pair_counter, pair_counter, pair_counter)) pair_counter += 1 with open('cells_geof', 'w') as cell_geof: cell_geof.write(cells) with open('mpc_for_inp', 'w') as mpc_file: mpc_file.write('\n'.join(bc_u)) return '\n'.join(bc_u)

Référents

- Romain Quey - Aurélien Villani