### y component of a vector

80

views

0

Hello everyone,

I am trying to write down a subdomain function that takes a 3 component vector field normals, and I would like to check if the y component is smaller than zero or not. I have the following code for it but it seems like it is not doing the right thing. Anyone knows how I can extract the y component of the n_vector and check if its smaller than zero for every data in n_vector? Thanks in advance.

I am trying to write down a subdomain function that takes a 3 component vector field normals, and I would like to check if the y component is smaller than zero or not. I have the following code for it but it seems like it is not doing the right thing. Anyone knows how I can extract the y component of the n_vector and check if its smaller than zero for every data in n_vector? Thanks in advance.

`class Btilda : public SubDomain `

public:

Btilda (const Function& normals) : _normals(normals) {};

bool inside(const Array<double>& x , bool on_boundary) const

{

std::vector<double> n_vector; _normals.vector()->get_local(n_vector);

const double n = (0.0,1.0, 0.0);

for (size_t i = 0; i < n_vector.size(); ++i)

{

const double n_vectory=n_vector[i]*n;

if(n_vectory<-1e-15)

{ return true; }

else { return false; }

}

}

private: const Function& _normals;

};

Community: FEniCS Project

Please login to add an answer/comment or follow this question.