 
 		SolveForAccKernel(ANCF_NodesAccD, ANCF_SlopesAccD,
 				flex_FSI_NodesForcesD1, flex_FSI_NodesForcesD2,
-				ANCF_ReferenceArrayNodesOnBeamsD, ANCF_Beam_LengthD, ANCF_IsCantileverD, i);
+				ANCF_ReferenceArrayNodesOnBeamsD, ANCF_Beam_LengthD, ANCF_IsCantileverD, flexParamsD, i);
 
 #if !flexGPU
 	}

		Zero12(e_ee);
		// Elastic Force, 1/2: tension force, GQ 5th order. Maybe 4th order is enough as well.
		for (int k = 0; k < 5; k ++) {
			real_ gqPoint = (lE - 0) / 2 * GQD.GQ5_p[k] + (lE + 0) / 2;
			eps_eps_e(e_ee, gqPoint, lE, e);
			SumElem12(f_e, e_ee, flexParamsD.E * flexParamsD.A * (lE - 0) / 2 * GQD.GQ5_w[k]);
		}
		// Elastic Force, 2/2: bending force, GQ 3rd order.
		Elem12 k_ke;
		Zero12(k_ke);
		for (int k = 0; k < 3; k ++) {
			real_ gqPoint = (lE - 0) / 2 * GQD.GQ3_p[k] + (lE + 0) / 2;
			kappa_kappa_e(k_ke, gqPoint, lE, e);
			SumElem12(f_e, k_ke, flexParamsD.E * flexParamsD.I  * (lE - 0) / 2 * GQD.GQ3_w[k]);
		}
		// Gravitational Foce
		Elem12 f_g;
		Zero12(f_g);
		gravitational_force(f_g, lE, flexParamsD.rho, flexParamsD.A, flexParamsD.gravity);
		SumElem12(f_e, f_g, -1);
		// Add element forces to associated nodes
		Add_f_ToForces(flex_FSI_NodesForcesD1, flex_FSI_NodesForcesD2, -1, f_e, nodeIdx);
	}
}
//------------------------------------------------------------------------------
__global__ void CalcElasticForcesD(
		real3 * flex_FSI_NodesForcesD1,
		real3 * flex_FSI_NodesForcesD2,
		const real3 * ANCF_NodesD,

	int numNodesAdjusted = nodesPortionAdjusted2.y - nodesPortionAdjusted2.x;
	for (int j = 0; j < numNodesAdjusted; j++) {
		int nodeIdx = nodesPortionAdjusted2.x + j;
		ANCF_NodesD2[nodeIdx] += dT * ANCF_NodesVelD[nodeIdx];
		ANCF_SlopesD2[nodeIdx] += dT * ANCF_SlopesVelD[nodeIdx];

		ANCF_NodesVelD2[nodeIdx] += dT * ANCF_NodesAccD[nodeIdx];
		ANCF_SlopesVelD2[nodeIdx] += dT * ANCF_SlopesAccD[nodeIdx];
	}
}
//------------------------------------------------------------------------------
__GLOBAL__ void IntegrateInTimeD(
		real3 * ANCF_NodesD2,
		real3 * ANCF_SlopesD2,
		real3 * ANCF_NodesVelD2,
