Difference between revisions of "Interpolate Solution from Different Mesh"
(Clarify source of parts and number of points in the interpolation script.) |
(→3. Create Interpolated files) |
||
Line 65: | Line 65: | ||
* The inputs for this command are <code>[target parts per MPIProc] [source nx] [source ny] [source nz]</code> | * The inputs for this command are <code>[target parts per MPIProc] [source nx] [source ny] [source nz]</code> | ||
− | * Note that the number of processes given to <code>mpirun</code> times the <code>[parts per MPIProc]</code> must be equal to the number of target partitions. In this case, the target partition was 1024, so 64*16 = 1024 | + | * Note that the number of processes given to <code>mpirun</code> times the <code>[target parts per MPIProc]</code> must be equal to the number of target partitions. In this case, the target partition was 1024, so 64*16 = 1024 |
* The way it works is that each of the 64 MPIProcs is given 16 partitions to interpolate. | * The way it works is that each of the 64 MPIProcs is given 16 partitions to interpolate. | ||
Revision as of 19:20, 8 July 2020
This will be a general page for how to interpolate solutions from different meshes onto a new mesh. Those meshes are assumed to be of the same domain.
The generic terms for the two meshes are "source" and "target", where source has the desired solution data and target is the mesh that will be receiving.
Contents
"Structured" Mesh Methodology
This section will assume that the source mesh is in a structured ijk form. In the future, this may be expanded to meshes created by MGEN.
Process Overview
First, a CSV of the solution must be created. This must be done on a serial running version of ParaView and must be done after a MergeBlocks filter is done.
Second, a special solution file is created via Sort2StructuredGrid
, which will take in the csv from step 1 and the ordered coordinates of the source file from Matlab. Effectively, it creates a single solution file in the same ordering as the Matlab points. The importance of this is significant as the executable used in the next step depends on some expected ordering. If the ordering is different, a new executable will need to be used/created.
Third, the interpolation is performed onto the new grid via par3DInterp3
, which creates solInterp.<1-nparts>
files in the solnTarget
directory.
Fourth, the interpolation is then used by PHASTA by setting Load and set 3D IC: True
in the solver.inp
. This should only be done for 1 timestep, as it will continue to reset the IC for all proceeding timesteps. The solnTarget
directory needs to be symlinked into the -procs_case
directory for this to work.
1. Create CSV
- Created using ParaView
- PV must be running in Serial mode
- Otherwise the CSV will not be in the correct order and possibly have duplicated points
- Load in source dataset
- Apply Mergeblocks filter
- Save dataset as a csv with 12 digits of precision in scientific notation
- Take csv make sure it is in "pressure, u0, u1, u2, x0, x1, x2" format
2. Create Structured Solution File
Note: These instructions will be for the parallelSortDNSzBinJames
executable, which has some highly specific requirements and command inputs.
This step will take the data from the source solution file and put it in an format/order that will make the interpolation process work much faster.
- Symlink the sources ordered coordinate file as
ordered.crd
- Rename/symlink csv to be the correct file name (in my specific case, it was
dnsSolution1procLongFort.csv
) - Create an interactive job on whatever machine you're needing to run on (ALCF Cooley in this case)
- Load approriate MPI environment variables (
soft add +mvapich2
for Cooley) - Run the executable via
mpirun -np [nprocs] [executable path] [executable inputs]
- This will produce
source.sln.{1..nprocs}
files
- This will produce
- Concatenate
source.sln.{1..nprocs}
files in order into singlesource.sln
file- The individual
solution.sln.{1..nprocs}
files need to be concatenated into a singlesolution.sln
file, which can be done (in zsh at least) viaecho solution.sln.{1..[MPIRanks]}| xargs cat > solution.sln
(or probably equivalentcat solution.sln.{1..[MPIRanks]} > solution.sln
). Note these files must be concatenated in order of rank, otherwise it will be out of sequence.
- The individual
Example Command: mpirun -np 24 /lus/theta-fs0/projects/PHASTA_aesp/Utilities/Sort2StructuredGrid/parallelSortDNSzBinJames 47822547 47822547 212 0.0291
- The inputs for this command are
[nlines of csv] [nlines of ordered.crd] [number of element in z] [z domain width]
- Note: These inputs are specfic to this executable. Changing executable will change which is used
- Also note that the
[number of elements in z]
is equivalent tonsons
- 1 or the number of nodes in z - 1.
3. Create Interpolated files
This step will create the solInterp.[target nprocs]
files used by PHASTA to perform the interpolation.
- Create
Interpolate...
directory in the target's Chef directory - Symlink the
coords.[target nprocs]
files (that were created by Chef) to the a directory calledcoordsTarget
- Note that it's been common practice to put these files in a directory called
Coords
within a Chef directory. In that case, just symlink the whole directory
- Note that it's been common practice to put these files in a directory called
- Create a directory called
solnTarget
- This may be corrected in the future, but currently if
solnTarget
is not present the job will fail
- This may be corrected in the future, but currently if
- Symlink the
source.sln
to the directory and theordered.crd
file assource.crd
- Run the interpolation executable via mpirun on an interactive job.
- This creates a series of
solInterp.[target nprocs]
files in thesolnTarget
directory
Example Command: mpirun -np 64 $ph_aesp/Utilities/Intpolate/par3DInterp3 16 799 281 213
- The inputs for this command are
[target parts per MPIProc] [source nx] [source ny] [source nz]
- Note that the number of processes given to
mpirun
times the[target parts per MPIProc]
must be equal to the number of target partitions. In this case, the target partition was 1024, so 64*16 = 1024 - The way it works is that each of the 64 MPIProcs is given 16 partitions to interpolate.
4. Interpolate the solution in PHASTA
This step will take the solInterp.[target nprocs]
files and load them as initial conditions.
- Symlink the
solnTarget
directory into the[target nprocs]-procs_case
directory. - Add/uncomment
Load and set 3D IC: True
in thesolver.inp
- Run PHASTA for a few timesteps and write out
restart-dat.[target nprocs]
files - Remove/comment out the
Load and set 3D IC: True
line from thesolver.inp
- The new restart files have the interpolated solution
- Note that if you forget to remove the
Load and set 3D IC: True
statement fromsolver.inp
, PHASTA will overwrite the existing solution in the restart files
- Note that if you forget to remove the