1. transport particles from last time step 2. remove all elements, cells, and grids 3. add structural nodes a. closest grid is set to BACKGROUND_STRUCTURE b. surrounding grids are set to BACKGROUND_FIXED c. surrounding cells are set to BACKGROUND_STRUCTURE 4. add particles to cells a. skip BACKGROUND_STRUCTURE cells b. set grids of fluid cells to BACKGROUND_FLUID c. set fluid cells to BACKGROUND_F
| 895 | // c. if all nodes are BACKGROUND_STRUCTURE, create contact |
| 896 | // elements d. if, gather particles from surrounding cells e. |
| 897 | int BackgroundMesh::remesh() { |
| 898 | // clear and check |
| 899 | if (bsize <= 0.0) { |
| 900 | opserr << "WARNING: basic mesh size has not been set -- " |
| 901 | "BgMesh::addParticles\n"; |
| 902 | return -1; |
| 903 | } |
| 904 | |
| 905 | #ifdef _LINUX |
| 906 | Timer timer; |
| 907 | timer.start(); |
| 908 | #endif |
| 909 | |
| 910 | // move particles |
| 911 | if (moveParticles() < 0) { |
| 912 | opserr << "WARNING: failed to move particles\n"; |
| 913 | return -1; |
| 914 | } |
| 915 | |
| 916 | #ifdef _LINUX |
| 917 | timer.pause(); |
| 918 | opserr << "time for move particles = " << timer.getReal() << "\n"; |
| 919 | timer.start(); |
| 920 | #endif |
| 921 | |
| 922 | // clear background |
| 923 | clearBackground(); |
| 924 | |
| 925 | // add structure |
| 926 | if (addStructure() < 0) { |
| 927 | opserr << "WARNING: failed to add structure\n"; |
| 928 | return -1; |
| 929 | } |
| 930 | |
| 931 | #ifdef _LINUX |
| 932 | timer.pause(); |
| 933 | opserr << "time for add structure = " << timer.getReal() << "\n"; |
| 934 | timer.start(); |
| 935 | #endif |
| 936 | // add particles |
| 937 | if (addParticles() < 0) { |
| 938 | opserr << "WARNING: failed to add particles\n"; |
| 939 | return -1; |
| 940 | } |
| 941 | |
| 942 | #ifdef _LINUX |
| 943 | timer.pause(); |
| 944 | opserr << "time for add particles = " << timer.getReal() << "\n"; |
| 945 | timer.start(); |
| 946 | #endif |
| 947 | |
| 948 | // move particles in fixed cells |
| 949 | if (moveFixedParticles()) { |
| 950 | opserr << "WARNING: failed to move particles in fixed cells"; |
| 951 | return -1; |
| 952 | } |
| 953 | |
| 954 | #ifdef _LINUX |