TDycores-Project / TDycore

BSD 2-Clause "Simplified" License
4 stars 0 forks source link

Standardize input options and clean up demos #188

Open jeff-cohere opened 3 years ago

jeff-cohere commented 3 years ago

Our demos do a lot of work that could be done automatically by the dycore during its initialization:

New Developments

As explained more in #211 and #197, we're rethinking the TDycore interface to simplify the dycore's role to set up a DM and hand it to a solver to run a simulation. In #212, we admit this lower-level approach won't work for everyone and plan to establish a separate high-level interface for folks who just want buttons for initialize, advance/step, and finalize.

The solver-centric approach encourages us to focus on the DM as the problem speification, and the dycore as the thing that creates it from a user's description. This means that a DM originates from a dycore, and therefore that TDySetDM is a complication we don't need. See below for a description of how the dycore aims to create its DM given options.

TDycore approach for setting options

We now rely on TDySetFromOptions to accept all command line options from the supported list.

Options currently implemented

If -tdy_read_mesh is supplied with a filename, the dycore creates a DM from the mesh in the given file. If this option is not given, the dycore creates a DM and applies all relevant PETSC DM options. The resulting mesh is then distributed, and any necessary overlapping mesh points are added.

If no mesh options are given at all, the dycore generates its "default" mesh, which is an 8x8x8-cell unit cube. If you don't ask for anything, you can't really complain!

If you want to make a demo with a mesh of a fixed type for some exotic purpose, you can always get the dycore's DM using TDyGetDM before TDySetup, and call PETSc's DM* functions to set it up.

Options still to be implemented

In the cases of parameters accepting <value_or_func>, we break each argument up into two distinct arguments, e.g. -tdy_porosity_value <value> and -tdy_porosity_func <func>.

Options to be deleted

jedbrown commented 3 years ago

If you're okay to work with PETSc main, then all meshes can be read, distributed, and extruded with

DMCreate(comm,&dm);
DMSetType(dm, DMPLEX);
DMSetFromOptions(dm);

https://petsc.org/main/docs/manualpages/DM/DMSetFromOptions.html

jeff-cohere commented 3 years ago

Just a note, in case we do decide to update to a more recent PETSc: the location of the headers supplying khash, which our timers use, has changed. We'll have to make a decision about when we switch and then apply a code change.

UPDATE: We've updated our supported PETSc version, so this work is done.

bishtgautam commented 3 years ago

How about splitting -tdy_thermal_conductivity <value_or_func> in two options one for value and one for function?

jeff-cohere commented 3 years ago

I've updated the description of this issue to reflect the work that's been done. It'll be easier to finish the rest and clean up our demos once we discuss #200.