From cc6609be3429348922f0cf13eb6b323980097f6b Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Tue, 23 Dec 2014 15:11:10 -0500 Subject: [PATCH 1/7] Derivations for LMNS Jacobians from PR #183 --- .../low_mach_navier_stokes_jacobians/Makefile | 58 +++++++ .../low_mach_navier_stokes.tex | 146 ++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 derivations/low_mach_navier_stokes_jacobians/Makefile create mode 100644 derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex diff --git a/derivations/low_mach_navier_stokes_jacobians/Makefile b/derivations/low_mach_navier_stokes_jacobians/Makefile new file mode 100644 index 0000000..1b7ae00 --- /dev/null +++ b/derivations/low_mach_navier_stokes_jacobians/Makefile @@ -0,0 +1,58 @@ +texroot=low_mach_navier_stokes +texfinal=$(texroot).pdf + +vectorsources := $(shell find rawfigs/ -name '*.dia' -o -name '*.eps' -o -name '*.ps' -o -name '*.pdf' -o -name '*.svg') +rastersources := $(shell find rawfigs/ -name '*.jpg' -o -name '*.gif') +readysources := $(shell find rawfigs/ -name '*.png' -o -name '*.pdf') + +vectorfigs := $(shell echo ' ' $(vectorsources) ' ' | sed -e 's> *raw> >g' -e 's/\.[^. ]* /.pdf /g' ) +rasterfigs := $(shell echo ' ' $(rastersources) ' ' | sed -e 's> *raw> >g' -e 's/\.[^. ]* /.png /g' ) +readyfigs := $(shell echo ' ' $(readysources) ' ' | sed -e 's> *raw> >g' ) +figures := $(vectorfigs) $(rasterfigs) $(readyfigs) + +bibfiles := $(wildcard *.bib) +styfiles := $(wildcard $(repo_path)/latex_common/*.sty) +clsfiles := $(wildcard $(repo_path)/latex_common/*.cls) + +all: $(texfinal) + +figures: $(figures) + +$(texfinal): *.tex $(bibfiles) $(figures) $(clsfiles) $(styfiles) + latexmk -pdf -f $(texroot).tex + +clean: cleanlatex cleanfigs + +cleanfigs: + rm -rf $(figures) +cleanlatex: + latexmk -C -bibtex + +figs/%.pdf: rawfigs/%.dia + @mkdir -p $(dir $@) + dia -t eps-builtin -e $?_roytemp.eps $? && epstopdf $?_roytemp.eps -o=$@ + @rm -f $?_roytemp.eps + +figs/%.pdf: rawfigs/%.eps + @mkdir -p $(dir $@) + epstopdf $? -o=$@ + +figs/%.pdf: rawfigs/%.pdf + @mkdir -p $(dir $@) + @reldir=`echo $(dir $@) | sed -e 's>[^/]*/*>../>g'`; ln -sf $${reldir}$? $@ + +figs/%.pdf: rawfigs/%.ps + @mkdir -p $(dir $@) + ps2pdf $? $@ + +figs/%.pdf: rawfigs/%.svg + @mkdir -p $(dir $@) + inkscape $? -z --export-pdf=$@ + +figs/%.png: rawfigs/%.jpg + @mkdir -p $(dir $@) + convert $? $@ + +figs/%.png: rawfigs/%.png + @mkdir -p $(dir $@) + @reldir=`echo $(dir $@) | sed -e 's>[^/]*/*>../>g'`; ln -sf $${reldir}$? $@ diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex new file mode 100644 index 0000000..35f1e24 --- /dev/null +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -0,0 +1,146 @@ +\documentclass[10pt]{article} + +\title{Derivation of Low Mach Navier-Stokes Jacobians} +\date{} + +\usepackage{helvet} +\renewcommand*\familydefault{\sfdefault} +\usepackage[left=1in,right=1in,top=1.0in,bottom=1in]{geometry} +\usepackage[small,compact]{titlesec} +\usepackage{amsmath} +\usepackage{graphicx} + +\begin{document} + +\begin{center} +\textbf{Derivation of Low Mach Navier-Stokes Jacobians} +\end{center} + +\section{Background Information} +The derivation detailed herein is for computing analytical Jacobians for the Low Mach Navier-Stokes equations. The final results are then implemented in GRINS src/physics/src/low\_mach\_navier\_stokes.C, with the goal being that there +will be a significant speedup in computation over using the standard finite difference approximation for computing the Jaconians. The derivation is broken up into 3 sections: mass (P residual), momentum (U residual), and energy (T residual). +Each of these is computed in a separate function wihtin the LMNS.C file. The 3 residuals were already implemented, so they will be the starting point for this derivation. Note that a sign convention has been specified for +purposes of optimization.\\ +Also note that, in this case, the following parameters are considered functions of temperature, T: +\begin{itemize} + \item density, $\rho$ + \item specific heat, $c_p$ + \item viscosity, $\mu$ + \item thermal conductivity, $k$ +\end{itemize} +For the test functions, \textbf{u}=\{$P,U,T$\} and \textbf{$\Phi$}=\{$\xi,\phi,\psi$\}.\\ +Lastly, the variable names used in the code follow this template: $Kxy$, where $x$ is the residual and $y$ is the derivation variable. For example, $KPT$ is the derivative of the P residual with respect to temperature, +while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressue. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Mass Equation} +The given P residual: +\begin{equation} + F_p = (-(U \cdot \nabla T) T^{-1} + \nabla \cdot U)\xi +\end{equation} + +Now converting to tensor notation + +\begin{equation} + F_p = -u_a T_{a,b} T^{-1} \xi + u_{a,b}\xi +\end{equation} + +Galerkin approximation: +\begin{align*} + u_a &= \sum u_i \phi_i^a\\ + T &= \sum T_i \psi_i +\end{align*} + +\begin{equation} + F_p = -u_i \phi_i^a T_j \psi_j^{a,b} (T_k \psi_k)^{-1} \xi + u_i \phi_i^{a,b} \xi +\end{equation} + +The P residual is a function of velocity, $U$, and Temperature, $T$, so we must take derivative with respect to both of them using the following form + +\begin{align*} + \frac{\partial}{\partial u_m} (u_i \phi_i^a) &= \phi_m^a \\ + \frac{\partial}{\partial T_m} (T_i \psi_i) &= \psi_m +\end{align*} + +\begin{align} + \frac{\partial F_p}{\partial u_m} = &-\phi_m^{a} T_j \psi_j^{a,b} (T_k \psi_k)^{-1} \xi + \phi_m^{a,b} \xi \nonumber \\ + \frac{\partial F_p}{\partial u_m} = &-\phi_m^{a} T_{a,b} T^{-1} \xi + \phi_m^{a,b} \xi \label {fp_du}\\ + \nonumber \\ + \frac{\partial F_p}{\partial T_m} = &-u_i \phi_i^a \xi \left [ T_j \psi_j^{a,b} (-1) (T_k \psi_k)^{-2} (\psi_m) + (T_k \psi_k)^{-1} \psi_m^{a,b} \right ] \nonumber \\ + \frac{\partial F_p}{\partial T_m} = &-u_a \xi \left [ -T_{a,b} T^{-2} \psi_m + T^{-1} \psi_m^{a,b} \right ] \label{fp_dT} +\end{align} + +Equations \ref{fp_du} and \ref{fp_dT} above are the generalized Jacobian terms for the P residual. When implemented in LMNS.C, the following terms will result:\\ +$KPu, KPv, KPw, KPT$ + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Momentum Equation} +The U residual is given as follows: +\begin{equation} + F_U = -\rho u_a u_{a,b} \phi^b + P \phi^{a,a} - \mu \left [u_{a,b} \phi_{a,b} + u_{b,a} \phi_{a,b} - \frac{2}{3} u_{a,a} \phi_{b,b} \right ] + \rho g_a \phi_a +\end{equation} + +Galerkin approximation + +\begin{align*} + u_a &= \sum u_i \phi_i^a\\ + P &= \sum P_i \xi_i\\ + T &= \sum T_i \psi_i +\end{align*} + +\begin{align} + F_U = -\rho u_i \phi_i^a u_j \phi_j^{a,b} \phi^b + P_i \xi_i \phi^{a,a} - \mu \left [u_i \phi_i^{a,b} \phi_{a,b} + u_i \phi_i^{b,a} \phi_{a,b} - \frac{2}{3} u_i \phi_i^{a,a} \phi_{b,b} \right ] + \rho g_a \phi_a \label{u_resid} +\end{align} + +Equation \ref{u_resid} above is a function of velocity, pressure, and temperature (due to $\rho = \rho(T)$ \\and $\mu = \mu(T)$ \ ), so derivatives must be taken with respect to all of them. + +\begin{align} + \frac{\partial F_U}{\partial u_m} = &-\rho \left [ u_i \phi_i^a \phi_m^{a,b} + u_j \phi_j^{a,b} \phi_m^a \right ] \phi^b + - \mu \left [\phi_m^{a,b} \phi^{a,b} + \phi_m^{b,a} \phi^{a,b} - \frac{2}{3} \phi_m^{a,a} \phi^{b,b} \right ] \nonumber \\ + \frac{\partial F_U}{\partial u_m} = &-\rho \left [ u_a \phi_m^{a,b} + u_{a,b} \phi_m^a \right ] \phi^b - \mu \left [\phi_m^{a,b} \phi^{a,b} + \phi_m^{b,a} \phi^{a,b} - \frac{2}{3} \phi_m^{a,a} \phi^{b,b} \right ] \label{du_du}\\ + \nonumber \\ + \frac{\partial F_U}{\partial P_m} = &\xi_m \phi^{a,a} \label{du_dp} \\ + \nonumber \\ + \frac{\partial F_U}{\partial T_m} = &-\frac{d\rho}{dT} \frac{d}{dT_m}(T_i \psi_i) u_i \phi_i^a u_j \phi_j^{a,b} \phi^b + - \left[ 0 + \frac{d\mu}{dT} \frac{d}{dT_m}(T_i \psi_i) [u_i \phi_i^{a,b} \phi_{a,b} + u_i \phi_i^{b,a} \phi_{a,b} - \frac{2}{3} u_i \phi_i^{a,a} \phi_{b,b} ] \right ] \nonumber + \\ &+ \frac{d\rho}{dT} \frac{d}{dT_m}(T_i \psi_i) g_a \phi_a \nonumber \\ + \frac{\partial F_U}{\partial T_m} = &-\frac{d\rho}{dT} \psi_m u_a u_{a,b} \phi^b + - \frac{d\mu}{dT} \psi_m \left [u_{a,b} \phi_{a,b} + u_{b,a} \phi_{a,b} - \frac{2}{3} u_{a,a} \phi_{b,b} \right ] + + \frac{d\rho}{dT} \psi_m g_a \phi_a \label{du_dT} +\end{align} + +Equations \ref{du_du}, \ref{du_dp}, and \ref{du_dT} above can then be implement in LMNS.C to create the following terms:\\ +$Kuu, Kuv, Kuw, Kvu, Kvv, Kvw, Kwu, Kwv, Kww, KuT, KvT, KwT, KuP, KvP, KwP$ + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Energy Equation} +The T residual is given as follows: +\begin{equation} + F_T = -\rho c_p (u_a T_{a,b})\psi - k T_{a,b} \psi_{a,b} +\end{equation} + +Again, note that $\rho = \rho(T)$, $c_p = c_p(T)$, and $k = k(T)$ + +\begin{align} + F_T = -\rho c_p u_i \phi_i^a T_j \psi_j^{a,b} \psi_k - k T_i \psi_i^{a,b} \psi_j^{a,b} +\end{align} + +Noting $F_T$ is a function of velocity and temperature. + +\begin{align} + \frac{\partial F_T}{\partial u_m} = &-\rho c_p \phi_m^a T_j \psi_j^{a,b} \psi_k - 0 \nonumber \\ + \frac{\partial F_T}{\partial u_m} = &-\rho c_p \phi_m^a T_{a,b} \psi_k \label{dT_du} \\ + \nonumber \\ + \frac{\partial F_T}{\partial T_m} = &-u_i \phi_i^a \psi_k \left [ \rho [ c_p \psi_m^{a,b} + T_j \psi_j^{a,b} \frac{d c_p}{dT} \psi_m ] + [ c_p T_j \psi_j^{a,b} ] \frac{d \rho}{dT} \psi_m \right ] \nonumber \\ + &- k \psi_m^{a,b} \psi_j^{a,b} - T_i \psi_i^{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \\ + \frac{\partial F_T}{\partial T_m} = &-u_a \psi_k \left [ \rho [ c_p \psi_m^{a,b} + T_{a,b} \frac{d c_p}{dT} \psi_m ] + [ c_p T_{a,b} ] \frac{d \rho}{dT} \psi_m \right ] \nonumber \\ + &- k \psi_m^{a,b} \psi_j^{a,b} - T_{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \label{dT_dT} +\end{align} + +Equations \ref{dT_du} and \ref{dT_dT} above will result in the following terms for LMNS.C:\\ +$KTu, KTv, KTw, KTT$ + +\end{document} From 38374b204ab0f6abfcd7a4506d01e22dc88223fd Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Tue, 6 Jan 2015 12:43:15 -0500 Subject: [PATCH 2/7] Added LMNS to main.tex document under new part and chapter; had to delete preamble from LMNS.tex, and Makefile was removed since LMNS.tex cannot be built on its own; still need to work out formatting issues --- .../low_mach_navier_stokes_jacobians/Makefile | 58 ------------------- .../low_mach_navier_stokes.tex | 28 ++------- main.tex | 6 ++ 3 files changed, 11 insertions(+), 81 deletions(-) delete mode 100644 derivations/low_mach_navier_stokes_jacobians/Makefile diff --git a/derivations/low_mach_navier_stokes_jacobians/Makefile b/derivations/low_mach_navier_stokes_jacobians/Makefile deleted file mode 100644 index 1b7ae00..0000000 --- a/derivations/low_mach_navier_stokes_jacobians/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -texroot=low_mach_navier_stokes -texfinal=$(texroot).pdf - -vectorsources := $(shell find rawfigs/ -name '*.dia' -o -name '*.eps' -o -name '*.ps' -o -name '*.pdf' -o -name '*.svg') -rastersources := $(shell find rawfigs/ -name '*.jpg' -o -name '*.gif') -readysources := $(shell find rawfigs/ -name '*.png' -o -name '*.pdf') - -vectorfigs := $(shell echo ' ' $(vectorsources) ' ' | sed -e 's> *raw> >g' -e 's/\.[^. ]* /.pdf /g' ) -rasterfigs := $(shell echo ' ' $(rastersources) ' ' | sed -e 's> *raw> >g' -e 's/\.[^. ]* /.png /g' ) -readyfigs := $(shell echo ' ' $(readysources) ' ' | sed -e 's> *raw> >g' ) -figures := $(vectorfigs) $(rasterfigs) $(readyfigs) - -bibfiles := $(wildcard *.bib) -styfiles := $(wildcard $(repo_path)/latex_common/*.sty) -clsfiles := $(wildcard $(repo_path)/latex_common/*.cls) - -all: $(texfinal) - -figures: $(figures) - -$(texfinal): *.tex $(bibfiles) $(figures) $(clsfiles) $(styfiles) - latexmk -pdf -f $(texroot).tex - -clean: cleanlatex cleanfigs - -cleanfigs: - rm -rf $(figures) -cleanlatex: - latexmk -C -bibtex - -figs/%.pdf: rawfigs/%.dia - @mkdir -p $(dir $@) - dia -t eps-builtin -e $?_roytemp.eps $? && epstopdf $?_roytemp.eps -o=$@ - @rm -f $?_roytemp.eps - -figs/%.pdf: rawfigs/%.eps - @mkdir -p $(dir $@) - epstopdf $? -o=$@ - -figs/%.pdf: rawfigs/%.pdf - @mkdir -p $(dir $@) - @reldir=`echo $(dir $@) | sed -e 's>[^/]*/*>../>g'`; ln -sf $${reldir}$? $@ - -figs/%.pdf: rawfigs/%.ps - @mkdir -p $(dir $@) - ps2pdf $? $@ - -figs/%.pdf: rawfigs/%.svg - @mkdir -p $(dir $@) - inkscape $? -z --export-pdf=$@ - -figs/%.png: rawfigs/%.jpg - @mkdir -p $(dir $@) - convert $? $@ - -figs/%.png: rawfigs/%.png - @mkdir -p $(dir $@) - @reldir=`echo $(dir $@) | sed -e 's>[^/]*/*>../>g'`; ln -sf $${reldir}$? $@ diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex index 35f1e24..e427f07 100644 --- a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -1,21 +1,3 @@ -\documentclass[10pt]{article} - -\title{Derivation of Low Mach Navier-Stokes Jacobians} -\date{} - -\usepackage{helvet} -\renewcommand*\familydefault{\sfdefault} -\usepackage[left=1in,right=1in,top=1.0in,bottom=1in]{geometry} -\usepackage[small,compact]{titlesec} -\usepackage{amsmath} -\usepackage{graphicx} - -\begin{document} - -\begin{center} -\textbf{Derivation of Low Mach Navier-Stokes Jacobians} -\end{center} - \section{Background Information} The derivation detailed herein is for computing analytical Jacobians for the Low Mach Navier-Stokes equations. The final results are then implemented in GRINS src/physics/src/low\_mach\_navier\_stokes.C, with the goal being that there will be a significant speedup in computation over using the standard finite difference approximation for computing the Jaconians. The derivation is broken up into 3 sections: mass (P residual), momentum (U residual), and energy (T residual). @@ -28,9 +10,9 @@ \section{Background Information} \item viscosity, $\mu$ \item thermal conductivity, $k$ \end{itemize} -For the test functions, \textbf{u}=\{$P,U,T$\} and \textbf{$\Phi$}=\{$\xi,\phi,\psi$\}.\\ +For the formulations, \textbf{u}=\{$P,U,T$\} and the test functions \textbf{$\Phi$}=\{$\xi,\phi,\psi$\}.\\ Lastly, the variable names used in the code follow this template: $Kxy$, where $x$ is the residual and $y$ is the derivation variable. For example, $KPT$ is the derivative of the P residual with respect to temperature, -while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressue. +while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressure. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -56,7 +38,7 @@ \section{Mass Equation} F_p = -u_i \phi_i^a T_j \psi_j^{a,b} (T_k \psi_k)^{-1} \xi + u_i \phi_i^{a,b} \xi \end{equation} -The P residual is a function of velocity, $U$, and Temperature, $T$, so we must take derivative with respect to both of them using the following form +The P residual is a function of velocity, $U$, and temperature, $T$, so we must take derivatives with respect to both of them using the following form: \begin{align*} \frac{\partial}{\partial u_m} (u_i \phi_i^a) &= \phi_m^a \\ @@ -77,7 +59,7 @@ \section{Mass Equation} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Momentum Equation} -The U residual is given as follows: +The U residual is given in tensor notation as follows: \begin{equation} F_U = -\rho u_a u_{a,b} \phi^b + P \phi^{a,a} - \mu \left [u_{a,b} \phi_{a,b} + u_{b,a} \phi_{a,b} - \frac{2}{3} u_{a,a} \phi_{b,b} \right ] + \rho g_a \phi_a \end{equation} @@ -135,7 +117,7 @@ \section{Energy Equation} \frac{\partial F_T}{\partial u_m} = &-\rho c_p \phi_m^a T_{a,b} \psi_k \label{dT_du} \\ \nonumber \\ \frac{\partial F_T}{\partial T_m} = &-u_i \phi_i^a \psi_k \left [ \rho [ c_p \psi_m^{a,b} + T_j \psi_j^{a,b} \frac{d c_p}{dT} \psi_m ] + [ c_p T_j \psi_j^{a,b} ] \frac{d \rho}{dT} \psi_m \right ] \nonumber \\ - &- k \psi_m^{a,b} \psi_j^{a,b} - T_i \psi_i^{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \\ + &- k \psi_m^{a,b} \psi_j^{a,b} - T_i \psi_i^{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \nonumber \\ \frac{\partial F_T}{\partial T_m} = &-u_a \psi_k \left [ \rho [ c_p \psi_m^{a,b} + T_{a,b} \frac{d c_p}{dT} \psi_m ] + [ c_p T_{a,b} ] \frac{d \rho}{dT} \psi_m \right ] \nonumber \\ &- k \psi_m^{a,b} \psi_j^{a,b} - T_{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \label{dT_dT} \end{align} diff --git a/main.tex b/main.tex index f5176cf..4089139 100644 --- a/main.tex +++ b/main.tex @@ -75,4 +75,10 @@ \chapter{Stokes} \bibliographystyle{abbrv} \bibliography{refs} +\part{Analytic Jacobians} + +\chapter{Low Mach Navier Stokes} + +\input{./derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex} + \end{document} From 52898897c95325b2fc1839717d5dfcc4ad5d8e72 Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Tue, 6 Jan 2015 13:06:10 -0500 Subject: [PATCH 3/7] Refactored main.tex to make LMNS its own chapter, with Analytic Jacobians being a section --- .../low_mach_navier_stokes.tex | 16 ++++++++-------- main.tex | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex index e427f07..487f065 100644 --- a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -1,6 +1,6 @@ -\section{Background Information} +\subsection{Background Information} The derivation detailed herein is for computing analytical Jacobians for the Low Mach Navier-Stokes equations. The final results are then implemented in GRINS src/physics/src/low\_mach\_navier\_stokes.C, with the goal being that there -will be a significant speedup in computation over using the standard finite difference approximation for computing the Jaconians. The derivation is broken up into 3 sections: mass (P residual), momentum (U residual), and energy (T residual). +will be a significant speedup in computation over using the standard finite difference approximation for computing the Jaconians. The derivation is broken up into 3 subsections: mass (P residual), momentum (U residual), and energy (T residual). Each of these is computed in a separate function wihtin the LMNS.C file. The 3 residuals were already implemented, so they will be the starting point for this derivation. Note that a sign convention has been specified for purposes of optimization.\\ Also note that, in this case, the following parameters are considered functions of temperature, T: @@ -14,9 +14,9 @@ \section{Background Information} Lastly, the variable names used in the code follow this template: $Kxy$, where $x$ is the residual and $y$ is the derivation variable. For example, $KPT$ is the derivative of the P residual with respect to temperature, while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressure. - +\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Mass Equation} +\subsection{Mass Equation} The given P residual: \begin{equation} F_p = (-(U \cdot \nabla T) T^{-1} + \nabla \cdot U)\xi @@ -56,9 +56,9 @@ \section{Mass Equation} Equations \ref{fp_du} and \ref{fp_dT} above are the generalized Jacobian terms for the P residual. When implemented in LMNS.C, the following terms will result:\\ $KPu, KPv, KPw, KPT$ - +\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Momentum Equation} +\subsection{Momentum Equation} The U residual is given in tensor notation as follows: \begin{equation} F_U = -\rho u_a u_{a,b} \phi^b + P \phi^{a,a} - \mu \left [u_{a,b} \phi_{a,b} + u_{b,a} \phi_{a,b} - \frac{2}{3} u_{a,a} \phi_{b,b} \right ] + \rho g_a \phi_a @@ -96,9 +96,9 @@ \section{Momentum Equation} Equations \ref{du_du}, \ref{du_dp}, and \ref{du_dT} above can then be implement in LMNS.C to create the following terms:\\ $Kuu, Kuv, Kuw, Kvu, Kvv, Kvw, Kwu, Kwv, Kww, KuT, KvT, KwT, KuP, KvP, KwP$ - +\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Energy Equation} +\subsection{Energy Equation} The T residual is given as follows: \begin{equation} F_T = -\rho c_p (u_a T_{a,b})\psi - k T_{a,b} \psi_{a,b} diff --git a/main.tex b/main.tex index 4089139..3a02b36 100644 --- a/main.tex +++ b/main.tex @@ -75,10 +75,10 @@ \chapter{Stokes} \bibliographystyle{abbrv} \bibliography{refs} -\part{Analytic Jacobians} - \chapter{Low Mach Navier Stokes} +\section{Analytic Jacobians} + \input{./derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex} \end{document} From 0eb89185cfeb3a9762b071964af9f23ccf155eca Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Tue, 6 Jan 2015 14:48:13 -0500 Subject: [PATCH 4/7] Made requested change to mass equation --- .../low_mach_navier_stokes.tex | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex index 487f065..c33ab20 100644 --- a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -1,8 +1,7 @@ \subsection{Background Information} The derivation detailed herein is for computing analytical Jacobians for the Low Mach Navier-Stokes equations. The final results are then implemented in GRINS src/physics/src/low\_mach\_navier\_stokes.C, with the goal being that there -will be a significant speedup in computation over using the standard finite difference approximation for computing the Jaconians. The derivation is broken up into 3 subsections: mass (P residual), momentum (U residual), and energy (T residual). -Each of these is computed in a separate function wihtin the LMNS.C file. The 3 residuals were already implemented, so they will be the starting point for this derivation. Note that a sign convention has been specified for -purposes of optimization.\\ +will be a significant speedup in computation over using the standard finite difference approximation. The derivation is broken up into 3 subsections: mass (P residual), momentum (U residual), and energy (T residual). +Note that a sign convention has been specified for purposes of optimization.\\ Also note that, in this case, the following parameters are considered functions of temperature, T: \begin{itemize} \item density, $\rho$ @@ -19,38 +18,38 @@ \subsection{Background Information} \subsection{Mass Equation} The given P residual: \begin{equation} - F_p = (-(U \cdot \nabla T) T^{-1} + \nabla \cdot U)\xi + F_{p,i} = (-(U \cdot \nabla T) T^{-1} + \nabla \cdot U)\xi_i \end{equation} Now converting to tensor notation \begin{equation} - F_p = -u_a T_{a,b} T^{-1} \xi + u_{a,b}\xi + F_{p,i} = -u_a T_{a,b} T^{-1} \xi_i + u_{a,b}\xi_i \end{equation} Galerkin approximation: \begin{align*} - u_a &= \sum u_i \phi_i^a\\ - T &= \sum T_i \psi_i + u_a &= \sum_i u_i \phi_i^a\\ + T &= \sum_i T_i \psi_i \end{align*} \begin{equation} - F_p = -u_i \phi_i^a T_j \psi_j^{a,b} (T_k \psi_k)^{-1} \xi + u_i \phi_i^{a,b} \xi + F_{p,i} = -u_k \phi_k^a T_l \psi_l^{a,b} (T_m \psi_m)^{-1} \xi_i + u_n \phi_n^{a,b} \xi_i \end{equation} -The P residual is a function of velocity, $U$, and temperature, $T$, so we must take derivatives with respect to both of them using the following form: +The P residual is a function of velocity, $U$, and temperature, $T$, so derivatives must be taken with respect to both of them using the following form: \begin{align*} - \frac{\partial}{\partial u_m} (u_i \phi_i^a) &= \phi_m^a \\ - \frac{\partial}{\partial T_m} (T_i \psi_i) &= \psi_m + \frac{\partial}{\partial u_j} (u_i \phi_i^a) &= \phi_j^a \\ + \frac{\partial}{\partial T_j} (T_i \psi_i) &= \psi_j \end{align*} \begin{align} - \frac{\partial F_p}{\partial u_m} = &-\phi_m^{a} T_j \psi_j^{a,b} (T_k \psi_k)^{-1} \xi + \phi_m^{a,b} \xi \nonumber \\ - \frac{\partial F_p}{\partial u_m} = &-\phi_m^{a} T_{a,b} T^{-1} \xi + \phi_m^{a,b} \xi \label {fp_du}\\ + \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_l \psi_l^{a,b} (T_m \psi_m)^{-1} \xi_i + \phi_j^{a,b} \xi_i \nonumber \\ + \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_{a,b} T^{-1} \xi_i + \phi_j^{a,b} \xi_i \label {fp_du}\\ \nonumber \\ - \frac{\partial F_p}{\partial T_m} = &-u_i \phi_i^a \xi \left [ T_j \psi_j^{a,b} (-1) (T_k \psi_k)^{-2} (\psi_m) + (T_k \psi_k)^{-1} \psi_m^{a,b} \right ] \nonumber \\ - \frac{\partial F_p}{\partial T_m} = &-u_a \xi \left [ -T_{a,b} T^{-2} \psi_m + T^{-1} \psi_m^{a,b} \right ] \label{fp_dT} + \frac{\partial F_{p,i}}{\partial T_j} = &-u_k \phi_k^a \xi_i \left [ T_l \psi_l^{a,b} (-1) (T_m \psi_m)^{-2} (\psi_j) + (T_m \psi_m)^{-1} \psi_j^{a,b} \right ] \nonumber \\ + \frac{\partial F_{p,i}}{\partial T_j} = &-u_a \xi_i \left [ -T_{a,b} T^{-2} \psi_j + T^{-1} \psi_j^{a,b} \right ] \label{fp_dT} \end{align} Equations \ref{fp_du} and \ref{fp_dT} above are the generalized Jacobian terms for the P residual. When implemented in LMNS.C, the following terms will result:\\ @@ -67,9 +66,9 @@ \subsection{Momentum Equation} Galerkin approximation \begin{align*} - u_a &= \sum u_i \phi_i^a\\ - P &= \sum P_i \xi_i\\ - T &= \sum T_i \psi_i + u_a &= \sum_i u_i \phi_i^a\\ + P &= \sum_i P_i \xi_i\\ + T &= \sum_i T_i \psi_i \end{align*} \begin{align} From 2c80a17a9099ca02143f39b11c9b73e676263d0f Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Wed, 7 Jan 2015 15:57:18 -0500 Subject: [PATCH 5/7] Modified Makefile to depend on all .tex files in the directory; Made improvements to derivations --- Makefile | 4 +- .../low_mach_navier_stokes.tex | 80 ++++++++++--------- 2 files changed, 47 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index ef1dcf4..e314f74 100644 --- a/Makefile +++ b/Makefile @@ -14,11 +14,13 @@ bibfiles := $(wildcard *.bib) styfiles := $(wildcard $(repo_path)/latex_common/*.sty) clsfiles := $(wildcard $(repo_path)/latex_common/*.cls) +texsources := $(shell find -name '*.tex') + all: $(texfinal) figures: $(figures) -$(texfinal): *.tex $(bibfiles) $(figures) $(clsfiles) $(styfiles) +$(texfinal): $(texsources) $(bibfiles) $(figures) $(clsfiles) $(styfiles) latexmk -pdf -f $(texroot).tex -jobname=grins clean: cleanlatex cleanfigs diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex index c33ab20..b4bd4a7 100644 --- a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -10,8 +10,9 @@ \subsection{Background Information} \item thermal conductivity, $k$ \end{itemize} For the formulations, \textbf{u}=\{$P,U,T$\} and the test functions \textbf{$\Phi$}=\{$\xi,\phi,\psi$\}.\\ -Lastly, the variable names used in the code follow this template: $Kxy$, where $x$ is the residual and $y$ is the derivation variable. For example, $KPT$ is the derivative of the P residual with respect to temperature, -while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressure. +The variable names used in the code follow this template: $Kxy$, where $x$ is the residual and $y$ is the derivation variable. For example, $KPT$ is the derivative of the P residual with respect to temperature, +while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressure. \newline +Lastly, a note on notation. Index notation is used throughout this section in order to make the derivations clearer. Indices $a-h$ and $r-z$ are used for vector components, while $i-q$ are used for degrees of freedom. \newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -24,7 +25,7 @@ \subsection{Mass Equation} Now converting to tensor notation \begin{equation} - F_{p,i} = -u_a T_{a,b} T^{-1} \xi_i + u_{a,b}\xi_i + F_{p,i} = -u_a T_{,a} T^{-1} \xi_i + u_{b,b}\xi_i \end{equation} Galerkin approximation: @@ -34,7 +35,7 @@ \subsection{Mass Equation} \end{align*} \begin{equation} - F_{p,i} = -u_k \phi_k^a T_l \psi_l^{a,b} (T_m \psi_m)^{-1} \xi_i + u_n \phi_n^{a,b} \xi_i + F_{p,i} = -u_k \phi_k^a T_l \psi_l^{,a} (T_m \psi_m)^{-1} \xi_i + u_n \phi_n^{b,b} \xi_i \end{equation} The P residual is a function of velocity, $U$, and temperature, $T$, so derivatives must be taken with respect to both of them using the following form: @@ -45,11 +46,11 @@ \subsection{Mass Equation} \end{align*} \begin{align} - \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_l \psi_l^{a,b} (T_m \psi_m)^{-1} \xi_i + \phi_j^{a,b} \xi_i \nonumber \\ - \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_{a,b} T^{-1} \xi_i + \phi_j^{a,b} \xi_i \label {fp_du}\\ + \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_l \psi_l^{,a} (T_m \psi_m)^{-1} \xi_i + \phi_j^{b,b} \xi_i \nonumber \\ + \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_{,a} T^{-1} \xi_i + \phi_j^{b,b} \xi_i \label {fp_du}\\ \nonumber \\ - \frac{\partial F_{p,i}}{\partial T_j} = &-u_k \phi_k^a \xi_i \left [ T_l \psi_l^{a,b} (-1) (T_m \psi_m)^{-2} (\psi_j) + (T_m \psi_m)^{-1} \psi_j^{a,b} \right ] \nonumber \\ - \frac{\partial F_{p,i}}{\partial T_j} = &-u_a \xi_i \left [ -T_{a,b} T^{-2} \psi_j + T^{-1} \psi_j^{a,b} \right ] \label{fp_dT} + \frac{\partial F_{p,i}}{\partial T_j} = &-u_k \phi_k^a \xi_i \left [ T_l \psi_l^{,a} (-1) (T_m \psi_m)^{-2} (\psi_j) + (T_n \psi_n)^{-1} \psi_j^{b,b} \right ] \nonumber \\ + \frac{\partial F_{p,i}}{\partial T_j} = &-u_a \xi_i \left [ -T_{,a} T^{-2} \psi_j + T^{-1} \psi_j^{b,b} \right ] \label{fp_dT} \end{align} Equations \ref{fp_du} and \ref{fp_dT} above are the generalized Jacobian terms for the P residual. When implemented in LMNS.C, the following terms will result:\\ @@ -58,12 +59,15 @@ \subsection{Mass Equation} \newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Momentum Equation} -The U residual is given in tensor notation as follows: -\begin{equation} - F_U = -\rho u_a u_{a,b} \phi^b + P \phi^{a,a} - \mu \left [u_{a,b} \phi_{a,b} + u_{b,a} \phi_{a,b} - \frac{2}{3} u_{a,a} \phi_{b,b} \right ] + \rho g_a \phi_a -\end{equation} +The U residual is given in vector and tensor notation as follows: +\begin{align} + F_{U,i} &= -\rho u \cdot \nabla u \cdot \phi_i + P(\nabla \cdot \phi_i) - \mu \left [\nabla u : \nabla \phi_i + (\nabla u)^T : \nabla \phi_i - \frac{2}{3} (\nabla \cdot u) I : \nabla \phi_i \right ] + \rho \mathbf{g} \cdot \phi_i \\ + F_{U,i}^a &= -\rho u_b u_{a,b} \phi_i^a + P\phi_i^{a,a} - \mu \left [u_{a,c} \phi_i^{a,c} + u_{d,a} \phi_i^{a,d} - \frac{2}{3} u_{e,e} \delta_{a,f} \phi_i^{a,f} \right ] + \rho g_a \phi_i^a \ (no \ sum \ on \ a) \label{Fui_tensor} +\end{align} + +Note that in \ref{Fui_tensor}, $\delta_{a,f}$ is the Dirac delta function. \\ -Galerkin approximation +Now, the Galerkin approximation \begin{align*} u_a &= \sum_i u_i \phi_i^a\\ @@ -72,24 +76,25 @@ \subsection{Momentum Equation} \end{align*} \begin{align} - F_U = -\rho u_i \phi_i^a u_j \phi_j^{a,b} \phi^b + P_i \xi_i \phi^{a,a} - \mu \left [u_i \phi_i^{a,b} \phi_{a,b} + u_i \phi_i^{b,a} \phi_{a,b} - \frac{2}{3} u_i \phi_i^{a,a} \phi_{b,b} \right ] + \rho g_a \phi_a \label{u_resid} + F_{U,i}^a = -\rho u_k \phi_k^b u_l \phi_l^{a,b} \phi_i^a + P_m \xi_m \phi_i^{a,a} - \mu \left [u_n \phi_n^{a,c} \phi_i^{a,c} + u_o \phi_o^{d,a} \phi_i^{a,d} - \frac{2}{3} u_p \phi_p^{e,e} \delta_{a,f} \phi_i^{a,f} \right ] + \rho g_a \phi_i^a \label{u_resid} \end{align} -Equation \ref{u_resid} above is a function of velocity, pressure, and temperature (due to $\rho = \rho(T)$ \\and $\mu = \mu(T)$ \ ), so derivatives must be taken with respect to all of them. +Equation \ref{u_resid} above is a function of velocity, pressure, and temperature (due to $\rho = \rho(T)$ and $\mu = \mu(T)$ \ ), so derivatives must be taken with respect to all of them. \begin{align} - \frac{\partial F_U}{\partial u_m} = &-\rho \left [ u_i \phi_i^a \phi_m^{a,b} + u_j \phi_j^{a,b} \phi_m^a \right ] \phi^b - - \mu \left [\phi_m^{a,b} \phi^{a,b} + \phi_m^{b,a} \phi^{a,b} - \frac{2}{3} \phi_m^{a,a} \phi^{b,b} \right ] \nonumber \\ - \frac{\partial F_U}{\partial u_m} = &-\rho \left [ u_a \phi_m^{a,b} + u_{a,b} \phi_m^a \right ] \phi^b - \mu \left [\phi_m^{a,b} \phi^{a,b} + \phi_m^{b,a} \phi^{a,b} - \frac{2}{3} \phi_m^{a,a} \phi^{b,b} \right ] \label{du_du}\\ + \frac{\partial F_{U,i}^a}{\partial u_j} = &-\rho \left [ u_k \phi_k^b \phi_j^{a,b} + u_l \phi_l^{a,g} \phi_j^g \right ] \phi_i^a + + 0 - \mu \left [\phi_j^{a,c} \phi_i^{a,c} + \phi_j^{d,a} \phi_i^{a,d} - \frac{2}{3} \phi_j^{e,e} \delta_{a,f} \phi_i^{a,f} \right ] \nonumber \\ + \frac{\partial F_{U,i}^a}{\partial u_j} = &-\rho \left [ u_b \phi_j^{a,b} + u_{a,g} \phi_j^g \right ] \phi_i^a + - \mu \left [\phi_j^{a,c} \phi_i^{a,c} + \phi_j^{d,a} \phi_i^{a,d} - \frac{2}{3} \phi_j^{e,e} \delta_{a,f} \phi_i^{a,f} \right ] \label{du_du} \\ \nonumber \\ - \frac{\partial F_U}{\partial P_m} = &\xi_m \phi^{a,a} \label{du_dp} \\ + \frac{\partial F_{U,i}^a}{\partial P_j} = &\xi_j \phi^{a,a} \label{du_dp} \\ \nonumber \\ - \frac{\partial F_U}{\partial T_m} = &-\frac{d\rho}{dT} \frac{d}{dT_m}(T_i \psi_i) u_i \phi_i^a u_j \phi_j^{a,b} \phi^b - - \left[ 0 + \frac{d\mu}{dT} \frac{d}{dT_m}(T_i \psi_i) [u_i \phi_i^{a,b} \phi_{a,b} + u_i \phi_i^{b,a} \phi_{a,b} - \frac{2}{3} u_i \phi_i^{a,a} \phi_{b,b} ] \right ] \nonumber - \\ &+ \frac{d\rho}{dT} \frac{d}{dT_m}(T_i \psi_i) g_a \phi_a \nonumber \\ - \frac{\partial F_U}{\partial T_m} = &-\frac{d\rho}{dT} \psi_m u_a u_{a,b} \phi^b - - \frac{d\mu}{dT} \psi_m \left [u_{a,b} \phi_{a,b} + u_{b,a} \phi_{a,b} - \frac{2}{3} u_{a,a} \phi_{b,b} \right ] - + \frac{d\rho}{dT} \psi_m g_a \phi_a \label{du_dT} + \frac{\partial F_{U,i}^a}{\partial T_j} = &-\frac{d\rho}{dT} \frac{d}{dT_j}(T_k \psi_k) u_l \phi_l^b u_m \phi_m^{a,b} \phi_i^a + + 0 \nonumber \\ &- \left[ 0 + \frac{d\mu}{dT} \frac{d}{dT_j}(T_n \psi_n) [u_o \phi_o^{a,c} \phi_i^{a,c} + u_p \phi_p^{d,a} \phi_i^{a,d} - \frac{2}{3} u_q \phi_q^{e,e} \delta_{a,f} \phi_i^{a,f} ] \right ] \nonumber + \\ &+ \frac{d\rho}{dT} \frac{d}{dT_m}(T_r \psi_r) g_a \phi_a \nonumber \\ + \frac{\partial F_{U,i}^a}{\partial T_j} = &-\frac{d\rho}{dT} \psi_j u_b u_{a,b} \phi_i^a + - \frac{d\mu}{dT} \psi_j \left [u_{a,c} \phi_i^{a,c} + u_{d,a} \phi_i^{a,d} - \frac{2}{3} u_{e,e} \delta_{a,f} \phi_i^{a,f} \right ] + + \frac{d\rho}{dT} \psi_j g_a \phi_i^a \label{du_dT} \end{align} Equations \ref{du_du}, \ref{du_dp}, and \ref{du_dT} above can then be implement in LMNS.C to create the following terms:\\ @@ -99,26 +104,29 @@ \subsection{Momentum Equation} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Energy Equation} The T residual is given as follows: -\begin{equation} - F_T = -\rho c_p (u_a T_{a,b})\psi - k T_{a,b} \psi_{a,b} -\end{equation} +\begin{align} + F_{T,i} &= -\rho c_p (u \cdot \nabla T) \psi_i - k ( \nabla T \cdot \nabla \psi_i) \\ + F_{T,i} &= -\rho c_p (u_a T_{,a})\psi_i - k T_{,b} \psi_i^{,b} +\end{align} Again, note that $\rho = \rho(T)$, $c_p = c_p(T)$, and $k = k(T)$ \begin{align} - F_T = -\rho c_p u_i \phi_i^a T_j \psi_j^{a,b} \psi_k - k T_i \psi_i^{a,b} \psi_j^{a,b} + F_{T,i} = -\rho c_p u_k \phi_k^a T_l \psi_l^{,a} \psi_i - k T_m \psi_m^{,b} \psi_i^{,b} \end{align} -Noting $F_T$ is a function of velocity and temperature. +Noting $F_{T,i}$ is a function of velocity and temperature. \begin{align} - \frac{\partial F_T}{\partial u_m} = &-\rho c_p \phi_m^a T_j \psi_j^{a,b} \psi_k - 0 \nonumber \\ - \frac{\partial F_T}{\partial u_m} = &-\rho c_p \phi_m^a T_{a,b} \psi_k \label{dT_du} \\ + \frac{\partial F_{T,i}}{\partial u_j} = &-\rho c_p \phi_j^a T_l \psi_l^{,a} \psi_i - 0 \nonumber \\ + \frac{\partial F_{T,i}}{\partial u_j} = &-\rho c_p \phi_j^a T_{,a} \psi_i \label{dT_du} \\ \nonumber \\ - \frac{\partial F_T}{\partial T_m} = &-u_i \phi_i^a \psi_k \left [ \rho [ c_p \psi_m^{a,b} + T_j \psi_j^{a,b} \frac{d c_p}{dT} \psi_m ] + [ c_p T_j \psi_j^{a,b} ] \frac{d \rho}{dT} \psi_m \right ] \nonumber \\ - &- k \psi_m^{a,b} \psi_j^{a,b} - T_i \psi_i^{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \nonumber \\ - \frac{\partial F_T}{\partial T_m} = &-u_a \psi_k \left [ \rho [ c_p \psi_m^{a,b} + T_{a,b} \frac{d c_p}{dT} \psi_m ] + [ c_p T_{a,b} ] \frac{d \rho}{dT} \psi_m \right ] \nonumber \\ - &- k \psi_m^{a,b} \psi_j^{a,b} - T_{a,b} \psi_j^{a,b} \frac{dk}{dT} \psi_m \label{dT_dT} + \frac{\partial F_{T,i}}{\partial T_j} = &-\psi_i \left [ \rho [ c_p u_k \phi_k^a \psi_j^{,a} + u_l \phi_l^b T_m \psi_m^{,b} \frac{d c_p}{dT} \psi_j ] + + [ c_p u_n \phi_n^{c} T_o \psi_o^{,c} ] \frac{d \rho}{dT} \psi_j \right ] \nonumber \\ + &- k \psi_j^{,d} \psi_i^{,d} - T_p \psi_p^{,e} \psi_i^{,e} \frac{dk}{dT} \psi_j \nonumber \\ + \frac{\partial F_{T,i}}{\partial T_j} = &-\psi_i \left [ \rho [ c_p u_a \psi_j^{,a} + u_b T_{,b} \frac{d c_p}{dT} \psi_j ] + + [ c_p u_c T_{,c} ] \frac{d \rho}{dT} \psi_j \right ] \nonumber \\ + &- k \psi_j^{,d} \psi_i^{,d} - T_{,e} \psi_i^{,e} \frac{dk}{dT} \psi_j \label{dT_dT} \end{align} Equations \ref{dT_du} and \ref{dT_dT} above will result in the following terms for LMNS.C:\\ From 953defd7e8d9a322b0d4e6997bbd5f4863d4b602 Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Thu, 8 Jan 2015 11:44:02 -0500 Subject: [PATCH 6/7] Few minor details cleaned up --- .../low_mach_navier_stokes.tex | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex index b4bd4a7..3458ea8 100644 --- a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -12,7 +12,10 @@ \subsection{Background Information} For the formulations, \textbf{u}=\{$P,U,T$\} and the test functions \textbf{$\Phi$}=\{$\xi,\phi,\psi$\}.\\ The variable names used in the code follow this template: $Kxy$, where $x$ is the residual and $y$ is the derivation variable. For example, $KPT$ is the derivative of the P residual with respect to temperature, while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressure. \newline -Lastly, a note on notation. Index notation is used throughout this section in order to make the derivations clearer. Indices $a-h$ and $r-z$ are used for vector components, while $i-q$ are used for degrees of freedom. +Lastly, a note on notation. Index notation is used throughout this section in order to make the derivations clearer. Indices $a-h$ are used for vector components, while $i-r$ are used for degrees of freedom. +Also note that Cartesian coordiantes are assumed for these derivations. As such, in the momentum equation in particular, terms of the following form may appear: $\phi_i^{a,b}$. In the index notation used herein for the case +where bot sub- and superscripts appear on a single variable, +subscripts refer exclusively to degrees of freedom, while superscripts are used exclusively for vector operations (i.e. divergence or gradient). \newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -79,7 +82,8 @@ \subsection{Momentum Equation} F_{U,i}^a = -\rho u_k \phi_k^b u_l \phi_l^{a,b} \phi_i^a + P_m \xi_m \phi_i^{a,a} - \mu \left [u_n \phi_n^{a,c} \phi_i^{a,c} + u_o \phi_o^{d,a} \phi_i^{a,d} - \frac{2}{3} u_p \phi_p^{e,e} \delta_{a,f} \phi_i^{a,f} \right ] + \rho g_a \phi_i^a \label{u_resid} \end{align} -Equation \ref{u_resid} above is a function of velocity, pressure, and temperature (due to $\rho = \rho(T)$ and $\mu = \mu(T)$ \ ), so derivatives must be taken with respect to all of them. +Equation \ref{u_resid} above is a function of velocity, pressure, and temperature (due to $\rho = \rho(T)$ and $\mu = \mu(T)$ \ ), so derivatives must be taken with respect to all of them.\\ +\textbf{Also note that, as stated in \ref{Fui_tensor}, there is no sum over index $a$}. \begin{align} \frac{\partial F_{U,i}^a}{\partial u_j} = &-\rho \left [ u_k \phi_k^b \phi_j^{a,b} + u_l \phi_l^{a,g} \phi_j^g \right ] \phi_i^a From b2bb83b23661a46802388122227a69f2e07ca853 Mon Sep 17 00:00:00 2001 From: Tim Adowski Date: Mon, 12 Jan 2015 21:29:28 -0500 Subject: [PATCH 7/7] Fixed a few small typos --- .../low_mach_navier_stokes.tex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex index 3458ea8..5f9afd1 100644 --- a/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex +++ b/derivations/low_mach_navier_stokes_jacobians/low_mach_navier_stokes.tex @@ -14,7 +14,7 @@ \subsection{Background Information} while $KuP$ is the derivative of the $u$-velocity component of the U residual with respect to pressure. \newline Lastly, a note on notation. Index notation is used throughout this section in order to make the derivations clearer. Indices $a-h$ are used for vector components, while $i-r$ are used for degrees of freedom. Also note that Cartesian coordiantes are assumed for these derivations. As such, in the momentum equation in particular, terms of the following form may appear: $\phi_i^{a,b}$. In the index notation used herein for the case -where bot sub- and superscripts appear on a single variable, +where both sub- and superscripts appear on a single variable, subscripts refer exclusively to degrees of freedom, while superscripts are used exclusively for vector operations (i.e. divergence or gradient). \newpage @@ -52,8 +52,9 @@ \subsection{Mass Equation} \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_l \psi_l^{,a} (T_m \psi_m)^{-1} \xi_i + \phi_j^{b,b} \xi_i \nonumber \\ \frac{\partial F_{p,i}}{\partial u_j} = &-\phi_j^{a} T_{,a} T^{-1} \xi_i + \phi_j^{b,b} \xi_i \label {fp_du}\\ \nonumber \\ - \frac{\partial F_{p,i}}{\partial T_j} = &-u_k \phi_k^a \xi_i \left [ T_l \psi_l^{,a} (-1) (T_m \psi_m)^{-2} (\psi_j) + (T_n \psi_n)^{-1} \psi_j^{b,b} \right ] \nonumber \\ - \frac{\partial F_{p,i}}{\partial T_j} = &-u_a \xi_i \left [ -T_{,a} T^{-2} \psi_j + T^{-1} \psi_j^{b,b} \right ] \label{fp_dT} + \frac{\partial F_{p,i}}{\partial T_j} = &-u_k \phi_k^a \xi_i \left [ T_l +\psi_l^{,c} (-1) (T_m \psi_m)^{-2} (\psi_j) + (T_n \psi_n)^{-1} \psi_j^{,d} \right ] + 0 \nonumber \\ + \frac{\partial F_{p,i}}{\partial T_j} = &u_c T_{,c} T^{-2} \psi_j \xi_i - u_d T^{-1} \psi_j^{,d} \xi_i \label{fp_dT} \end{align} Equations \ref{fp_du} and \ref{fp_dT} above are the generalized Jacobian terms for the P residual. When implemented in LMNS.C, the following terms will result:\\ @@ -68,7 +69,7 @@ \subsection{Momentum Equation} F_{U,i}^a &= -\rho u_b u_{a,b} \phi_i^a + P\phi_i^{a,a} - \mu \left [u_{a,c} \phi_i^{a,c} + u_{d,a} \phi_i^{a,d} - \frac{2}{3} u_{e,e} \delta_{a,f} \phi_i^{a,f} \right ] + \rho g_a \phi_i^a \ (no \ sum \ on \ a) \label{Fui_tensor} \end{align} -Note that in \ref{Fui_tensor}, $\delta_{a,f}$ is the Dirac delta function. \\ +Note that in \ref{Fui_tensor}, $\delta_{a,f}$ is the Kronecker delta function. \\ Now, the Galerkin approximation