Skip to content

Introduce an optional namelist to ModEM#64

Open
MiCurry wants to merge 1 commit into
magnetotellurics:mainfrom
MiCurry:optional-namelist
Open

Introduce an optional namelist to ModEM#64
MiCurry wants to merge 1 commit into
magnetotellurics:mainfrom
MiCurry:optional-namelist

Conversation

@MiCurry

@MiCurry MiCurry commented Jun 11, 2026

Copy link
Copy Markdown
Member

This merge adds an optional namelist to ModEM. The namelist should be a file in the current working directory with the name of: namelist.modem.nl.

The namelist is only read if the namelist.modem.nl file is found in the CWD otherwise no attempt is made to read it.

The goal for the namelist is to provide an extra location to provide ModEM options that neither fit into the forward control file, or the inversion control file.

So far, the namelist only has one option that alters the execution of ModEM: the output_level setting (normally set by -V on the CL). If output_level is set in the namelist, the verbose setting will override the default verbose setting or the verbose level passed in through the command line.

There are three other options that can be set in the namelist. These are all under the '&grid' section. These options are: SFF, primary_field, and primary_field_file. At the moment, these options do nothing except set corresponding variables in userCtrl data structure. These variables are added here to assist Anna with some of her on-going spherical/secondary field formulation work.

The two namelist sections (&settings and &grid) are both optional. They can either be completely omitted or written in any order in the file. This provides some great flexibility for the user. It also should be pretty easy for other developers to see how to add a new section.

An example namelist can be generated by using a hidden command line option: ./Mod3DMT -N. That routine wont create the file if there is a namelist already present. As we use the namelist more, we can consider adding in a help message about -N.

This commit adds an optional namelist to ModEM. The namelist should be a file
in the current working directory with the name of: `namelist.modem.nl`.

The namelist is only read if the `namelist.modem.nl` file is found in the CWD
otherwise no attempt is made to read it.

The goal for the namelist is to provide an extra location to provide ModEM
options that neither fit into the forward control file, or the inversion
control file.

So far the namelist only really has one option that alters the execution of
ModEM, verbose setting. If set in the namelist, the verbose setting will
override the default verbose setting or the verbose level passed in through the
command line.

There are three other options that can be set in the namelist. These are all
under the '&grid' section. These options are: SFF, primary_field, and
primary_field_file. At the moment, these options do nothing except set
corresponding variables in userCtrl file. These variables are added here to
assist Anna with her spherical/secondary field formulation work.

The two sections are both optional in the namelist. They can either be
completely omitted or written in any order in the namelist file. This provides
some great flexibility for the user. It also should be pretty easy for other
developers to see how to add a new section.

An example namelist can be generated by using a hidden command line option:
`./Mod3DMT -N`. That routine wont create the file if there is a namelist
already present. As we use the namelist more, we can consider adding in a help
message about `-N`.
@MiCurry MiCurry requested a review from akelbert June 11, 2026 23:51
@MiCurry

MiCurry commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

@akelbert here is the namelist change we talked about on Wednesday. Let me know what you think!

I wasn't sure what to name the grid section. Perhaps there is a better section name for those options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant