| ... | ... | @@ -9,7 +9,8 @@ Adding a new problem to the code is probably the most difficult/time-consuming f |
|
|
|
|
|
|
|
To create a new problem, these are the general steps to follow:
|
|
|
|
|
|
|
|
1. Create a new python file in src and name it something unique and descriptive, then go edit it
|
|
|
|
1. Create a new branch to work in and then create a new python file in src and name it something unique and descriptive, then
|
|
|
|
go edit it
|
|
|
|
|
|
|
|
2. Add all relevant import statements, in all cases you will need at least these lines:
|
|
|
|
```
|
| ... | ... | @@ -64,7 +65,7 @@ To create a new problem, these are the general steps to follow: |
|
|
|
|
|
|
|
Adding a new observer is one of the easier features to add, to do so follow these steps:
|
|
|
|
|
|
|
|
1. Go to the Observers.py file in the src directory and edit it
|
|
|
|
1. Create a new branch to work in and go to the Observers.py file in the src directory and edit it
|
|
|
|
|
|
|
|
2. Create a new class for your observer, give it a unique and descriptive name
|
|
|
|
|
| ... | ... | @@ -84,4 +85,51 @@ Adding a new observer is one of the easier features to add, to do so follow thes |
|
|
|
|
|
|
|
## Adding Mesh Presets
|
|
|
|
|
|
|
|
## Adding Custom Expressions |
|
|
\ No newline at end of file |
|
|
|
To add a new mesh preset, follow these instructions:
|
|
|
|
|
|
|
|
1. Create a new branch and go to the MeshPresets.py file in src and edit it
|
|
|
|
|
|
|
|
2. Create a new class for your mesh preset, giving it a descriptive and unique name, have it inherit from MeshFactory
|
|
|
|
|
|
|
|
3. Add an `__init__(...)` method where the (...) is whatever arguments the mesh preset will need
|
|
|
|
|
|
|
|
4. Determine where these meshes will be saved, in general we save all our meshes to a shared file system, so the path to your
|
|
|
|
mesh's directory should start with `/panfs/pan.fsl.byu.edu/scr/grp/fslg_RFSC/new_meshes/` you then want to have a main
|
|
|
|
folder where all meshes of this type will be saved, and inside of that folder each individual mesh should have it's own
|
|
|
|
folder, use string formatting to create unique folder names based on what the parameters of that particular mesh are. Once
|
|
|
|
you have this directory, call `super().__init__(directory)` to initialize this mesh class with a mesh at this directory
|
|
|
|
|
|
|
|
5. Here you currently have two options (these instructions were last updated as of 8/26/2021), either write a string with Gmsh
|
|
|
|
code in it, or create a FEniCS mesh to your specifications. Once you have done one of these options, call
|
|
|
|
`super().write_XDMF_from_gmsh_code()` with the proper arguments (see [Base Classes](Base Classes) for what these are) for
|
|
|
|
gmsh code, or call 'super().save_FEniCS_mesh()` with the proper arguments if you created a FEniCS mesh
|
|
|
|
|
|
|
|
6. To make this mesh compatible with TDGL problems, add a function (NOT a new method) which takes in arguments of x and
|
|
|
|
on_boundary. Here x is a 2D or 3D vector (depending on the dimension of your mesh) where x[0], x[1], and x[2] correspond to
|
|
|
|
the x, y, and z coordinates, and on_boundary is a boolean that determines if the point is on the outer boundary of the mesh
|
|
|
|
(these will both be passed to the function by FEniCS when it's determining if it should apply boundary conditions). This
|
|
|
|
function should use these two arguments to come up with an expression for where the applied field should be placed on the
|
|
|
|
mesh during solving. If the point in question should have field applied there, the function returns True, otherwise it
|
|
|
|
returns false. Here is a simple of an example of a function which places the boundary at the top and bottom of a 1x1 square
|
|
|
|
mesh with it's bottom left corner at the origin:
|
|
|
|
```
|
|
|
|
def boundary(x, on_boundary):
|
|
|
|
return on_boundary and (d.near(x[1], 0) or d.near(x[1], 1))
|
|
|
|
```
|
|
|
|
`d.near()` is a fenics function that returns True if both arguments are within some tolerance of each other (by default
|
|
|
|
the tolerance is machine precision), or False otherwise
|
|
|
|
|
|
|
|
7. Once you have defined this function, call `super().load_TDGL_boundary(boundary)` where here 'boundary' should be replaced
|
|
|
|
by whatever you called the function. Note that if you want this function to work for both periodic and non-periodic
|
|
|
|
solutions, you will need two different of these functions for each of those cases, where the periodic function does not
|
|
|
|
apply field where the periodic boundary should go
|
|
|
|
|
|
|
|
8. Once you are sure the mesh preset works correctly, commit your changes and merge the branch you are working on back into
|
|
|
|
dev and push your changes to the remote repository
|
|
|
|
|
|
|
|
9. Add your new mesh preset to the [Mesh Presets](Mesh Presets) page on the wiki and follow the same format as the other
|
|
|
|
presets already there (Describe the preset and what parameters are needed for it)
|
|
|
|
|
|
|
|
## Adding Custom Expressions
|
|
|
|
|
|
|
|
[Ignore this section for now, custom expressions are not super fleshed out as of now] |
|
|
\ No newline at end of file |