%% Thermodynamics components and mathematically parameterized PV diagrams.
%% Black-and-white defaults; author-supplied physical units and labels.
\usetikzlibrary{tikzphysics.core}
\usetikzlibrary{patterns,arrows.meta,calc}
\makeatletter
%% thermal reservoir
\tikzset{
 reservoir width/.initial=3cm,
 physics reservoir width/.style={reservoir width={#1}},
 reservoir height/.initial=.8cm,
 physics reservoir height/.style={reservoir height={#1}},
}
\pgfdeclareshape{physicsthermalreservoirnode}{
 \savedmacro\tikzphysics@component@physicsthermalreservoirnodestate{%
  \tikzphysics@component@length\cw{reservoir width}
  \tikzphysics@component@length\ch{reservoir height}
\tikzphysics@component@check{\cw>0 && \ch>0}{Thermal component dimensions must be positive}
  \addtosavedmacro\cw
  \addtosavedmacro\ch
 }
 \anchor{center}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{heat-left}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{-\cw/2}{0}}
 \anchor{heat-right}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{heat-top}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{heat-bottom}{\tikzphysics@component@physicsthermalreservoirnodestate\tikzphysics@component@point{0}{-\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{bottom}{\tikzphysics@component@physicsthermalreservoirnodestate}{(-\cw/2+\tikzphysics@percent*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{right}{\tikzphysics@component@physicsthermalreservoirnodestate}{(\cw/2)*1cm}{(-\ch/2+\tikzphysics@percent*\ch)*1cm}
 \tikzphysics@declarepercentanchors{top}{\tikzphysics@component@physicsthermalreservoirnodestate}{(\cw/2-\tikzphysics@percent*\cw)*1cm}{(\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{left}{\tikzphysics@component@physicsthermalreservoirnodestate}{(-\cw/2)*1cm}{(\ch/2-\tikzphysics@percent*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsthermalreservoirnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsthermalreservoirnodestate
\tikzphysics@component@move{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{\ch/2}
\pgfpathclose
 }
}
\tikzphysics@declarehook{thermal reservoir}
\tikzphysics@registerdisplayname{physicsthermalreservoirnode}{thermal reservoir}
\tikzphysics@registeranchors{physicsthermalreservoirnode}{center,north,south,east,west,heat-left,heat-right,heat-top,heat-bottom}
\tikzphysics@registerfamilies{physicsthermalreservoirnode}{bottom,right,top,left}
\tikzphysics@registerkeys{physicsthermalreservoirnode}{reservoir width,reservoir height}
\tikzphysics@registerkeydefaults{physicsthermalreservoirnode}{reservoir width/3cm,reservoir height/.8cm}
\tikzset{physicsthermalreservoirnode/.style={shape=physicsthermalreservoirnode,physics logical shape=physicsthermalreservoirnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every thermal reservoir},thermal reservoir/.style={physicsthermalreservoirnode},hot reservoir/.style={physicsthermalreservoirnode},cold reservoir/.style={physicsthermalreservoirnode}}
%% gas chamber
\tikzset{
 chamber width/.initial=2.4cm,
 physics chamber width/.style={chamber width={#1}},
 chamber height/.initial=1.8cm,
 physics chamber height/.style={chamber height={#1}},
}
\pgfdeclareshape{physicsgaschambernode}{
 \savedmacro\tikzphysics@component@physicsgaschambernodestate{%
  \tikzphysics@component@length\cw{chamber width}
  \tikzphysics@component@length\ch{chamber height}
\tikzphysics@component@check{\cw>0 && \ch>0}{Thermal component dimensions must be positive}
  \addtosavedmacro\cw
  \addtosavedmacro\ch
 }
 \anchor{center}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{heat-left}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{-\cw/2}{0}}
 \anchor{heat-right}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{heat-top}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{heat-bottom}{\tikzphysics@component@physicsgaschambernodestate\tikzphysics@component@point{0}{-\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{bottom}{\tikzphysics@component@physicsgaschambernodestate}{(-\cw/2+\tikzphysics@percent*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{right}{\tikzphysics@component@physicsgaschambernodestate}{(\cw/2)*1cm}{(-\ch/2+\tikzphysics@percent*\ch)*1cm}
 \tikzphysics@declarepercentanchors{top}{\tikzphysics@component@physicsgaschambernodestate}{(\cw/2-\tikzphysics@percent*\cw)*1cm}{(\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{left}{\tikzphysics@component@physicsgaschambernodestate}{(-\cw/2)*1cm}{(\ch/2-\tikzphysics@percent*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsgaschambernodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsgaschambernodestate
\tikzphysics@component@move{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{\ch/2}
\pgfpathclose
 }
}
\tikzphysics@declarehook{gas chamber}
\tikzphysics@registerdisplayname{physicsgaschambernode}{gas chamber}
\tikzphysics@registeranchors{physicsgaschambernode}{center,north,south,east,west,heat-left,heat-right,heat-top,heat-bottom}
\tikzphysics@registerfamilies{physicsgaschambernode}{bottom,right,top,left}
\tikzphysics@registerkeys{physicsgaschambernode}{chamber width,chamber height}
\tikzphysics@registerkeydefaults{physicsgaschambernode}{chamber width/2.4cm,chamber height/1.8cm}
\tikzset{physicsgaschambernode/.style={shape=physicsgaschambernode,physics logical shape=physicsgaschambernode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every gas chamber},gas chamber/.style={physicsgaschambernode}}
%% thermal wall
\tikzset{
 thermal wall width/.initial=.3cm,
 physics thermal wall width/.style={thermal wall width={#1}},
 thermal wall height/.initial=2cm,
 physics thermal wall height/.style={thermal wall height={#1}},
}
\pgfdeclareshape{physicsthermalwallnode}{
 \savedmacro\tikzphysics@component@physicsthermalwallnodestate{%
  \tikzphysics@component@length\cw{thermal wall width}
  \tikzphysics@component@length\ch{thermal wall height}
\tikzphysics@component@check{\cw>0 && \ch>0}{Thermal component dimensions must be positive}
  \addtosavedmacro\cw
  \addtosavedmacro\ch
 }
 \anchor{center}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{heat-left}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{-\cw/2}{0}}
 \anchor{heat-right}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{heat-top}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{heat-bottom}{\tikzphysics@component@physicsthermalwallnodestate\tikzphysics@component@point{0}{-\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{bottom}{\tikzphysics@component@physicsthermalwallnodestate}{(-\cw/2+\tikzphysics@percent*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{right}{\tikzphysics@component@physicsthermalwallnodestate}{(\cw/2)*1cm}{(-\ch/2+\tikzphysics@percent*\ch)*1cm}
 \tikzphysics@declarepercentanchors{top}{\tikzphysics@component@physicsthermalwallnodestate}{(\cw/2-\tikzphysics@percent*\cw)*1cm}{(\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{left}{\tikzphysics@component@physicsthermalwallnodestate}{(-\cw/2)*1cm}{(\ch/2-\tikzphysics@percent*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsthermalwallnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsthermalwallnodestate
\tikzphysics@component@move{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{\ch/2}
\pgfpathclose
 }
}
\tikzphysics@declarehook{thermal wall}
\tikzphysics@registerdisplayname{physicsthermalwallnode}{thermal wall}
\tikzphysics@registeranchors{physicsthermalwallnode}{center,north,south,east,west,heat-left,heat-right,heat-top,heat-bottom}
\tikzphysics@registerfamilies{physicsthermalwallnode}{bottom,right,top,left}
\tikzphysics@registerkeys{physicsthermalwallnode}{thermal wall width,thermal wall height}
\tikzphysics@registerkeydefaults{physicsthermalwallnode}{thermal wall width/.3cm,thermal wall height/2cm}
\tikzset{physicsthermalwallnode/.style={shape=physicsthermalwallnode,physics logical shape=physicsthermalwallnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every thermal wall},thermal wall/.style={physicsthermalwallnode}}
%% heat engine
\tikzset{
 thermal device size/.initial=1.2cm,
 physics thermal device size/.style={thermal device size={#1}},
}
\pgfdeclareshape{physicsheatenginenode}{
 \savedmacro\tikzphysics@component@physicsheatenginenodestate{%
  \tikzphysics@component@length\cd{thermal device size}
\tikzphysics@component@check{\cd>0}{Thermal device size must be positive}
\pgfmathsetmacro\cr{\cd/2}
  \addtosavedmacro\cd
  \addtosavedmacro\cr
 }
 \anchor{center}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{\cr}}
 \anchor{south}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{-(\cr)}}
 \anchor{east}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{\cr}{0}}
 \anchor{west}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{-(\cr)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{1*\cr/sqrt(2)}{1*\cr/sqrt(2)}}
 \anchor{north west}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{-1*\cr/sqrt(2)}{1*\cr/sqrt(2)}}
 \anchor{south east}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{1*\cr/sqrt(2)}{-1*\cr/sqrt(2)}}
 \anchor{south west}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{-1*\cr/sqrt(2)}{-1*\cr/sqrt(2)}}
 \anchor{hot}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{\cr}}
 \anchor{cold}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{-\cr}}
 \anchor{work}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{\cr}{0}}
 \anchor{heat-in}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{\cr}}
 \anchor{heat-out}{\tikzphysics@component@physicsheatenginenodestate\tikzphysics@component@point{0}{-\cr}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{rim}{\tikzphysics@component@physicsheatenginenodestate}{(\cr*cos(360*\tikzphysics@percent))*1cm}{(\cr*sin(360*\tikzphysics@percent))*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsheatenginenodestate\pgfpointborderellipse{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\cr}}}
 \backgroundpath{\tikzphysics@component@physicsheatenginenodestate
\tikzphysics@component@ellipse{0}{0}{\cr}{\cr}
 }
}
\tikzphysics@declarehook{heat engine}
\tikzphysics@registerdisplayname{physicsheatenginenode}{heat engine}
\tikzphysics@registeranchors{physicsheatenginenode}{center,north,south,east,west,hot,cold,work,heat-in,heat-out}
\tikzphysics@registerfamilies{physicsheatenginenode}{rim}
\tikzphysics@registerkeys{physicsheatenginenode}{thermal device size}
\tikzphysics@registerkeydefaults{physicsheatenginenode}{thermal device size/1.2cm}
\tikzset{physicsheatenginenode/.style={shape=physicsheatenginenode,physics logical shape=physicsheatenginenode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every heat engine},heat engine/.style={physicsheatenginenode}}
%% refrigerator
\tikzset{
 thermal device size/.initial=1.2cm,
 physics thermal device size/.style={thermal device size={#1}},
}
\pgfdeclareshape{physicsrefrigeratornode}{
 \savedmacro\tikzphysics@component@physicsrefrigeratornodestate{%
  \tikzphysics@component@length\cd{thermal device size}
\tikzphysics@component@check{\cd>0}{Thermal device size must be positive}
\pgfmathsetmacro\cr{\cd/2}
  \addtosavedmacro\cd
  \addtosavedmacro\cr
 }
 \anchor{center}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{\cr}}
 \anchor{south}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{-(\cr)}}
 \anchor{east}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{\cr}{0}}
 \anchor{west}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{-(\cr)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{\cr}{\cr}}
 \anchor{north west}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{-(\cr)}{\cr}}
 \anchor{south east}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{\cr}{-(\cr)}}
 \anchor{south west}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{-(\cr)}{-(\cr)}}
 \anchor{hot}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{\cr}}
 \anchor{cold}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{-\cr}}
 \anchor{work}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{\cr}{0}}
 \anchor{heat-in}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{-\cr}}
 \anchor{heat-out}{\tikzphysics@component@physicsrefrigeratornodestate\tikzphysics@component@point{0}{\cr}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{bottom}{\tikzphysics@component@physicsrefrigeratornodestate}{((-1+2*\tikzphysics@percent)*\cr)*1cm}{(-\cr)*1cm}
 \tikzphysics@declarepercentanchors{right}{\tikzphysics@component@physicsrefrigeratornodestate}{(\cr)*1cm}{((-1+2*\tikzphysics@percent)*\cr)*1cm}
 \tikzphysics@declarepercentanchors{top}{\tikzphysics@component@physicsrefrigeratornodestate}{((1-2*\tikzphysics@percent)*\cr)*1cm}{(\cr)*1cm}
 \tikzphysics@declarepercentanchors{left}{\tikzphysics@component@physicsrefrigeratornodestate}{(-\cr)*1cm}{((1-2*\tikzphysics@percent)*\cr)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsrefrigeratornodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cr}{\cr}}}
 \backgroundpath{\tikzphysics@component@physicsrefrigeratornodestate
\tikzphysics@component@move{-\cr}{-\cr}
\tikzphysics@component@line{\cr}{-\cr}
\tikzphysics@component@line{\cr}{\cr}
\tikzphysics@component@line{-\cr}{\cr}
\pgfpathclose
 }
}
\tikzphysics@declarehook{refrigerator}
\tikzphysics@registerdisplayname{physicsrefrigeratornode}{refrigerator}
\tikzphysics@registeranchors{physicsrefrigeratornode}{center,north,south,east,west,hot,cold,work,heat-in,heat-out}
\tikzphysics@registerfamilies{physicsrefrigeratornode}{bottom,right,top,left}
\tikzphysics@registerkeys{physicsrefrigeratornode}{thermal device size}
\tikzphysics@registerkeydefaults{physicsrefrigeratornode}{thermal device size/1.2cm}
\tikzset{physicsrefrigeratornode/.style={shape=physicsrefrigeratornode,physics logical shape=physicsrefrigeratornode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every refrigerator},refrigerator/.style={physicsrefrigeratornode},heat pump/.style={physicsrefrigeratornode}}
\tikzset{insulated wall/.style={thermal wall,pattern=north east lines,pattern color=black},conducting wall/.style={thermal wall}}
%% Shared PV options. Hidden axes keep their anchors for common-frame overlays.
\tikzset{
 pv axes visible/.initial=1,
 pv show axes/.is choice,
 pv show axes/true/.code={\pgfkeyssetvalue{/tikz/pv axes visible}{1}},
 pv show axes/false/.code={\pgfkeyssetvalue{/tikz/pv axes visible}{0}},
 pv show axes/.default=true,
 physics pv show axes/.style={pv show axes={#1}},
}
%% isothermal process
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv start volume/.initial=1,
 physics pv start volume/.style={pv start volume={#1}},
 pv start pressure/.initial=3,
 physics pv start pressure/.style={pv start pressure={#1}},
 pv end volume/.initial=3,
 physics pv end volume/.style={pv end volume={#1}},
}
\pgfdeclareshape{physicsisothermalprocessnode}{
 \savedmacro\tikzphysics@component@physicsisothermalprocessnodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cva{\pgfkeysvalueof{/tikz/pv start volume}}
  \pgfmathsetmacro\cpa{\pgfkeysvalueof{/tikz/pv start pressure}}
  \pgfmathsetmacro\cvb{\pgfkeysvalueof{/tikz/pv end volume}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cva>0 && \cva<=\cvm && \cpa>0 && \cpa<=\cpm}{PV start state must lie inside positive axis limits}
\tikzphysics@component@check{\cvb>0 && \cvb<=\cvm && \cvb!=\cva}{PV end volume must be positive distinct and within the axis}
\pgfmathsetmacro\cn{1}\tikzphysics@component@check{ln(\cpa)+\cn*(ln(\cva)-ln(\cvb))<=ln(\cpm)}{PV end pressure must lie inside positive axis limits}
\pgfmathsetmacro\cpb{\cpa*(\cva/\cvb)^\cn}\tikzphysics@component@check{\cpb>0 && \cpb<=\cpm}{PV end pressure must lie inside positive axis limits}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cva
  \addtosavedmacro\cpa
  \addtosavedmacro\cvb
  \addtosavedmacro\cn
  \addtosavedmacro\cpb
 }
 \anchor{center}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{start}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{start-volume}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2}}
 \anchor{end-volume}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2}}
 \anchor{start-pressure}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end-pressure}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicsisothermalprocessnodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{process}{\tikzphysics@component@physicsisothermalprocessnodestate}{(-\cw/2+\cw*(\cva+\tikzphysics@percent*(\cvb-\cva))/\cvm)*1cm}{(-\ch/2+\ch*(\cpa*(\cva/(\cva+\tikzphysics@percent*(\cvb-\cva)))^\cn)/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicsisothermalprocessnodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicsisothermalprocessnodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsisothermalprocessnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsisothermalprocessnodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*(\cva+\cu*(\cvb-\cva))/\cvm}{-\ch/2+\ch*(\cpa*(\cva/(\cva+\cu*(\cvb-\cva)))^\cn)/\cpm}
}
 }
}
\tikzphysics@declarehook{isothermal process}
\tikzphysics@registerdisplayname{physicsisothermalprocessnode}{isothermal process}
\tikzphysics@registeranchors{physicsisothermalprocessnode}{center,north,south,east,west,start,end,start-volume,end-volume,origin,volume-end,pressure-end,start-pressure,end-pressure}
\tikzphysics@registerfamilies{physicsisothermalprocessnode}{process,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicsisothermalprocessnode}{pv width,pv height,pv max volume,pv max pressure,pv start volume,pv start pressure,pv end volume,pv show axes}
\tikzphysics@registerkeydefaults{physicsisothermalprocessnode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv start volume/1,pv start pressure/3,pv end volume/3,pv show axes/true}
\tikzset{physicsisothermalprocessnode/.style={shape=physicsisothermalprocessnode,physics logical shape=physicsisothermalprocessnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every isothermal process},isothermal process/.style={physicsisothermalprocessnode}}
%% isobaric process
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv start volume/.initial=1,
 physics pv start volume/.style={pv start volume={#1}},
 pv start pressure/.initial=3,
 physics pv start pressure/.style={pv start pressure={#1}},
 pv end volume/.initial=3,
 physics pv end volume/.style={pv end volume={#1}},
}
\pgfdeclareshape{physicsisobaricprocessnode}{
 \savedmacro\tikzphysics@component@physicsisobaricprocessnodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cva{\pgfkeysvalueof{/tikz/pv start volume}}
  \pgfmathsetmacro\cpa{\pgfkeysvalueof{/tikz/pv start pressure}}
  \pgfmathsetmacro\cvb{\pgfkeysvalueof{/tikz/pv end volume}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cva>0 && \cva<=\cvm && \cpa>0 && \cpa<=\cpm}{PV start state must lie inside positive axis limits}
\tikzphysics@component@check{\cvb>0 && \cvb<=\cvm && \cvb!=\cva}{PV end volume must be positive distinct and within the axis}
\pgfmathsetmacro\cn{0}\tikzphysics@component@check{ln(\cpa)+\cn*(ln(\cva)-ln(\cvb))<=ln(\cpm)}{PV end pressure must lie inside positive axis limits}
\pgfmathsetmacro\cpb{\cpa*(\cva/\cvb)^\cn}\tikzphysics@component@check{\cpb>0 && \cpb<=\cpm}{PV end pressure must lie inside positive axis limits}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cva
  \addtosavedmacro\cpa
  \addtosavedmacro\cvb
  \addtosavedmacro\cn
  \addtosavedmacro\cpb
 }
 \anchor{center}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{start}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{start-volume}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2}}
 \anchor{end-volume}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2}}
 \anchor{start-pressure}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end-pressure}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicsisobaricprocessnodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{process}{\tikzphysics@component@physicsisobaricprocessnodestate}{(-\cw/2+\cw*(\cva+\tikzphysics@percent*(\cvb-\cva))/\cvm)*1cm}{(-\ch/2+\ch*(\cpa*(\cva/(\cva+\tikzphysics@percent*(\cvb-\cva)))^\cn)/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicsisobaricprocessnodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicsisobaricprocessnodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsisobaricprocessnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsisobaricprocessnodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*(\cva+\cu*(\cvb-\cva))/\cvm}{-\ch/2+\ch*(\cpa*(\cva/(\cva+\cu*(\cvb-\cva)))^\cn)/\cpm}
}
 }
}
\tikzphysics@declarehook{isobaric process}
\tikzphysics@registerdisplayname{physicsisobaricprocessnode}{isobaric process}
\tikzphysics@registeranchors{physicsisobaricprocessnode}{center,north,south,east,west,start,end,start-volume,end-volume,origin,volume-end,pressure-end,start-pressure,end-pressure}
\tikzphysics@registerfamilies{physicsisobaricprocessnode}{process,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicsisobaricprocessnode}{pv width,pv height,pv max volume,pv max pressure,pv start volume,pv start pressure,pv end volume,pv show axes}
\tikzphysics@registerkeydefaults{physicsisobaricprocessnode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv start volume/1,pv start pressure/3,pv end volume/3,pv show axes/true}
\tikzset{physicsisobaricprocessnode/.style={shape=physicsisobaricprocessnode,physics logical shape=physicsisobaricprocessnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every isobaric process},isobaric process/.style={physicsisobaricprocessnode}}
%% isochoric process
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv start volume/.initial=1,
 physics pv start volume/.style={pv start volume={#1}},
 pv start pressure/.initial=3,
 physics pv start pressure/.style={pv start pressure={#1}},
 pv end pressure/.initial=1.5,
 physics pv end pressure/.style={pv end pressure={#1}},
}
\pgfdeclareshape{physicsisochoricprocessnode}{
 \savedmacro\tikzphysics@component@physicsisochoricprocessnodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cva{\pgfkeysvalueof{/tikz/pv start volume}}
  \pgfmathsetmacro\cpa{\pgfkeysvalueof{/tikz/pv start pressure}}
  \pgfmathsetmacro\cpb{\pgfkeysvalueof{/tikz/pv end pressure}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cva>0 && \cva<=\cvm && \cpa>0 && \cpa<=\cpm}{PV start state must lie inside positive axis limits}
\pgfmathsetmacro\cvb{\cva}\tikzphysics@component@check{\cpb>0 && \cpb<=\cpm}{PV end pressure must lie inside positive axis limits}
\tikzphysics@component@check{\cpb!=\cpa}{Isochoric start and end pressures must differ}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cva
  \addtosavedmacro\cpa
  \addtosavedmacro\cpb
  \addtosavedmacro\cvb
 }
 \anchor{center}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{start}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{start-volume}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2}}
 \anchor{end-volume}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2}}
 \anchor{start-pressure}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end-pressure}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicsisochoricprocessnodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{process}{\tikzphysics@component@physicsisochoricprocessnodestate}{(-\cw/2+\cw*(\cva)/\cvm)*1cm}{(-\ch/2+\ch*(\cpa+\tikzphysics@percent*(\cpb-\cpa))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicsisochoricprocessnodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicsisochoricprocessnodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsisochoricprocessnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsisochoricprocessnodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa+\cu*(\cpb-\cpa))/\cpm}
}
 }
}
\tikzphysics@declarehook{isochoric process}
\tikzphysics@registerdisplayname{physicsisochoricprocessnode}{isochoric process}
\tikzphysics@registeranchors{physicsisochoricprocessnode}{center,north,south,east,west,start,end,start-volume,end-volume,origin,volume-end,pressure-end,start-pressure,end-pressure}
\tikzphysics@registerfamilies{physicsisochoricprocessnode}{process,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicsisochoricprocessnode}{pv width,pv height,pv max volume,pv max pressure,pv start volume,pv start pressure,pv end pressure,pv show axes}
\tikzphysics@registerkeydefaults{physicsisochoricprocessnode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv start volume/1,pv start pressure/3,pv end pressure/1.5,pv show axes/true}
\tikzset{physicsisochoricprocessnode/.style={shape=physicsisochoricprocessnode,physics logical shape=physicsisochoricprocessnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every isochoric process},isochoric process/.style={physicsisochoricprocessnode}}
%% adiabatic process
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv start volume/.initial=1,
 physics pv start volume/.style={pv start volume={#1}},
 pv start pressure/.initial=3,
 physics pv start pressure/.style={pv start pressure={#1}},
 pv end volume/.initial=3,
 physics pv end volume/.style={pv end volume={#1}},
 pv gamma/.initial=1.4,
 physics pv gamma/.style={pv gamma={#1}},
}
\pgfdeclareshape{physicsadiabaticprocessnode}{
 \savedmacro\tikzphysics@component@physicsadiabaticprocessnodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cva{\pgfkeysvalueof{/tikz/pv start volume}}
  \pgfmathsetmacro\cpa{\pgfkeysvalueof{/tikz/pv start pressure}}
  \pgfmathsetmacro\cvb{\pgfkeysvalueof{/tikz/pv end volume}}
  \pgfmathsetmacro\cn{\pgfkeysvalueof{/tikz/pv gamma}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cva>0 && \cva<=\cvm && \cpa>0 && \cpa<=\cpm}{PV start state must lie inside positive axis limits}
\tikzphysics@component@check{\cvb>0 && \cvb<=\cvm && \cvb!=\cva}{PV end volume must be positive distinct and within the axis}
\tikzphysics@component@check{\cn>1}{Adiabatic gamma must exceed 1}
\tikzphysics@component@check{ln(\cpa)+\cn*(ln(\cva)-ln(\cvb))<=ln(\cpm)}{PV end pressure must lie inside positive axis limits}
\pgfmathsetmacro\cpb{\cpa*(\cva/\cvb)^\cn}\tikzphysics@component@check{\cpb>0 && \cpb<=\cpm}{PV end pressure must lie inside positive axis limits}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cva
  \addtosavedmacro\cpa
  \addtosavedmacro\cvb
  \addtosavedmacro\cn
  \addtosavedmacro\cpb
 }
 \anchor{center}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{start}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{start-volume}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2}}
 \anchor{end-volume}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2}}
 \anchor{start-pressure}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end-pressure}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicsadiabaticprocessnodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{process}{\tikzphysics@component@physicsadiabaticprocessnodestate}{(-\cw/2+\cw*(\cva+\tikzphysics@percent*(\cvb-\cva))/\cvm)*1cm}{(-\ch/2+\ch*(\cpa*(\cva/(\cva+\tikzphysics@percent*(\cvb-\cva)))^\cn)/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicsadiabaticprocessnodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicsadiabaticprocessnodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsadiabaticprocessnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsadiabaticprocessnodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*(\cva+\cu*(\cvb-\cva))/\cvm}{-\ch/2+\ch*(\cpa*(\cva/(\cva+\cu*(\cvb-\cva)))^\cn)/\cpm}
}
 }
}
\tikzphysics@declarehook{adiabatic process}
\tikzphysics@registerdisplayname{physicsadiabaticprocessnode}{adiabatic process}
\tikzphysics@registeranchors{physicsadiabaticprocessnode}{center,north,south,east,west,start,end,start-volume,end-volume,origin,volume-end,pressure-end,start-pressure,end-pressure}
\tikzphysics@registerfamilies{physicsadiabaticprocessnode}{process,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicsadiabaticprocessnode}{pv width,pv height,pv max volume,pv max pressure,pv start volume,pv start pressure,pv end volume,pv gamma,pv show axes}
\tikzphysics@registerkeydefaults{physicsadiabaticprocessnode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv start volume/1,pv start pressure/3,pv end volume/3,pv gamma/1.4,pv show axes/true}
\tikzset{physicsadiabaticprocessnode/.style={shape=physicsadiabaticprocessnode,physics logical shape=physicsadiabaticprocessnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every adiabatic process},adiabatic process/.style={physicsadiabaticprocessnode}}
%% polytropic process
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv start volume/.initial=1,
 physics pv start volume/.style={pv start volume={#1}},
 pv start pressure/.initial=3,
 physics pv start pressure/.style={pv start pressure={#1}},
 pv end volume/.initial=3,
 physics pv end volume/.style={pv end volume={#1}},
 pv exponent/.initial=1.2,
 physics pv exponent/.style={pv exponent={#1}},
}
\pgfdeclareshape{physicspolytropicprocessnode}{
 \savedmacro\tikzphysics@component@physicspolytropicprocessnodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cva{\pgfkeysvalueof{/tikz/pv start volume}}
  \pgfmathsetmacro\cpa{\pgfkeysvalueof{/tikz/pv start pressure}}
  \pgfmathsetmacro\cvb{\pgfkeysvalueof{/tikz/pv end volume}}
  \pgfmathsetmacro\cn{\pgfkeysvalueof{/tikz/pv exponent}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cva>0 && \cva<=\cvm && \cpa>0 && \cpa<=\cpm}{PV start state must lie inside positive axis limits}
\tikzphysics@component@check{\cvb>0 && \cvb<=\cvm && \cvb!=\cva}{PV end volume must be positive distinct and within the axis}
\tikzphysics@component@check{abs(\cn)<=10}{Polytropic exponent magnitude must not exceed 10}
\tikzphysics@component@check{ln(\cpa)+\cn*(ln(\cva)-ln(\cvb))<=ln(\cpm)}{PV end pressure must lie inside positive axis limits}
\pgfmathsetmacro\cpb{\cpa*(\cva/\cvb)^\cn}\tikzphysics@component@check{\cpb>0 && \cpb<=\cpm}{PV end pressure must lie inside positive axis limits}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cva
  \addtosavedmacro\cpa
  \addtosavedmacro\cvb
  \addtosavedmacro\cn
  \addtosavedmacro\cpb
 }
 \anchor{center}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{start}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{start-volume}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2}}
 \anchor{end-volume}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2}}
 \anchor{start-pressure}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpa)/\cpm}}
 \anchor{end-pressure}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpb)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicspolytropicprocessnodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{process}{\tikzphysics@component@physicspolytropicprocessnodestate}{(-\cw/2+\cw*(\cva+\tikzphysics@percent*(\cvb-\cva))/\cvm)*1cm}{(-\ch/2+\ch*(\cpa*(\cva/(\cva+\tikzphysics@percent*(\cvb-\cva)))^\cn)/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicspolytropicprocessnodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicspolytropicprocessnodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicspolytropicprocessnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicspolytropicprocessnodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\cpa)/\cpm}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*(\cva+\cu*(\cvb-\cva))/\cvm}{-\ch/2+\ch*(\cpa*(\cva/(\cva+\cu*(\cvb-\cva)))^\cn)/\cpm}
}
 }
}
\tikzphysics@declarehook{polytropic process}
\tikzphysics@registerdisplayname{physicspolytropicprocessnode}{polytropic process}
\tikzphysics@registeranchors{physicspolytropicprocessnode}{center,north,south,east,west,start,end,start-volume,end-volume,origin,volume-end,pressure-end,start-pressure,end-pressure}
\tikzphysics@registerfamilies{physicspolytropicprocessnode}{process,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicspolytropicprocessnode}{pv width,pv height,pv max volume,pv max pressure,pv start volume,pv start pressure,pv end volume,pv exponent,pv show axes}
\tikzphysics@registerkeydefaults{physicspolytropicprocessnode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv start volume/1,pv start pressure/3,pv end volume/3,pv exponent/1.2,pv show axes/true}
\tikzset{physicspolytropicprocessnode/.style={shape=physicspolytropicprocessnode,physics logical shape=physicspolytropicprocessnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every polytropic process},polytropic process/.style={physicspolytropicprocessnode}}
%% rectangular cycle
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv low volume/.initial=1,
 physics pv low volume/.style={pv low volume={#1}},
 pv high volume/.initial=3,
 physics pv high volume/.style={pv high volume={#1}},
 pv low pressure/.initial=1,
 physics pv low pressure/.style={pv low pressure={#1}},
 pv high pressure/.initial=3,
 physics pv high pressure/.style={pv high pressure={#1}},
}
\pgfdeclareshape{physicsrectangularcyclenode}{
 \savedmacro\tikzphysics@component@physicsrectangularcyclenodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cvl{\pgfkeysvalueof{/tikz/pv low volume}}
  \pgfmathsetmacro\cvh{\pgfkeysvalueof{/tikz/pv high volume}}
  \pgfmathsetmacro\cpl{\pgfkeysvalueof{/tikz/pv low pressure}}
  \pgfmathsetmacro\cph{\pgfkeysvalueof{/tikz/pv high pressure}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cvl>0 && \cvh>\cvl && \cvh<=\cvm && \cpl>0 && \cph>\cpl && \cph<=\cpm}{Cycle states must be positive ordered and inside axis limits}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cvl
  \addtosavedmacro\cvh
  \addtosavedmacro\cpl
  \addtosavedmacro\cph
 }
 \anchor{center}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{state-A}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvl)/\cvm}{-\ch/2+\ch*(\cpl)/\cpm}}
 \anchor{state-B}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvl)/\cvm}{-\ch/2+\ch*(\cph)/\cpm}}
 \anchor{state-C}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvh)/\cvm}{-\ch/2+\ch*(\cph)/\cpm}}
 \anchor{state-D}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvh)/\cvm}{-\ch/2+\ch*(\cpl)/\cpm}}
 \anchor{state-A-volume}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvl)/\cvm}{-\ch/2}}
 \anchor{state-A-pressure}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpl)/\cpm}}
 \anchor{state-B-volume}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvl)/\cvm}{-\ch/2}}
 \anchor{state-B-pressure}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cph)/\cpm}}
 \anchor{state-C-volume}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvh)/\cvm}{-\ch/2}}
 \anchor{state-C-pressure}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cph)/\cpm}}
 \anchor{state-D-volume}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvh)/\cvm}{-\ch/2}}
 \anchor{state-D-pressure}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\cpl)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicsrectangularcyclenodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{AB}{\tikzphysics@component@physicsrectangularcyclenodestate}{(-\cw/2+\cw*(\cvl)/\cvm)*1cm}{(-\ch/2+\ch*(\cpl+\tikzphysics@percent*(\cph-\cpl))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{BC}{\tikzphysics@component@physicsrectangularcyclenodestate}{(-\cw/2+\cw*(\cvl+\tikzphysics@percent*(\cvh-\cvl))/\cvm)*1cm}{(-\ch/2+\ch*(\cph)/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{CD}{\tikzphysics@component@physicsrectangularcyclenodestate}{(-\cw/2+\cw*(\cvh)/\cvm)*1cm}{(-\ch/2+\ch*(\cph-\tikzphysics@percent*(\cph-\cpl))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{DA}{\tikzphysics@component@physicsrectangularcyclenodestate}{(-\cw/2+\cw*(\cvh-\tikzphysics@percent*(\cvh-\cvl))/\cvm)*1cm}{(-\ch/2+\ch*(\cpl)/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicsrectangularcyclenodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicsrectangularcyclenodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicsrectangularcyclenodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicsrectangularcyclenodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cvl)/\cvm}{-\ch/2+\ch*(\cpl)/\cpm}
\tikzphysics@component@line{-\cw/2+\cw*(\cvl)/\cvm}{-\ch/2+\ch*(\cph)/\cpm}
\tikzphysics@component@line{-\cw/2+\cw*(\cvh)/\cvm}{-\ch/2+\ch*(\cph)/\cpm}
\tikzphysics@component@line{-\cw/2+\cw*(\cvh)/\cvm}{-\ch/2+\ch*(\cpl)/\cpm}
\pgfpathclose
 }
}
\tikzphysics@declarehook{rectangular cycle}
\tikzphysics@registerdisplayname{physicsrectangularcyclenode}{rectangular cycle}
\tikzphysics@registeranchors{physicsrectangularcyclenode}{center,north,south,east,west,state-A,state-B,state-C,state-D,origin,volume-end,pressure-end,state-A-volume,state-A-pressure,state-B-volume,state-B-pressure,state-C-volume,state-C-pressure,state-D-volume,state-D-pressure}
\tikzphysics@registerfamilies{physicsrectangularcyclenode}{AB,BC,CD,DA,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicsrectangularcyclenode}{pv width,pv height,pv max volume,pv max pressure,pv low volume,pv high volume,pv low pressure,pv high pressure,pv show axes}
\tikzphysics@registerkeydefaults{physicsrectangularcyclenode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv low volume/1,pv high volume/3,pv low pressure/1,pv high pressure/3,pv show axes/true}
\tikzset{physicsrectangularcyclenode/.style={shape=physicsrectangularcyclenode,physics logical shape=physicsrectangularcyclenode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every rectangular cycle},rectangular cycle/.style={physicsrectangularcyclenode}}
%% carnot cycle
\tikzset{
 pv width/.initial=4cm,
 physics pv width/.style={pv width={#1}},
 pv height/.initial=3cm,
 physics pv height/.style={pv height={#1}},
 pv max volume/.initial=4,
 physics pv max volume/.style={pv max volume={#1}},
 pv max pressure/.initial=4,
 physics pv max pressure/.style={pv max pressure={#1}},
 pv start volume/.initial=1,
 physics pv start volume/.style={pv start volume={#1}},
 carnot hot constant/.initial=3,
 physics carnot hot constant/.style={carnot hot constant={#1}},
 carnot temperature ratio/.initial=.75,
 physics carnot temperature ratio/.style={carnot temperature ratio={#1}},
 carnot expansion ratio/.initial=1.5,
 physics carnot expansion ratio/.style={carnot expansion ratio={#1}},
 pv gamma/.initial=1.4,
 physics pv gamma/.style={pv gamma={#1}},
}
\pgfdeclareshape{physicscarnotcyclenode}{
 \savedmacro\tikzphysics@component@physicscarnotcyclenodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
  \pgfmathsetmacro\cva{\pgfkeysvalueof{/tikz/pv start volume}}
  \pgfmathsetmacro\ckh{\pgfkeysvalueof{/tikz/carnot hot constant}}
  \pgfmathsetmacro\ctr{\pgfkeysvalueof{/tikz/carnot temperature ratio}}
  \pgfmathsetmacro\cer{\pgfkeysvalueof{/tikz/carnot expansion ratio}}
  \pgfmathsetmacro\cg{\pgfkeysvalueof{/tikz/pv gamma}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
\tikzphysics@component@check{\cva>0 && \ckh>0 && \ctr>0 && \ctr<1 && \cer>1 && \cg>1}{Carnot requires positive state gamma > 1 expansion > 1 and 0 < cold/hot < 1}
%% Log-space bounds precede the power, so out-of-frame cycles get a package error.
\tikzphysics@component@check{-ln(\ctr)<=(\cg-1)*(ln(\cvm)-ln(\cva)-ln(\cer)) && ln(\ckh)-ln(\cva)<=ln(\cpm)}{Carnot cycle exceeds the PV axis limits}
\pgfmathsetmacro\cf{(1/\ctr)^(1/(\cg-1))}
\pgfmathsetmacro\cvb{\cva*\cer}
\pgfmathsetmacro\cvd{\cva*\cf}
\pgfmathsetmacro\cvc{\cvb*\cf}
\pgfmathsetmacro\ckc{\ckh*\ctr}
\tikzphysics@component@check{\cvc<=\cvm && \ckh/\cva<=\cpm}{Carnot cycle exceeds the PV axis limits}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
  \addtosavedmacro\cva
  \addtosavedmacro\ckh
  \addtosavedmacro\ctr
  \addtosavedmacro\cer
  \addtosavedmacro\cg
  \addtosavedmacro\cf
  \addtosavedmacro\cvb
  \addtosavedmacro\cvd
  \addtosavedmacro\cvc
  \addtosavedmacro\ckc
 }
 \anchor{center}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{state-A}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\ckh/\cva)/\cpm}}
 \anchor{state-B}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2+\ch*(\ckh/\cvb)/\cpm}}
 \anchor{state-C}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvc)/\cvm}{-\ch/2+\ch*(\ckc/\cvc)/\cpm}}
 \anchor{state-D}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvd)/\cvm}{-\ch/2+\ch*(\ckc/\cvd)/\cpm}}
 \anchor{state-A-volume}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2}}
 \anchor{state-A-pressure}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\ckh/\cva)/\cpm}}
 \anchor{state-B-volume}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvb)/\cvm}{-\ch/2}}
 \anchor{state-B-pressure}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\ckh/\cvb)/\cpm}}
 \anchor{state-C-volume}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvc)/\cvm}{-\ch/2}}
 \anchor{state-C-pressure}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\ckc/\cvc)/\cpm}}
 \anchor{state-D-volume}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2+\cw*(\cvd)/\cvm}{-\ch/2}}
 \anchor{state-D-pressure}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2+\ch*(\ckc/\cvd)/\cpm}}
 \anchor{origin}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicscarnotcyclenodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{hot}{\tikzphysics@component@physicscarnotcyclenodestate}{(-\cw/2+\cw*((\cva)+\tikzphysics@percent*((\cvb)-(\cva)))/\cvm)*1cm}{(-\ch/2+\ch*((\ckh/\cva)*((\cva)/((\cva)+\tikzphysics@percent*((\cvb)-(\cva))))^(1))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{expansion}{\tikzphysics@component@physicscarnotcyclenodestate}{(-\cw/2+\cw*((\cvb)+\tikzphysics@percent*((\cvc)-(\cvb)))/\cvm)*1cm}{(-\ch/2+\ch*((\ckh/\cvb)*((\cvb)/((\cvb)+\tikzphysics@percent*((\cvc)-(\cvb))))^(\cg))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{cold}{\tikzphysics@component@physicscarnotcyclenodestate}{(-\cw/2+\cw*((\cvc)+\tikzphysics@percent*((\cvd)-(\cvc)))/\cvm)*1cm}{(-\ch/2+\ch*((\ckc/\cvc)*((\cvc)/((\cvc)+\tikzphysics@percent*((\cvd)-(\cvc))))^(1))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{compression}{\tikzphysics@component@physicscarnotcyclenodestate}{(-\cw/2+\cw*((\cvd)+\tikzphysics@percent*((\cva)-(\cvd)))/\cvm)*1cm}{(-\ch/2+\ch*((\ckc/\cvd)*((\cvd)/((\cvd)+\tikzphysics@percent*((\cva)-(\cvd))))^(\cg))/\cpm)*1cm}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicscarnotcyclenodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicscarnotcyclenodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicscarnotcyclenodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicscarnotcyclenodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
\tikzphysics@component@move{-\cw/2+\cw*(\cva)/\cvm}{-\ch/2+\ch*(\ckh/\cva)/\cpm}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*((\cva)+\cu*((\cvb)-(\cva)))/\cvm}{-\ch/2+\ch*((\ckh/\cva)*((\cva)/((\cva)+\cu*((\cvb)-(\cva))))^(1))/\cpm}
}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*((\cvb)+\cu*((\cvc)-(\cvb)))/\cvm}{-\ch/2+\ch*((\ckh/\cvb)*((\cvb)/((\cvb)+\cu*((\cvc)-(\cvb))))^(\cg))/\cpm}
}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*((\cvc)+\cu*((\cvd)-(\cvc)))/\cvm}{-\ch/2+\ch*((\ckc/\cvc)*((\cvc)/((\cvc)+\cu*((\cvd)-(\cvc))))^(1))/\cpm}
}
\foreach \ci in {0,...,100}{\pgfmathsetmacro\cu{\ci/100}\tikzphysics@component@line{-\cw/2+\cw*((\cvd)+\cu*((\cva)-(\cvd)))/\cvm}{-\ch/2+\ch*((\ckc/\cvd)*((\cvd)/((\cvd)+\cu*((\cva)-(\cvd))))^(\cg))/\cpm}
}
\pgfpathclose
 }
}
\tikzphysics@declarehook{carnot cycle}
\tikzphysics@registerdisplayname{physicscarnotcyclenode}{carnot cycle}
\tikzphysics@registeranchors{physicscarnotcyclenode}{center,north,south,east,west,state-A,state-B,state-C,state-D,origin,volume-end,pressure-end,state-A-volume,state-A-pressure,state-B-volume,state-B-pressure,state-C-volume,state-C-pressure,state-D-volume,state-D-pressure}
\tikzphysics@registerfamilies{physicscarnotcyclenode}{hot,expansion,cold,compression,volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicscarnotcyclenode}{pv width,pv height,pv max volume,pv max pressure,pv start volume,carnot hot constant,carnot temperature ratio,carnot expansion ratio,pv gamma,pv show axes}
\tikzphysics@registerkeydefaults{physicscarnotcyclenode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv start volume/1,carnot hot constant/3,carnot temperature ratio/.75,carnot expansion ratio/1.5,pv gamma/1.4,pv show axes/true}
\tikzset{physicscarnotcyclenode/.style={shape=physicscarnotcyclenode,physics logical shape=physicscarnotcyclenode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every carnot cycle},carnot cycle/.style={physicscarnotcyclenode}}
%% Shared PV frame for overlaid processes.
\pgfdeclareshape{physicspvdiagramnode}{
 \savedmacro\tikzphysics@component@physicspvdiagramnodestate{%
  \tikzphysics@component@length\cw{pv width}
  \tikzphysics@component@length\ch{pv height}
  \pgfmathsetmacro\cvm{\pgfkeysvalueof{/tikz/pv max volume}}
  \pgfmathsetmacro\cpm{\pgfkeysvalueof{/tikz/pv max pressure}}
\tikzphysics@component@check{\cw>0 && \ch>0 && \cvm>0 && \cpm>0}{PV dimensions and axis maxima must be positive}
  \pgfmathtruncatemacro\caxes{\pgfkeysvalueof{/tikz/pv axes visible}}
  \addtosavedmacro\caxes
  \addtosavedmacro\cw
  \addtosavedmacro\ch
  \addtosavedmacro\cvm
  \addtosavedmacro\cpm
 }
 \anchor{center}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{0}{0}}
 \anchor{north}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{0}{\ch/2}}
 \anchor{south}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{0}{-(\ch/2)}}
 \anchor{east}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{\cw/2}{0}}
 \anchor{west}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{-(\cw/2)}{0}}
 \anchor{north east}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{\cw/2}{\ch/2}}
 \anchor{north west}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{-(\cw/2)}{\ch/2}}
 \anchor{south east}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{\cw/2}{-(\ch/2)}}
 \anchor{south west}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{-(\cw/2)}{-(\ch/2)}}
 \anchor{origin}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{-\cw/2}{-\ch/2}}
 \anchor{volume-end}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{\cw/2}{-\ch/2}}
 \anchor{pressure-end}{\tikzphysics@component@physicspvdiagramnodestate\tikzphysics@component@point{-\cw/2}{\ch/2}}
 \anchor{text}{\pgf@x=-.5\wd\pgfnodeparttextbox\pgf@y=-.5\ht\pgfnodeparttextbox\advance\pgf@y by.5\dp\pgfnodeparttextbox}
 \tikzphysics@declarepercentanchors{volume-axis}{\tikzphysics@component@physicspvdiagramnodestate}{((-.5+\tikzphysics@percent)*\cw)*1cm}{(-\ch/2)*1cm}
 \tikzphysics@declarepercentanchors{pressure-axis}{\tikzphysics@component@physicspvdiagramnodestate}{(-\cw/2)*1cm}{((-.5+\tikzphysics@percent)*\ch)*1cm}
 \anchorborder{\edef\cpx{\the\pgf@x}\edef\cpy{\the\pgf@y}\tikzphysics@component@physicspvdiagramnodestate\pgfpointborderrectangle{\pgfpoint{\cpx}{\cpy}}{\tikzphysics@component@point{\cw/2}{\ch/2}}}
 \backgroundpath{\tikzphysics@component@physicspvdiagramnodestate
\ifnum\caxes=1
\tikzphysics@component@move{-\cw/2}{\ch/2}
\tikzphysics@component@line{-\cw/2}{-\ch/2}
\tikzphysics@component@line{\cw/2}{-\ch/2}
\fi
 }
}
\tikzphysics@declarehook{pv diagram}
\tikzphysics@registerdisplayname{physicspvdiagramnode}{pv diagram}
\tikzphysics@registeranchors{physicspvdiagramnode}{center,north,south,east,west,origin,volume-end,pressure-end}
\tikzphysics@registerfamilies{physicspvdiagramnode}{volume-axis,pressure-axis}
\tikzphysics@registerkeys{physicspvdiagramnode}{pv width,pv height,pv max volume,pv max pressure,pv show axes}
\tikzphysics@registerkeydefaults{physicspvdiagramnode}{pv width/4cm,pv height/3cm,pv max volume/4,pv max pressure/4,pv show axes/true}
\tikzset{physicspvdiagramnode/.style={shape=physicspvdiagramnode,physics logical shape=physicspvdiagramnode,anchor=center,draw=black,fill=none,inner sep=0pt,outer sep=0pt,physics debug setup,every physics object,every pv diagram},pv diagram/.style={physicspvdiagramnode}}

