OpenLB 1.8.1
Loading...
Searching...
No Matches
olb::normGradPsi Struct Reference

#include <phaseFieldCoupling.h>

+ Collaboration diagram for olb::normGradPsi:

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

Definition at line 73 of file phaseFieldCoupling.h.

Member Typedef Documentation

◆ parameters

Member Function Documentation

◆ apply()

template<typename CELL , typename PARAMETERS >
void olb::normGradPsi::apply ( CELL & cell,
PARAMETERS & parameters )
inline

Definition at line 82 of file phaseFieldCoupling.h.

83 {
84 using V = typename CELL::value_t;
85 using DESCRIPTOR = typename CELL::descriptor_t;
86
87 auto psi = cell.template getField<descriptors::PSI>();
88 auto psi0 = cell.template getField<descriptors::PSI0>();
89 auto epsilon = parameters.template get<descriptors::EPSILON>();
91 V normGradPsi = 1.;
92 if (util::fabs(psi) <= epsilon) {
93 V a = psi - cell.neighbor({-1,0}).template getField<descriptors::PSI>();
94 V b = cell.neighbor({1,0}).template getField<descriptors::PSI>() - psi;
95 V c = psi - cell.neighbor({0,-1}).template getField<descriptors::PSI>();
96 V d = cell.neighbor({0,1}).template getField<descriptors::PSI>() - psi;
97 V gradX, gradY;
98 if (psi0 > 0) {
99 if (a<0) a = 0;
100 if (b>0) b = 0;
101 if (c<0) c = 0;
102 if (d>0) d = 0;
103 gradX = a;
104 if (b*b>a*a) gradX = b;
105 gradY = c;
106 if (d*d>c*c) gradY = d;
107 normGradPsi = util::sqrt(gradX*gradX+gradY*gradY);
108 }
109 else if (psi0 < 0) {
110 if (a>0) a = 0;
111 if (b<0) b = 0;
112 if (c>0) c = 0;
113 if (d<0) d = 0;
114 gradX = a;
115 if (b*b>a*a) gradX = b;
116 gradY = c;
117 if (d*d>c*c) gradY = d;
118 normGradPsi = util::sqrt(gradX*gradX+gradY*gradY);
119 }
120 else {}
121 cell.template setField<descriptors::NORMGRADPSI>(normGradPsi);
122 } else {
123 cell.template setField<descriptors::NORMGRADPSI>(normGradPsi);
124 }
125 }
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
Vector(T &&t, Ts &&... ts) -> Vector< std::remove_cvref_t< T >, 1+sizeof...(Ts)>
meta::list< descriptors::EPSILON > parameters

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

+ Here is the call graph for this function:

◆ getPriority()

int olb::normGradPsi::getPriority ( ) const
inline

Definition at line 77 of file phaseFieldCoupling.h.

77 {
78 return 0;
79 }

Member Data Documentation

◆ scope

OperatorScope olb::normGradPsi::scope = OperatorScope::PerCellWithParameters
staticconstexpr

Definition at line 74 of file phaseFieldCoupling.h.


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