From 342fabe7b735cbbd4b52bd1bff3cf6f39fde36cd Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 17 Mar 2018 08:49:55 +0100 Subject: [PATCH] up --- Magnetostatics/electromagnet.pro | 14 ++++++++++++++ PendulumPython/pend.py | 18 +++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Magnetostatics/electromagnet.pro b/Magnetostatics/electromagnet.pro index 57774df..066ada9 100644 --- a/Magnetostatics/electromagnet.pro +++ b/Magnetostatics/electromagnet.pro @@ -108,14 +108,28 @@ Group { Function { mu0 = 4.e-7 * Pi; + + /* New ONELAB variables can then be defined using defineNumber, e.g.: */ murCore = DefineNumber[100, Name "Model parameters/Mur core", Help "Magnetic relative permeability of Core"]; + /* When the script is run, if the parameter named "Model parameters/Mur core" + has not been previously defined, it takes the value (100) provided in + defineNumber and is sent to the ONELAB server. The "/" character in the + variable name is interpreted as a path separator, and results in the + creation of a sub-tree in the graphical user interface. If the script is + re-run later, the value will be updated using the value from the server + (unless it is labeled as "ReadOnly"). + + Various attributes can be specified for ONELAB parameters: see + https://gitlab.onelab.info/doc/tutorials/wikis/ONELAB-syntax-for-Gmsh-and-GetDP */ + nu [ Region[{Air, Ind, AirInf}] ] = 1. / mu0; nu [ Core ] = 1. / (murCore * mu0); Current = DefineNumber[0.01, Name "Model parameters/Current", Help "Current injected in coil [A]"]; + NbTurns = 1000 ; // number of turns in the coil js_fct[ Ind ] = -NbTurns*Current/SurfaceArea[]; /* The minus sign is to have the current in -e_z direction, diff --git a/PendulumPython/pend.py b/PendulumPython/pend.py index 5887810..b9d0d43 100644 --- a/PendulumPython/pend.py +++ b/PendulumPython/pend.py @@ -43,6 +43,16 @@ m = 0.3 # mass of pendulum balls # New ONELAB variables can then be defined using defineNumber, e.g.: l = c.defineNumber('Geom/arm length [m]', value=1.0) + +# When the script is run, if the parameter named "Geom/arm length [m]" has not +# been previously defined, it takes the value (1.0) provided in defineNumber and +# is sent to the ONELAB server. The "/" character in the variable name is +# interpreted as a path separator, and results in the creation of a sub-tree in +# the graphical user interface. If the script is re-run later, the value will be +# updated using the value from the server (unless it is labeled as 'readOnly'). + +# Other ONELAB parameters are defined in the same way. Various attributes can be +# set: see https://gitlab.onelab.info/doc/tutorials/wikis/ONELAB-syntax-for-Python time = c.defineNumber('Dyna/time [s]', value=0.0) dt = c.defineNumber('Dyna/time step [s]', value=0.001) tmax = c.defineNumber('Dyna/max time [s]', value=20) @@ -52,13 +62,7 @@ theta0 = c.defineNumber('Init/initial theta angle [deg]', value=10, phi0 = c.defineNumber('Init/initial phi angle [deg]', value=180, attributes={'Highlight':'Pink'}) -# When the script is run, if the parameter Geom/arm length [m] has not been -# previously defined, it takes the value (1.0) provided in defineNumber and is -# sent to the ONELAB server. The "/" character in the variable name is -# interpreted as a path separator, and results in the creation of a sub-tree in -# the graphical user interface. If the script is re-run later, the value will be -# updated using the value from the server (unless it is labeled as readOnly: see -# below). When Gmsh runs a ONELAB client, the client can be run in two modes: +# When Gmsh runs a ONELAB client, the client can be run in two modes: # c.action=='check' to check the coherence of the ONELAB database and make # adjustments if necessary, and c.action=='compute' to perform the actual # computation. For instance, in 'check' mode, the double pendulum client simply -- GitLab