%% Complete heat-engine and refrigerator schematics use the same components.
\tikzset{
 thermo diagram separation/.initial=2cm,
 thermo diagram work length/.initial=1.5cm,
 thermo hot label/.initial={$T_H$},
 thermo cold label/.initial={$T_C$},
 thermo engine label/.initial={$E$},
 thermo refrigerator label/.initial={$R$},
 thermo hot heat label/.initial={$Q_H$},
 thermo cold heat label/.initial={$Q_C$},
 thermo work label/.initial={$W$},
 every thermo flow/.style={draw=black,>=latex,->},
 every thermo label/.style={font=\small},
}
\tikzphysics@declarehook{heat engine diagram}
\tikzphysics@declarehook{refrigerator diagram}
\def\tikzphysics@thermo@diagram#1{%
 \tikzphysics@component@length\tdsep{thermo diagram separation}%
 \tikzphysics@component@length\tdwork{thermo diagram work length}%
 \tikzphysics@component@length\tdd{thermal device size}%
 \tikzphysics@component@length\tdrh{reservoir height}%
 \tikzphysics@component@check{\tdsep>(\tdd+\tdrh)/2 && \tdwork>0}%
  {Thermal diagram separation must clear device and reservoirs; work length must be positive}%
 \coordinate (-origin) at (0,0);
 \node[thermal reservoir] (-hot) at (0,\tdsep) {\pgfkeysvalueof{/tikz/thermo hot label}};
 \node[thermal reservoir] (-cold) at (0,-\tdsep) {\pgfkeysvalueof{/tikz/thermo cold label}};
 \ifnum#1=0
  \node[heat engine] (-device) {\pgfkeysvalueof{/tikz/thermo engine label}};
 \else
  \node[refrigerator] (-device) {\pgfkeysvalueof{/tikz/thermo refrigerator label}};
 \fi
 \coordinate (-work) at (\tdd/2+\tdwork,0);
 %% Pic coordinates follow the physical energy-arrow directions, 0 through 100.
 \foreach \tdp in {0,...,100}{%
  \ifnum#1=0
   \coordinate (-heat-hot-\tdp) at ($(-hot.south)!{\tdp/100}!(-device.hot)$);
   \coordinate (-heat-cold-\tdp) at ($(-device.cold)!{\tdp/100}!(-cold.north)$);
   \coordinate (-work-\tdp) at ($(-device.work)!{\tdp/100}!(-work)$);
  \else
   \coordinate (-heat-hot-\tdp) at ($(-device.hot)!{\tdp/100}!(-hot.south)$);
   \coordinate (-heat-cold-\tdp) at ($(-cold.north)!{\tdp/100}!(-device.cold)$);
   \coordinate (-work-\tdp) at ($(-work)!{\tdp/100}!(-device.work)$);
  \fi
 }

 \ifnum#1=0
  \draw[every thermo flow] (-hot.south)--(-device.hot)
   node[midway,right,every thermo label] {\pgfkeysvalueof{/tikz/thermo hot heat label}};
  \draw[every thermo flow] (-device.cold)--(-cold.north)
   node[midway,right,every thermo label] {\pgfkeysvalueof{/tikz/thermo cold heat label}};
  \draw[every thermo flow] (-device.work)--(-work)
   node[midway,above,every thermo label] {\pgfkeysvalueof{/tikz/thermo work label}};
 \else
  \draw[every thermo flow] (-cold.north)--(-device.cold)
   node[midway,right,every thermo label] {\pgfkeysvalueof{/tikz/thermo cold heat label}};
  \draw[every thermo flow] (-device.hot)--(-hot.south)
   node[midway,right,every thermo label] {\pgfkeysvalueof{/tikz/thermo hot heat label}};
  \draw[every thermo flow] (-work)--(-device.work)
   node[midway,above,every thermo label] {\pgfkeysvalueof{/tikz/thermo work label}};
 \fi
}
\tikzset{
 pics/heat engine diagram/.style args={#1}{code={%
  \begin{scope}[every heat engine diagram,#1]\tikzphysics@thermo@diagram{0}\end{scope}}},
 pics/heat engine diagram/.default={},
 pics/refrigerator diagram/.style args={#1}{code={%
  \begin{scope}[every refrigerator diagram,#1]\tikzphysics@thermo@diagram{1}\end{scope}}},
 pics/refrigerator diagram/.default={},
 pics/physics heat engine diagram/.style={/tikz/pics/heat engine diagram={#1}},
 pics/physics heat engine diagram/.default={},
 pics/physics refrigerator diagram/.style={/tikz/pics/refrigerator diagram={#1}},
 pics/physics refrigerator diagram/.default={},
 pics/heat pump diagram/.style={/tikz/pics/refrigerator diagram={#1}},
 pics/heat pump diagram/.default={},
}
\tikzphysics@registerdisplayname{physicsheatenginediagram}{heat engine diagram}
\tikzphysics@registeranchors{physicsheatenginediagram}{origin,hot (node),cold (node),device (node),work}
\tikzphysics@registerfamilies{physicsheatenginediagram}{heat-hot,heat-cold,work}
\tikzphysics@registerkeydefaults{physicsheatenginediagram}{thermo diagram separation/2cm,thermo diagram work length/1.5cm,reservoir width/3cm,reservoir height/.8cm,thermal device size/1.2cm}
\tikzphysics@registerdisplayname{physicsrefrigeratordiagram}{refrigerator diagram}
\tikzphysics@registeranchors{physicsrefrigeratordiagram}{origin,hot (node),cold (node),device (node),work}
\tikzphysics@registerfamilies{physicsrefrigeratordiagram}{heat-hot,heat-cold,work}
\tikzphysics@registerkeydefaults{physicsrefrigeratordiagram}{thermo diagram separation/2cm,thermo diagram work length/1.5cm,reservoir width/3cm,reservoir height/.8cm,thermal device size/1.2cm}

\makeatother
\endinput
