Skip to content
Snippets Groups Projects
Commit b9ee8c67 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

t10 in python

parent 2c483822
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
# This file reimplements gmsh/tutorial/t10.geo in Python.
from gmsh import *
import math
gmshInitialize()
gmshOptionSetNumber("General.Terminal", 1)
gmshModelCreate("t10")
lc = .15
gmshModelGeoAddPoint(1, 0.0,0.0,0, lc)
gmshModelGeoAddPoint(2, 1,0.0,0, lc)
gmshModelGeoAddPoint(3, 1,1,0, lc)
gmshModelGeoAddPoint(4, 0,1,0, lc)
gmshModelGeoAddPoint(5, 0.2,.5,0, lc)
gmshModelGeoAddLine(1, 1,2);
gmshModelGeoAddLine(2, 2,3);
gmshModelGeoAddLine(3, 3,4);
gmshModelGeoAddLine(4, 4,1);
gmshModelGeoAddLineLoop(5, [1,2,3,4])
gmshModelGeoAddPlaneSurface(6, [5])
gmshModelFieldCreate(1, "Attractor")
gmshModelFieldSetNumbers(1, "NodesList", [5])
gmshModelFieldSetNumber(1, "NNodesByEdge", 100)
gmshModelFieldSetNumbers(1, "EdgesList", [2])
gmshModelFieldCreate(2, "Threshold");
gmshModelFieldSetNumber(2, "IField", 1);
gmshModelFieldSetNumber(2, "LcMin", lc / 30)
gmshModelFieldSetNumber(2, "LcMax", lc)
gmshModelFieldSetNumber(2, "DistMin", 0.15)
gmshModelFieldSetNumber(2, "DistMax", 0.5)
gmshModelFieldCreate(3, "MathEval")
gmshModelFieldSetString(3, "F", "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101")
gmshModelFieldCreate(4, "Attractor")
gmshModelFieldSetNumbers(4, "NodesList", [1])
gmshModelFieldCreate(5, "MathEval");
gmshModelFieldSetString(5, "F", "F4^3 + " + str(lc / 100))
gmshModelFieldCreate(6, "Box")
gmshModelFieldSetNumber(6, "VIn", lc / 15)
gmshModelFieldSetNumber(6, "VOut", lc)
gmshModelFieldSetNumber(6, "XMin", 0.3)
gmshModelFieldSetNumber(6, "XMax", 0.6)
gmshModelFieldSetNumber(6, "YMin", 0.3)
gmshModelFieldSetNumber(6, "YMax", 0.6)
gmshModelFieldCreate(7, "Min")
gmshModelFieldSetNumbers(7, "FieldsList", [2, 3, 5, 6])
gmshModelFieldSetAsBackground(7)
gmshModelGeoSynchronize()
gmshModelMesh(2)
gmshExport("t10.msh")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment