tutorials issueshttps://gitlab.onelab.info/doc/tutorials/-/issues2024-02-24T23:39:55Zhttps://gitlab.onelab.info/doc/tutorials/-/issues/26Sharing parameters between PY and PRO2024-02-24T23:39:55ZTommy ASharing parameters between PY and PRODear Developers and Users,
I'm looking for a way to share parameters between a PY file and a PRO file without using gmsh GUI.
I create a geometry and mesh through python API of Gmsh, i.e., by running `python geometry.py`.
Then, I r...Dear Developers and Users,
I'm looking for a way to share parameters between a PY file and a PRO file without using gmsh GUI.
I create a geometry and mesh through python API of Gmsh, i.e., by running `python geometry.py`.
Then, I run `getdp main.pro -msh MESH.msh ...` to run a solver and output results. All work fine.
My problem is as the following:
I have a bulky set of parameters defined in `geometry.py`, for example `freq = 3e9` and so on. These parameters are also used in `main.pro`, so, for now, I just copy&paste the relevant portion of codes from the PY file to PRO.
What is a good way to share all these parameters between codes ?
Refering to this tutorial wiki ([ONELAB-onelab.py-module](https://gitlab.onelab.info/doc/tutorials/-/wikis/ONELAB-onelab.py-module) and [ONELAB-syntax-for-Gmsh-and-GetDP](https://gitlab.onelab.info/doc/tutorials/-/wikis/ONELAB-syntax-for-Gmsh-and-GetDP)), I tried to make use of ONELAB.py.
Simplified codes are shown below, attempting to share a parameter `freq` but no success.
```py
"""geometry.py"""
import onelab
c = onelab.client(__file__)
c.defineNumber("freq", value=3e9) # or c.setNumber("freq", value=3e9)
c.run(name="geometry", command="getdp main.pro")
```
```pro
// main.pro
DefineConstant [ freq = { 1, Name "freq" }]; // I want to update this value programmatically
Printf("FREQ: %f", freq); // this returns "Freq: 1.000000"
```
Then, from a terminal I can run the above two codes.
```sh
>> python geometry.py
```
I have a feeling that I'm using an onelab client in a wrong way. Could someone please enlighten me? Thank you so much in advance.
On a side note, if I use GEO scripts (.geo) than python scripts to generate a geometry, I don't have a problem because GEO scripts can be included in a PRO file and all parameters are shared.
The versions I use:
GetDP 3.5.0
Gmsh 4.12.2
on Windows 11.
Tomhttps://gitlab.onelab.info/doc/tutorials/-/issues/25Magnetic field calculation of a permanent magnet with a nonlinear demagnetiza...2023-12-04T10:27:04ZBertold FroehlichMagnetic field calculation of a permanent magnet with a nonlinear demagnetization curveI try to calculate a magnetic field of a permanent magnet with a nonlinear demagnetization curve. I am using the template magnets.pro and an interpolated function instead of a constant mu, nu, as given in the template. As arguments for t...I try to calculate a magnetic field of a permanent magnet with a nonlinear demagnetization curve. I am using the template magnets.pro and an interpolated function instead of a constant mu, nu, as given in the template. As arguments for the calculation of the field in the section Formulation, and also in the postprocessing part, I use mu\[{d phi}\] and nu\[{Curl a}\] instead of a mu\[\] and nu\[\]. I also include some demagnetization curve from the manufacturer of the permanent magnet. Should it work this way? I have already sucessfully tested the method described here for a nonlinear steel material.https://gitlab.onelab.info/doc/tutorials/-/issues/22Constraint with Lagrange multipliers2023-10-06T13:01:10ZCrisBabConstraint with Lagrange multipliersHi,
Is there any example which shows how to use Lagrange multipliers to set a constraint?
ThanksHi,
Is there any example which shows how to use Lagrange multipliers to set a constraint?
Thankshttps://gitlab.onelab.info/doc/tutorials/-/issues/21Export Global Quantity Values (Custom Format)2023-09-24T01:38:15ZStuart BarthExport Global Quantity Values (Custom Format)I understand that we can use the Print\[\] function in a `PostOperation` to export to a file, e.g., `Print [ Q, OnRegion Conductor, Format SimpleTable, File > "Q.txt"]`. However, this doesn't really give us the option of outputting data ...I understand that we can use the Print\[\] function in a `PostOperation` to export to a file, e.g., `Print [ Q, OnRegion Conductor, Format SimpleTable, File > "Q.txt"]`. However, this doesn't really give us the option of outputting data in any desired format -- we seem to be limited to the options of `Format`, e.g., `SimpleTable`
In the electrostatics tutorial for example, we have a global quantity `Q`. Say I had multiple such quantities `Q~{i}`, and I wanted to export a list of them in CSV format. Is there a way to easily print out the global values to a file, in any desired format? I've tried `StoreInVariable $Q~{i}` and then directly writing `Printf(Sprintf("%g", $Q~{i})) >> "Q.txt";` -- but OneLab gives an error saying it doesn't recognize the global variable symbol `$`.
Is there any way the value of a Global Quanity can be directly written to a file, in a custom format?
Thank you!https://gitlab.onelab.info/doc/tutorials/-/issues/20Which is the correct stable version?2023-08-04T10:27:43ZBertold FroehlichWhich is the correct stable version?I have downloaded Onelab from the page https:\\onlab.info. When I open Onelab (Windows) it shows the version number 4.12.0 ![grafik](/uploads/196dc243e85c9e175203f001ad592825/grafik.png)
When I go to the https:\\gmsh.info page the curren...I have downloaded Onelab from the page https:\\onlab.info. When I open Onelab (Windows) it shows the version number 4.12.0 ![grafik](/uploads/196dc243e85c9e175203f001ad592825/grafik.png)
When I go to the https:\\gmsh.info page the current stable release is version 4.11.1
![grafik](/uploads/17614d164889477c6a6c31e49f989a01/grafik.png)https://gitlab.onelab.info/doc/tutorials/-/issues/15MagnetoStatic Simulation of Amperes Law2022-04-11T09:22:28ZGreenMaxMagnetoStatic Simulation of Amperes LawHello,
I had a quick question about setting up OneLab to calculate the magnetic field generated from current passed through a PCB trace. I have looked at the examples and am not sure which example is a good starting point. I am not able ...Hello,
I had a quick question about setting up OneLab to calculate the magnetic field generated from current passed through a PCB trace. I have looked at the examples and am not sure which example is a good starting point. I am not able to figure out how to setup the boundary conditions and input/output faces for the current.https://gitlab.onelab.info/doc/tutorials/-/issues/14Capacitor in 3D2021-12-02T16:53:21ZBianca AuwarterCapacitor in 3DHello everyone,
it's the first time I use gmsh, I already know how to build some models, but I still have no idea how to build a capacitor model in 3d, could someone help me?Hello everyone,
it's the first time I use gmsh, I already know how to build some models, but I still have no idea how to build a capacitor model in 3d, could someone help me?https://gitlab.onelab.info/doc/tutorials/-/issues/13Thermics Regularize Field: Position of Thin Volume Region (Minor Issue)2021-09-11T13:08:42ZErik SchnaubeltThermics Regularize Field: Position of Thin Volume Region (Minor Issue)The position of the thin volume when `Flag_Regularization == 1` in the thermics tutorial seems to be off slightly (as far as I understand the model). Talking only about the left boundary of window 1, the line for the thin shell is locate...The position of the thin volume when `Flag_Regularization == 1` in the thermics tutorial seems to be off slightly (as far as I understand the model). Talking only about the left boundary of window 1, the line for the thin shell is located at x = 15mm while the outer bound for the thin volume is at x = 13.5mm and the inner boundary at x = 14.5mm. Hence, the regularized window is slightly bigger than the thin shell window.
This is of course only a minor issue (but possibly confusing) and can be easily fixed by changing the assignments in this part of `brick_common.pro`
```
If( Flag_Regularization )
dx_Win1 += 1*e_layer;
dy_Win1 += 1*e_layer;
EndIf
```
into either `+= 0*e_layer //i.e. equiv to deleting the assignment` (thin shell coincides with inner boundary of the thin volume window), `-= 1*e_layer` (thin shell is in the middle of the two boundaries of the thin volume, probably preferred?) or `-= 2*e_layer` (thin shell coincides with outer boundary).
Many thanks for the great tutorial and GetDP/gmsh in general!François HenrotteFrançois Henrottehttps://gitlab.onelab.info/doc/tutorials/-/issues/12How to import an already drawn model into gmsh2021-07-26T21:13:06ZJie LiHow to import an already drawn model into gmshIs there a possibility that I can import an ansys or femag model that I have already drawn into gmsh?Is there a possibility that I can import an ansys or femag model that I have already drawn into gmsh?https://gitlab.onelab.info/doc/tutorials/-/issues/11How to use Code to build a Model2021-07-10T14:35:10ZJie LiHow to use Code to build a ModelHallo everyone,
it's my first time to use gmsh, I already know how to build a model with interface operations, but I still don't have a clue about building a model using code, for example a hollow cylinder, is there some corresponding ex...Hallo everyone,
it's my first time to use gmsh, I already know how to build a model with interface operations, but I still don't have a clue about building a model using code, for example a hollow cylinder, is there some corresponding example?https://gitlab.onelab.info/doc/tutorials/-/issues/9Example for structural eigenvalue problem wanted2021-04-06T09:21:01ZAlexander ShendiExample for structural eigenvalue problem wantedI'm trying to use onelab for structural mechanics. In particular I would like to compute the eigenfrequencies and eigenmodes of a structure.
As an excercise I have converted the supplied 2D wrench example to 3D. I was able to do a 3D s...I'm trying to use onelab for structural mechanics. In particular I would like to compute the eigenfrequencies and eigenmodes of a structure.
As an excercise I have converted the supplied 2D wrench example to 3D. I was able to do a 3D static calculation, but still have some questions. Do you know whom I could contact? Also I have some further questions regarding the eigenproblem.
Many thanks in advance for your help.https://gitlab.onelab.info/doc/tutorials/-/issues/10How to output conductivity data?2021-04-06T05:51:15ZTryphenaHow to output conductivity data?Hello, I am new to onelab. I would like to use onelab to do some electrical mechanical coupling simulation. But for the beginning, I would like to simulate simple test to calculate conductivity of a cylinder. I merged the Interactive_Ele...Hello, I am new to onelab. I would like to use onelab to do some electrical mechanical coupling simulation. But for the beginning, I would like to simulate simple test to calculate conductivity of a cylinder. I merged the Interactive_Electrostatics.pro template with my mesh. Onelab runs and plots the voltage drop. But how can I know the conductivity of the cylinder? And is there any template for electrical mechanical coupling simulation? Thank you very much.
![cylinder](/uploads/12aa4e1e9056f78bb400c4afbc974a30/cylinder.JPG)https://gitlab.onelab.info/doc/tutorials/-/issues/6Conveks Error2021-01-27T19:09:58ZshahinConveks ErrorI have downloaded the ONELAB bundle and tried to run the shape.py tutorial. I am getting this error:
Abnormal server termination (socket listening timeout on socket 127:0:0:1:0)I have downloaded the ONELAB bundle and tried to run the shape.py tutorial. I am getting this error:
Abnormal server termination (socket listening timeout on socket 127:0:0:1:0)https://gitlab.onelab.info/doc/tutorials/-/issues/4Can I call gmsh and getdp by a python file instead of gmsh API?2019-09-14T07:36:11ZDasen ZhangCan I call gmsh and getdp by a python file instead of gmsh API?Hi,
Can I call gmsh and getdp by a python file instead of gmsh API? For example, to run driver.py (an ElectricMachine Model) in PyCharm without gmsh API.
After running driver.py with PyCharm, the error shows
"Performing OneLab ''
This...Hi,
Can I call gmsh and getdp by a python file instead of gmsh API? For example, to run driver.py (an ElectricMachine Model) in PyCharm without gmsh API.
After running driver.py with PyCharm, the error shows
"Performing OneLab ''
This appears to be the first time you are trying to run GetDP
Please run a GetDP model interactively once with Gmsh to initialize the solver location ".
Can anyone tell me how to solve this problem? Thank you!https://gitlab.onelab.info/doc/tutorials/-/issues/3Error: Please run a GetDP model interactively once with Gmsh to initialize th...2019-09-14T07:36:28ZDasen ZhangError: Please run a GetDP model interactively once with Gmsh to initialize the solver locationHi All,
The error in driver.py shows "This appears to be the first time you are trying to run GetDP Please run ... to initialize the solver location". I run the pmsm.pro with gmsh-4.4.0 many times, but it was not helpful. The gmsh-2.10...Hi All,
The error in driver.py shows "This appears to be the first time you are trying to run GetDP Please run ... to initialize the solver location". I run the pmsm.pro with gmsh-4.4.0 many times, but it was not helpful. The gmsh-2.10.1 settled in my Linux system does not work, while all the pro. files can work in the gmsh-4.4.0. I am looking for your suggestion. Thank you!