Commit aec4d228 authored by Jean-Matthieu Gallard's avatar Jean-Matthieu Gallard
Browse files

KernelGen - fix time iteration in CK: remove unused n+1th derivative in...

KernelGen - fix time iteration in CK: remove unused n+1th derivative in default and compute only order derivative (0th derivative is given) in splitCK intead of nDof
parent 27442a99
......@@ -95,7 +95,8 @@ class ConfigurationParametersModel(AbstractModelBaseClass):
self.context["PSiSize"] = nDof*(nDof**nDim)*nVarPad
else:
# default linear
self.context["lQiSize"] = nDataPad*(nDof**nDim)*(1+nDof)
#self.context["lQiSize"] = nDataPad*(nDof**nDim)*(1+nDof)
self.context["lQiSize"] = nDataPad*(nDof**nDim)*nDof
self.context["lQhiSize"] = nDataPad*(nDof**nDim)
self.context["lFiSize"] = nDim*nDof*(nDof**nDim)*nVarPad#nVarPad*(nDof**(nDim+1))*(2*nDim+1) # Todo JMG see if 2dim+1 or 2dim
self.context["lFhiSize"] = nVarPad*(nDof**nDim)*nDim
......
......@@ -227,7 +227,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
float dtavFac = 0.5 * dt_SP;
// 3. Cauchy-Kovalewski procedure
// use lFhi as tmpArray
for (int t = 0; t < {{nDof}}; t++) { // time DOFs
for (int t = 0; t < {{nDof-1}}; t++) { // time DOFs, compute order derivatives
//put source here
// reset lQi_next
......
......@@ -64,7 +64,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
const double invDt = 1. / dt;
const double invDx = 1. / dx;
std::memset(lQi, 0, {{(nDof+1)*(nDof**nDim)*nDataPad}}*sizeof(double));
std::memset(lQi, 0, {{nDof*(nDof**nDim)*nDataPad}}*sizeof(double));
std::memset(lFi, 0, {{nDim*nDof*(nDof**nDim)*nVarPad}}*sizeof(double));
{% if useSource %}
std::memset(lSi , 0, {{nDof*(nDof**nDim)*nVarPad}}*sizeof(double));
......@@ -465,26 +465,29 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
{% endif %}{# useSource #}
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
#pragma omp simd aligned(lQi,lFi{{',lSi' if useSource else ''}}:ALIGNMENT)
for (int n = 0; n < {{nVarPad}}; n++) { // Skip parameters
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lFi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n];
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lFi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n+{{1*(nDof**nDim)*nDof*nVarPad}}];
if (i<{{nDof-1}}) {
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
#pragma omp simd aligned(lQi,lFi{{',lSi' if useSource else ''}}:ALIGNMENT)
for (int n = 0; n < {{nVarPad}}; n++) { // Skip parameters
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lFi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n];
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lFi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n+{{1*(nDof**nDim)*nDof*nVarPad}}];
{% if nDim==3 %}
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lFi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n+{{2*(nDof**nDim)*nDof*nVarPad}}];
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lFi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n+{{2*(nDof**nDim)*nDof*nVarPad}}];
{% endif %}
{% if useSource %}
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lSi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n];
lQi[((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+n] -= lSi[(i*{{nDof**nDim}}+xyz)*{{nVarPad}}+n];
{% endif %}
}
}
}
{% if nPar > 0 %}
// Copy parameters
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
std::copy_n(lQi+(i*{{nDof**nDim}}+xyz)*{{nDataPad}}+{{nVar}}, {{nDataPad-nVar}}, lQi+((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+{{nVar}});
}
// Copy parameters
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
std::copy_n(lQi+(i*{{nDof**nDim}}+xyz)*{{nDataPad}}+{{nVar}}, {{nDataPad-nVar}}, lQi+((i+1)*{{nDof**nDim}}+xyz)*{{nDataPad}}+{{nVar}});
}
{% endif %}
}
} //i
......
......@@ -219,7 +219,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
double dtavFac = 0.5 * dt;
// 3. Cauchy-Kovalewski procedure
// use lFhi as tmpArray
for (int t = 0; t < {{nDof}}; t++) { // time DOFs
for (int t = 0; t < {{nDof-1}}; t++) { // time DOFs, compute order derivatives
//put source here
// reset lQi_next
......
......@@ -185,7 +185,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
{% if usePointSources %}
// Add average PS to zero time derviative and lQh
// Add average PS to zero time derivative and lQh
for (int t = 0; t < {{nDof}}; t++) {
#pragma omp simd aligned(lQi,lQhi,PSi,weights1:ALIGNMENT)
for (int it = 0; it < {{(nDof**nDim)*nVarPad}}; it++) {
......@@ -200,7 +200,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
double dtavFac = 0.5 * dt;
// 3. Cauchy-Kovalewski procedure
for (int t = 0; t < {{nDof}}; t++) { // time DOFs
for (int t = 0; t < {{nDof-1}}; t++) { // time DOFs, compute order derivatives
//put source here
// reset lQi_next
......
......@@ -222,7 +222,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
double dtavFac = 0.5 * dt;
// 3. Cauchy-Kovalewski procedure
// use lFhi as tmparray
for (int t = 0; t < {{nDof}}; t++) { // time DOFs
for (int t = 0; t < {{nDof-1}}; t++) { // time DOFs, compute order derivatives
//put source here
// reset lQi_next
......
......@@ -82,7 +82,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
const double invDt = 1. / dt;
const double invDx = 1. / dx;
std::memset(lQi, 0, {{(nDof+1)*(nDof**nDim)*nDataPad}}*sizeof(double));
std::memset(lQi, 0, {{nDof*(nDof**nDim)*nDataPad}}*sizeof(double));
std::memset(lFi, 0, {{nDim*nDof*(nDof**nDim)*nVarPad}}*sizeof(double));
{% if useSource %}
std::memset(lSi , 0, {{nDof*(nDof**nDim)*nVarPad}}*sizeof(double));
......@@ -375,27 +375,30 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
solver.{{solverName}}::algebraicSource(center[0], tStep, lQi+{{idxLQi(t,0,0,xyz,0)}}, lSi+{{idxLSi(t,0,0,xyz,0)}});
}
{% endif %}{# useSource #}
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
#pragma omp simd aligned(lQi,lFi{{',lSi' if useSource else ''}}:ALIGNMENT)
for (int n = 0; n < {{nVarPad}}; n++) { // Skip parameters
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lFi[{{idxLFi(0,t,0,0,xyz,n)}}];
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lFi[{{idxLFi(1,t,0,0,xyz,n)}}];
if (i<{{nDof-1}}) {
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
#pragma omp simd aligned(lQi,lFi{{',lSi' if useSource else ''}}:ALIGNMENT)
for (int n = 0; n < {{nVarPad}}; n++) { // Skip parameters
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lFi[{{idxLFi(0,t,0,0,xyz,n)}}];
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lFi[{{idxLFi(1,t,0,0,xyz,n)}}];
{% if nDim==3 %}
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lFi[{{idxLFi(2,t,0,0,xyz,n)}}];
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lFi[{{idxLFi(2,t,0,0,xyz,n)}}];
{% endif %}
{% if useSource %}
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lSi[{{idxLSi(t,0,0,xyz,n)}}];
lQi[{{idxLQi('t+1',0,0,xyz,n)}}] -= lSi[{{idxLSi(t,0,0,xyz,n)}}];
{% endif %}
}
}
}
{% if nPar > 0 %}
// Copy parameters
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
std::copy_n(lQi+{{idxLQi(t,0,0,xyz,nVar)}}, {{nDataPad-nVar}}, {{idxLQi('t+1',0,0,xyz,nVar)}});
}
// Copy parameters
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
std::copy_n(lQi+{{idxLQi(t,0,0,xyz,nVar)}}, {{nDataPad-nVar}}, {{idxLQi('t+1',0,0,xyz,nVar)}});
}
{% endif %}
}
} //t
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment