Commit 3bdbc0c9 authored by Yumnah Mohamied's avatar Yumnah Mohamied

Scalar gradient now works for nfields>1, and documentation for fieldconvert updated

parent f90831df
......@@ -201,6 +201,7 @@ output.
\end{notebox}
\subsubsection{Extract a boundary region: \textit{extract} module}
\label{extract}
The boundary region of a domain can be extracted from the output
data using the following command line
%
......@@ -453,6 +454,11 @@ This module does not create an output file. The L2 and LInf norms for each field
%
\subsubsection{Computes the scalar gradient: \textit{scalargrad} module}
The scalar gradient of a field is computed by running:
\begin{lstlisting}[style=BashInputStyle]
FieldConvert -m scalargrad:bnd=0 test.xml test.fld test-scalgrad.fld
\end{lstlisting}
As in \S \ref{extract}, the option \inltt{bnd} specifies which boundary region to extract. Note this is different to MeshConvert where the parameter \inltt{surf} is specified and corresponds to composites rather boundaries. If \inltt{bnd} is not provided, all boundaries are extracted to different fields. To process this file you will need an xml file of the same region.
%
%
......@@ -461,7 +467,7 @@ This module does not create an output file. The L2 and LInf norms for each field
\subsubsection{Scale a given .fld: \textit{scaleinputfld} module}
To scale a .fld file by a given scalar quantity, the user can run:
\begin{lstlisting}[style=BashInputStyle]
FieldConvert -m sacleinputfld:scale=value test.fld test-scal.fld
FieldConvert -m scaleinputfld:scale=value test.xml test.fld test-scal.fld
\end{lstlisting}
The argument \inltt{scale=value} rescales of a factor \inltt{value}
\inltt{test.fld} by the factor value.
......@@ -473,7 +479,24 @@ to visualise it either in Tecplot or in Paraview the result.
%
%
\subsubsection{Time-averaged shear stress metrics:} \textit{shear} module}
Time-dependent wall shear stress derived metrics relevant to cardiovascular fluid dynamics research can be computed using this module. They are
\begin{itemize}
\item TAWSS: time-averaged wall shear stress;
\item OSI: oscillatory shear index;
\item transWSS: transverse wall shear stress;
\item TACFI: time-averaged cross-flow index;
\item TAAFI: time-averaged aneurysm formation index;
\item |WSSG|: wall shear stress gradient.
\end{itemize}
To compute these, the user can run:
\begin{lstlisting}[style=BashInputStyle]
FieldConvert -m shear:N=value:fromfld=test_id_b0.fld test.xml test-multishear.fld
\end{lstlisting}
The argument \inltt{N} and \inltt{fromfld} are compulsory arguments that respectively define the number of \inltt{.fld} files corresponding to the number of discrete equispaced time-steps, and the first \inltt{.fld} file which should have the form of \inltt{test_id_b0.fld} where the first underscore in the name marks the starting time-step file ID.
The input \inltt{.fld} files are the outputs of the \textit{wss} module If they do not contain the surface normals (an optional output of the \textit{wss} modle), then the \textit{shear} module will not compute the last metric, |WSSG|.
%
%
%
......@@ -490,7 +513,11 @@ way as described in section \ref{s:utilities:fieldconvert:sub:convert}.
%
\subsubsection{Computing the wall shear stress:} \textit{wss} module}
To obtain the wall shear stres vector and magnitude, the user can run:
\begin{lstlisting}[style=BashInputStyle]
FieldConvert -m wss:bnd=0:addnormals=1 test.xml test.fld test-wss.fld
\end{lstlisting}
As in \S \ref{extract}, the option \inltt{bnd} specifies which boundary region to extract. Note this is different to MeshConvert where the parameter \inltt{surf} is specified and corresponds to composites rather boundaries. If \inltt{bnd} is not provided, all boundaries are extracted to different fields. The \inltt{addnormals} is an optional command argument which, when turned on, outputs the normal vector of the extracted boundary region as well as the shear stress vector and magnitude. This option is off by default. To process the output file(s) you will need an xml file of the same region.
%
%
%
......
......@@ -91,7 +91,7 @@ void ProcessScalGrad::Process(po::variables_map &vm)
m_f->m_bndRegionsToWrite),"Failed to interpret range string");
}
int i, j;
int i, j, k;
int spacedim = m_f->m_graph->GetSpaceDimension();
if ((m_f->m_fielddef[0]->m_numHomogeneousDir) == 1 ||
(m_f->m_fielddef[0]->m_numHomogeneousDir) == 2)
......@@ -100,7 +100,7 @@ void ProcessScalGrad::Process(po::variables_map &vm)
}
int nfields = m_f->m_fielddef[0]->m_fields.size();
ASSERTL0(nfields == 1,"Implicit assumption that input is in ADR format of (u)");
//ASSERTL0(nfields == 1,"Implicit assumption that input is in ADR format of (u)");
if (spacedim == 1)
{
......@@ -110,35 +110,31 @@ void ProcessScalGrad::Process(po::variables_map &vm)
int ngrad = spacedim;
int newfields = 1;
int n, cnt, elmtid, nq, offset, boundary, nfq;
int npoints = m_f->m_exp[0]->GetNpoints();
Array<OneD, NekDouble> scalar(npoints);
Array<OneD, Array<OneD, NekDouble> > grad(ngrad), fgrad(ngrad), outfield(newfields);
string var;
Array<OneD, NekDouble> scalar;
Array<OneD, Array<OneD, NekDouble> > grad(ngrad), fgrad(ngrad), outfield(nfields);
StdRegions::StdExpansionSharedPtr elmt;
StdRegions::StdExpansion2DSharedPtr bc;
Array<OneD, int> BoundarytoElmtID, BoundarytoTraceID;
Array<OneD, Array<OneD, MultiRegions::ExpListSharedPtr> > BndExp(newfields);
m_f->m_exp.resize(newfields);
string var = "u";
for(i = nfields; i < newfields; ++i)
{
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir, var);
}
m_f->m_fielddef[0]->m_fields.resize(newfields);
m_f->m_fielddef[0]->m_fields[0] = "scalar gradient";
Array<OneD, Array<OneD, MultiRegions::ExpListSharedPtr> > BndExp(nfields);
m_f->m_exp[0]->GetBoundaryToElmtMap(BoundarytoElmtID, BoundarytoTraceID);
for (i = 0; i < newfields; i++)
for (i = 0; i < nfields; i++)
{
var = m_f->m_fielddef[0]->m_fields[i];
stringstream filename;
filename << var << "_scalar_gradient";
filename >> var;
m_f->m_fielddef[0]->m_fields[i] = var;
BndExp[i] = m_f->m_exp[i]->GetBndCondExpansions();
outfield[i] = Array<OneD, NekDouble>(npoints);
}
// loop over the types of boundary conditions
for(cnt = n = 0; n < BndExp[0].num_elements(); ++n)
{
......@@ -164,13 +160,13 @@ void ProcessScalGrad::Process(po::variables_map &vm)
grad[j] = Array<OneD, NekDouble>(nq);
}
if(nfields == 2)
if(spacedim == 2)
{
//Not implemented in 2D.
}
else
{
for(j = 0; j < newfields; j++)
for(j = 0; j < nfields; j++)
{
outfield[j] = BndExp[j][n]->UpdateCoeffs() + BndExp[j][n]->GetCoeff_Offset(i);
}
......@@ -193,34 +189,38 @@ void ProcessScalGrad::Process(po::variables_map &vm)
{
fgrad[j] = Array<OneD, NekDouble>(nfq);
}
Array<OneD, NekDouble> gradnorm(nfq, 0.0);
Array<OneD, NekDouble> gradnorm(nfq);
scalar = m_f->m_exp[0]->GetPhys() + offset;
elmt->PhysDeriv(scalar, grad[0],grad[1],grad[2]);
for(j = 0; j < ngrad; ++j)
for(k = 0; k < nfields; k++)
{
elmt->GetFacePhysVals(boundary,bc,grad[j],fgrad[j]);
}
Vmath::Zero(nfq, gradnorm, 1);
//surface curved
if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
{
for (j=0; j<ngrad; j++)
scalar = m_f->m_exp[k]->GetPhys() + offset;
elmt->PhysDeriv(scalar, grad[0],grad[1],grad[2]);
for(j = 0; j < ngrad; ++j)
{
Vmath::Vvtvp(nfq, normals[j], 1, fgrad[j], 1, gradnorm, 1, gradnorm, 1);
elmt->GetFacePhysVals(boundary,bc,grad[j],fgrad[j]);
}
}
else
{
for (j=0; j<ngrad; j++)
//surface curved
if (m_metricinfo->GetGtype() == SpatialDomains::eDeformed)
{
for (j=0; j<ngrad; j++)
{
Vmath::Vvtvp(nfq, normals[j], 1, fgrad[j], 1, gradnorm, 1, gradnorm, 1);
}
}
else
{
Vmath::Svtvp(nfq, normals[j][0], fgrad[j], 1, gradnorm, 1, gradnorm, 1);
for (j=0; j<ngrad; j++)
{
Vmath::Svtvp(nfq, normals[j][0], fgrad[j], 1, gradnorm, 1, gradnorm, 1);
}
}
bc->FwdTrans(gradnorm, outfield[k]);
}
bc->FwdTrans(gradnorm, outfield[0]);
}
}
}
......@@ -231,11 +231,11 @@ void ProcessScalGrad::Process(po::variables_map &vm)
}
}
for(int j = 0; j < newfields; ++j)
for(int j = 0; j < nfields; ++j)
{
for(int b = 0; b < m_f->m_bndRegionsToWrite.size(); ++b)
{
m_f->m_exp[0]->UpdateBndCondExpansion(m_f->m_bndRegionsToWrite[b]) = BndExp[0][m_f->m_bndRegionsToWrite[b]];
m_f->m_exp[j]->UpdateBndCondExpansion(m_f->m_bndRegionsToWrite[b]) = BndExp[j][m_f->m_bndRegionsToWrite[b]];
}
}
......
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