OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal > Struct Template Reference

#include <phaseFieldCoupling.h>

+ Collaboration diagram for olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal >:

Public Types

using parameters = meta::list<descriptors::EPSILON>
 

Public Member Functions

int getPriority () const
 
template<typename CELL , typename PARAMETERS >
void apply (CELL &cell, PARAMETERS &parameters) any_platform
 

Static Public Attributes

static constexpr OperatorScope scope = OperatorScope::PerCellWithParameters
 

Detailed Description

template<typename T, typename DESCRIPTOR, int xNormal, int yNormal>
struct olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal >

Definition at line 129 of file phaseFieldCoupling.h.

Member Typedef Documentation

◆ parameters

template<typename T , typename DESCRIPTOR , int xNormal, int yNormal>
using olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal >::parameters = meta::list<descriptors::EPSILON>

Definition at line 131 of file phaseFieldCoupling.h.

Member Function Documentation

◆ apply()

template<typename T , typename DESCRIPTOR , int xNormal, int yNormal>
template<typename CELL , typename PARAMETERS >
void olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal >::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 138 of file phaseFieldCoupling.h.

139 {
140 auto psi = cell.template getField<descriptors::PSI>();
141 auto psi0 = cell.template getField<descriptors::PSI0>();
142 auto epsilon = parameters.template get<descriptors::EPSILON>();
143 Vector<T,DESCRIPTOR::d> gradPsi{};
144 T normGradPsi = 1.;
145 if (util::fabs(psi) <= epsilon) {
146 T a = psi - cell.neighbor({-1,0}).template getField<descriptors::PSI>();
147 T b = cell.neighbor({1,0}).template getField<descriptors::PSI>() - psi;
148 T c = psi - cell.neighbor({0,-1}).template getField<descriptors::PSI>();
149 T d = cell.neighbor({0,1}).template getField<descriptors::PSI>() - psi;
150 if (xNormal == 1) b = a;
151 else if (xNormal == -1) a = b;
152 if (yNormal == 1) d = c;
153 else if (yNormal == -1) c = d;
154 T gradX, gradY;
155 if (psi0 > 0) {
156 if (a<0) a = 0;
157 if (b>0) b = 0;
158 if (c<0) c = 0;
159 if (d>0) d = 0;
160 gradX = a;
161 if (b*b>a*a) gradX = b;
162 gradY = c;
163 if (d*d>c*c) gradY = d;
164 normGradPsi = util::sqrt(gradX*gradX+gradY*gradY);
165 }
166 else if (psi0 < 0) {
167 if (a>0) a = 0;
168 if (b<0) b = 0;
169 if (c>0) c = 0;
170 if (d<0) d = 0;
171 gradX = a;
172 if (b*b>a*a) gradX = b;
173 gradY = c;
174 if (d*d>c*c) gradY = d;
175 normGradPsi = util::sqrt(gradX*gradX+gradY*gradY);
176 }
177 else {}
178 cell.template setField<descriptors::NORMGRADPSI>(normGradPsi);
179 } else {
180 cell.template setField<descriptors::NORMGRADPSI>(normGradPsi);
181 }
182 }
platform_constant int c[Q][D]
Definition functions.h:57
constexpr int d() any_platform
Definition functions.h:127
Expr sqrt(Expr x)
Definition expr.cpp:225
Expr fabs(Expr x)
Definition expr.cpp:230
meta::list< descriptors::EPSILON > parameters

References olb::util::fabs(), and olb::util::sqrt().

+ Here is the call graph for this function:

◆ getPriority()

template<typename T , typename DESCRIPTOR , int xNormal, int yNormal>
int olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal >::getPriority ( ) const
inline

Definition at line 133 of file phaseFieldCoupling.h.

133 {
134 return 0;
135 }

Member Data Documentation

◆ scope

template<typename T , typename DESCRIPTOR , int xNormal, int yNormal>
OperatorScope olb::normGradPsiBoundary2D< T, DESCRIPTOR, xNormal, yNormal >::scope = OperatorScope::PerCellWithParameters
staticconstexpr

Definition at line 130 of file phaseFieldCoupling.h.


The documentation for this struct was generated from the following file: