45int main(
int argc,
char *argv[])
50 bool visualization =
true;
53 args.
AddOption(&nx,
"-nx",
"--num-elements-x",
54 "Number of elements in x-direction.");
55 args.
AddOption(&ny,
"-ny",
"--num-elements-y",
56 "Number of elements in y-direction.");
57 args.
AddOption(&order,
"-o",
"--mesh-order",
58 "Order (polynomial degree) of the mesh elements.");
60 "Frequency of the x-component.");
62 "Frequency of the y-component.");
64 "Phase angle of the x-component.");
65 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
67 "Enable or disable GLVis visualization.");
76 delta *= M_PI / 180.0;
92 u.ProjectCoefficient(ufc);
97 soutv <<
"solution\n" << mesh <<
u;
98 soutv <<
"keys 'ARRj" << std::string(90,
'7') <<
"'\n";
99 soutv <<
"palette 17 zoom 1.65 subdivisions 32 0\n";
100 soutv <<
"window_title 'V' window_geometry 0 0 500 500\n";
115 u.ProjectCoefficient(ufc);
120 south <<
"solution\n" << mesh <<
u;
121 south <<
"keys 'ARRj'\n";
122 south <<
"palette 17 zoom 1.65 subdivisions 32 0\n";
123 south <<
"window_title 'H' window_geometry 500 0 500 500\n";
127 ofstream mesh_ofs(
"lissajous.mesh");
128 mesh_ofs.precision(8);
129 mesh.
Print(mesh_ofs);
130 ofstream sol_ofs(
"lissajous.gf");
131 sol_ofs.precision(8);
135 soutv <<
"keys '.0" << std::string((
int)
b,
'0') <<
"'\n" << flush;
136 south <<
"keys '.0" << std::string((
int)
a,
'0') <<
"'\n" << flush;
138 cout <<
"Which direction(s) are the two curves spinning in?\n";
165 p[2] = A*sin(a_*
t + delta_);
173 real_t normal[3] = { cos(b_*
t), sin(b_*
t), 0 };
179#ifdef MFEM_USE_SINGLE
181#elif defined MFEM_USE_DOUBLE
185 MFEM_ABORT(
"Floating point type undefined");
187 real_t cross[3] = { A*a_*sin(b_*
t)*cos(a_*
t+delta_), -A*a_*cos(b_*
t)*cos(a_*
t+delta_), b_*B };
188 for (
int i = 0; i < 3; i++) { cn += cross[i]*cross[i]; }
189 for (
int i = 0; i < 3; i++) { cross[i] /= sqrt(cn); }
193 for (
int i = 0; i < 3; i++)
195 p[i] += R * (cos(theta)*normal[i] + sin(theta)*cross[i]);
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
A general function coefficient.
Class for grid function - Vector with associated FE space.
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
static Mesh MakeCartesian2D(int nx, int ny, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, bool sfc_ordering=true)
Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATER...
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
void Transform(void(*f)(const Vector &, Vector &))
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
bool Good() const
Return true if the command line options were parsed successfully.
void SetSize(int s)
Resize the vector to size s.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
void lissajous_trans_v(const Vector &x, Vector &p)
void lissajous_trans(const Vector &x, Vector &p, real_t a_, real_t b_, real_t delta_)
void lissajous_trans_h(const Vector &x, Vector &p)
real_t u_function(const Vector &x)
real_t u(const Vector &xvec)
real_t p(const Vector &x, real_t t)