Specify mesh (position) in ElmerSolver command line

Discussion about coding and new developments
Post Reply
RaJa
Posts: 60
Joined: 22 Oct 2014, 09:48
Antispam: Yes

Specify mesh (position) in ElmerSolver command line

Post by RaJa » 30 Jun 2016, 11:16

Hi folks,

I am currently trying to run a set of simulations where the mesh is constantly modified but the sif-file stays the same. As I do not want to replace results during the calculations each mesh is in a separate folder.

Currently, I need as much sif-files as I have meshs. The reason is the definition of the mesh inside the header-section of the sif-file which makes batch-operation a bit difficult. The other way would be the modification of the sif-file after each run which is also not straightforward when working with a Python script.

A nice feature would be, if the mesh file could be specified in the command line for calling the ElmerSolver. That would allow easy batch-operation as I would only need to modify the mesh position in the call to ElmerSolver. As Elmer places the results in the folder where the mesh is located, the results get separated nicely and I can save my project with a single sif-file and a bunch of mesh-directories.

In a way I like to call something like that:

Code: Select all

ElmverSolver case.sif mesh_directory_N
, where N gets replaced everytime.

Is that already possible or can that be done?
Thanks,
Rainer

mzenker
Posts: 1727
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Specify mesh (position) in ElmerSolver command line

Post by mzenker » 30 Jun 2016, 11:23

Hi Rainer,

I don't know of a possibility to do this within Elmer (but I may be wrong).
What I would consider is to create the sif-file on-the-fly with your Python script.

HTH,

Matthias

raback
Site Admin
Posts: 3230
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Specify mesh (position) in ElmerSolver command line

Post by raback » 05 Jul 2016, 15:21

Hi

You set in the start of the sif file:

Code: Select all

include mesh.name
Header :: Mesh DB "." $meshname$
[code]
and then specify the name in the file mesh.name
[code]
$meshname = "square"
[code]
For convinience the naming and calling could be a one-liner:
[code]
echo '$meshname="square"' > mesh.name; ElmerSolver case.sif
[code]
Some simple awk script could also do the job even more compactly. 

-Peter

Post Reply