| 159 | } |
| 160 | |
| 161 | void transformNRFSourceToInternalSource(const Eigen::Vector3d& centre, |
| 162 | unsigned meshId, |
| 163 | const seissol::geometry::MeshReader& mesh, |
| 164 | const Subfault& subfault, |
| 165 | const Offsets& offsets, |
| 166 | const Offsets& nextOffsets, |
| 167 | const std::array<std::vector<double>, 3>& sliprates, |
| 168 | seissol::model::Material* material, |
| 169 | PointSources& pointSources, |
| 170 | unsigned index, |
| 171 | seissol::memory::Memkind memkind) { |
| 172 | computeMInvJInvPhisAtSources(centre, pointSources.mInvJInvPhisAtSources[index], meshId, mesh); |
| 173 | |
| 174 | auto& faultBasis = pointSources.tensor[index]; |
| 175 | faultBasis[0] = subfault.tan1(0); |
| 176 | faultBasis[1] = subfault.tan1(1); |
| 177 | faultBasis[2] = subfault.tan1(2); |
| 178 | faultBasis[3] = subfault.tan2(0); |
| 179 | faultBasis[4] = subfault.tan2(1); |
| 180 | faultBasis[5] = subfault.tan2(2); |
| 181 | faultBasis[6] = subfault.normal(0); |
| 182 | faultBasis[7] = subfault.normal(1); |
| 183 | faultBasis[8] = subfault.normal(2); |
| 184 | |
| 185 | pointSources.A[index] = subfault.area; |
| 186 | std::array<double, 81> stiffnessTensor{}; |
| 187 | switch (material->getMaterialType()) { |
| 188 | case seissol::model::MaterialType::Anisotropic: |
| 189 | [[fallthrough]]; |
| 190 | case seissol::model::MaterialType::Poroelastic: |
| 191 | if (subfault.mu != 0) { |
| 192 | logError() << "There are specific fault parameters for the fault. This is only compatible " |
| 193 | "with isotropic (visco)elastic materials."; |
| 194 | } |
| 195 | material->getFullStiffnessTensor(stiffnessTensor); |
| 196 | break; |
| 197 | default: |
| 198 | seissol::model::ElasticMaterial em = *dynamic_cast<seissol::model::ElasticMaterial*>(material); |
| 199 | em.mu = (subfault.mu == 0.0) ? em.mu : subfault.mu; |
| 200 | em.getFullStiffnessTensor(stiffnessTensor); |
| 201 | break; |
| 202 | } |
| 203 | std::copy( |
| 204 | stiffnessTensor.begin(), stiffnessTensor.end(), pointSources.stiffnessTensor[index].begin()); |
| 205 | pointSources.onsetTime[index] = subfault.tinit; |
| 206 | pointSources.samplingInterval[index] = subfault.timestep; |
| 207 | for (unsigned sr = 0; sr < Offsets().size(); ++sr) { |
| 208 | std::copy(sliprates[sr].begin() + offsets[sr], |
| 209 | sliprates[sr].begin() + nextOffsets[sr], |
| 210 | pointSources.sample[sr].data() + pointSources.sampleOffsets[sr][index]); |
| 211 | pointSources.sampleOffsets[sr][index + 1] = |
| 212 | pointSources.sampleOffsets[sr][index] + nextOffsets[sr] - offsets[sr]; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | auto mapClusterToMesh(ClusterMapping& clusterMapping, |
| 217 | const unsigned* meshIds, |
no test coverage detected